3 * FusionForge RDF utils
5 * Copyright 2012, Olivier Berger and Institut Mines-Telecom
7 * This file is part of FusionForge. FusionForge is free software;
8 * you can redistribute it and/or modify it under the terms of the
9 * GNU General Public License as published by the Free Software
10 * Foundation; either version 2 of the Licence, or (at your option)
13 * FusionForge is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 require_once 'arc/ARC2.php';
26 * rdfutils_setPropToUri() - Add a relation (a link to a URI) to an ARC2_Resource
28 * example : $res->setRel('rdf:type', 'doap:Project');
30 * @param ARC2_Resource $res
32 * @param string $value
34 function rdfutils_setPropToUri($res, $prop, $value) {
35 // ARC2_Resource may not yet have a setRel() method
36 if (method_exists('ARC2_Resource','setRel')) {
37 $res->setRel($prop, $value);
40 if(!is_array($value)) {
43 'value' => $res->expandPName($value));
44 $res->setProp($prop, $uri);
47 foreach($value as $i => $x) {
51 'value' => $res->expandPName($x));
55 $res->index[$s][$res->expandPName($prop)] = $value;
63 // c-file-style: "bsd"