comparison sites/all/libraries/ARC2/arc/serializers/ARC2_RDFSerializer.php @ 4:ce11bbd8f642

added modules
author danieleb <danielebarchiesi@me.com>
date Thu, 19 Sep 2013 10:38:44 +0100
parents
children
comparison
equal deleted inserted replaced
3:b28be78d8160 4:ce11bbd8f642
1 <?php
2 /**
3 * ARC2 RDF Serializer
4 *
5 * @author Benjamin Nowack
6 * @license <http://arc.semsol.org/license>
7 * @homepage <http://arc.semsol.org/>
8 * @package ARC2
9 * @version 2010-11-16
10 */
11
12 ARC2::inc('Class');
13
14 class ARC2_RDFSerializer extends ARC2_Class {
15
16 function __construct($a, &$caller) {
17 parent::__construct($a, $caller);
18 }
19
20 function __init() {
21 parent::__init();
22 foreach ($this->ns as $k => $v) {
23 $this->nsp[$v] = $k;
24 }
25 }
26
27 /* */
28
29 function xgetPName($v) {/* moved to merged getPName in ARC2_CLass */
30 if (preg_match('/^([a-z0-9\_\-]+)\:([a-z\_][a-z0-9\_\-]*)$/i', $v, $m) && isset($this->ns[$m[1]])) {
31 $this->used_ns = !in_array($this->ns[$m[1]], $this->used_ns) ? array_merge($this->used_ns, array($this->ns[$m[1]])) : $this->used_ns;
32 return $v;
33 }
34 if (preg_match('/^(.*[\/\#])([a-z\_][a-z0-9\-\_]*)$/i', $v, $m)) {
35 return $this->getPrefix($m[1]) . ':' . $m[2];
36 }
37 return 0;
38 }
39
40 /* */
41
42 function getSerializedTriples($triples, $raw = 0) {
43 $index = ARC2::getSimpleIndex($triples, 0);
44 return $this->getSerializedIndex($index, $raw);
45 }
46
47 function getSerializedIndex($index, $raw = 0) {
48 return '';
49 }
50
51 /* */
52
53 }