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
/
Serializer.php
68 lines (62 loc) · 2.12 KB
/
Serializer.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
<?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;
use Saft\Rdf\StatementIterator;
/**
* The Serializer interface describes what methods a RDF serializer should provide. An instance of Serialzer must
* be initialized with a certain serialization. That means, that you have to create different instances of Serializer
* for each serialization you need.
*
* @api
*
* @since 0.1
*/
interface Serializer
{
/**
* Set the prefixes which the serializer can/should use when generating the serialization.
* Please keep in mind, that some serializations don't support prefixes at all or that some
* implementations might ignore them.
*
* @param array $prefixes An associative array with a prefix mapping of the prefixes. The key
* will be the prefix, while the values contains the according namespace URI.
*
* @api
*
* @since 0.1
*/
public function setPrefixes(array $prefixes);
/**
* Transforms the statements of a StatementIterator instance into a stream, a file for instance.
*
* @param StatementIterator $statements the StatementIterator containing all the Statements which
* should be serialized by the serializer
* @param string|resource $outputStream filename or file pointer to the stream to where the serialization
* should be written
*
* @throws \Exception if unknown format was given
*
* @api
*
* @since 0.1
*/
public function serializeIteratorToStream(StatementIterator $statements, $outputStream);
/**
* Returns a list of all supported serialization types.
*
* @return array array of supported serialization types which can be used by this serializer
*
* @api
*
* @since 0.1
*/
public function getSupportedSerializations();
}