Ejemplo n.º 1
0
$inf = new RDFSFModel('http://mytest.com');
$parser = new N3Parser();
$inf->addModel($parser->parse2model('
<http://example.org/baz1> <http://example.org/bat> <http://example.org/baz2> .
<http://example.org/bat> <http://www.w3.org/2000/01/rdf-schema#subPropertyOf> <http://example.org/bas> .
'));
$inf2->addModel($parser->parse2model('
<http://example.org/baz1> <http://example.org/bat> <http://example.org/baz2> .
<http://example.org/bat> <http://www.w3.org/2000/01/rdf-schema#subPropertyOf> <http://example.org/bas> .
'));
echo '<B>Added the following Triples:</B><BR>' . htmlentities('
<http://example.org/baz1> <http://example.org/bat> <http://example.org/baz2> .') . '<BR>' . htmlentities('
<http://example.org/bat> <http://www.w3.org/2000/01/rdf-schema#subPropertyOf> <http://example.org/bas> .
') . '<BR>';
$inf->writeAsHtmlTable();
$inf2->writeAsHtmlTable();
#$sub=$inf2->subtract($inf);
#$sub->writeAsHtmlTable();
#echo '<BR><hr><BR>';
echo '<BR><hr><BR>';
$inf->add(new Statement(new Resource('http://example.org/bat'), new Resource('http://www.w3.org/2000/01/rdf-schema#domain'), new Resource('http://example.org/Domain1')));
$inf->add(new Statement(new Resource('http://example.org/bat'), new Resource('http://www.w3.org/2000/01/rdf-schema#range'), new Resource('http://example.org/Range1')));
$inf2->add(new Statement(new Resource('http://example.org/bat'), new Resource('http://www.w3.org/2000/01/rdf-schema#domain'), new Resource('http://example.org/Domain1')));
$inf2->add(new Statement(new Resource('http://example.org/bat'), new Resource('http://www.w3.org/2000/01/rdf-schema#range'), new Resource('http://example.org/Range1')));
echo '<B>Added the following Triples:</B><BR>' . htmlentities('
<http://example.org/bat> <http://www.w3.org/2000/01/rdf-schema#domain> <http://example.org/Domain1> .') . '<BR>' . htmlentities('
<http://example.org/bat> <http://www.w3.org/2000/01/rdf-schema#range> <http://example.org/Range1> .
') . '<BR>';
$inf->writeAsHtmlTable();
$inf2->writeAsHtmlTable();
echo '<BR><hr><BR>';