This repository has been archived by the owner on Aug 5, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Parser.php
75 lines (70 loc) · 2.61 KB
/
Parser.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
/*
* This file is part of Saft.
*
* (c) Konrad Abicht <[email protected]>
* (c) Natanael Arndt <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Saft\Data;
/**
* The Parser interface describes what methods a RDF parser should provide. An instance of Parser must be initialized
* with a certain serialization the parser is able to parse. That means, that you have to create different instances
* of Parser for each serialization you need.
*
* @api
*
* @since 0.1
*/
interface Parser
{
/**
* Parses a given string and returns an iterator containing Statement instances representing the
* previously read data.
*
* @param string $inputString data string containing RDF serialized data
* @param string $baseUri The base URI of the parsed content. If this URI is null the inputStreams URL
* is taken as base URI.
*
* @return StatementIterator statementIterator instaince containing all the Statements parsed by the
* parser to far
*
* @throws \Exception if the base URI $baseUri is no valid URI
*
* @api
*
* @since 0.1
*/
public function parseStringToIterator($inputString, $baseUri = null);
/**
* Parses a given stream and returns an iterator containing Statement instances representing the
* previously read data. The stream parses the data not as a whole but in chunks.
*
* @param string $inputStream filename of the stream to parse which contains RDF serialized data
* @param string $baseUri The base URI of the parsed content. If this URI is null, the inputStreams URL is taken
* as base URI. (optional)
*
* @return StatementIterator a StatementIterator containing all the Statements parsed by the parser to far
*
* @throws \Exception if the base URI $baseUri is no valid URI
*
* @api
*
* @since 0.1
*/
public function parseStreamToIterator($inputStream, $baseUri = null);
/**
* Returns an array of prefixes which where found during the last parsing. Might also be any other prefix list
* depending on the implementation. Might even be empty.
*
* @return array An associative array with a prefix mapping of the prefixes parsed so far. The key
* will be the prefix, while the values contains the according namespace URI.
*
* @api
*
* @since 0.1
*/
public function getCurrentPrefixList();
}