AJ,
Note that <rdf:Description ...> with an <rdf:type
rdf:resource="...Experiment" /> inside is exactly equivalent to
<exp:Experiment ...>. The latter is just a shorthand for the former.
That said, when you add an rdf:type statement with value
exp:Experiment to the instance, you should get the output you want.
Here's some code to get you started:
<?php
define("RDFAPI_INCLUDE_DIR", "./rdfapi-php/api/");
include(RDFAPI_INCLUDE_DIR . "RdfAPI.php");
$model = ModelFactory::getDefaultModel();
$model->addNamespace('ex', 'http://example.org/');
$a = new Resource("http://example.org/a");
$type = new Resource("http://www.w3.org/1999/02/22-rdf-syntax-ns#type");
$b = new Resource("http://example.org/b");
$statement = new Statement($a, $type, $b);
$model->add($statement);
echo $model->writeRdfToString();
?>
Best,
Richard
On 5 Jun 2006, at 08:13, AJ Chen wrote:
> I created a ResModel for an instance of class Experiment (from my
> own ontology called "exp") and wrote it into RDF file using $model-
> >saveAs($save_file). In the RDF file, the class instance started with
> <rdf:Description rdf:ID="i">
>
> How do I tell the resmodel that it's an instance of Experiment
> class? I want to have the RDF writen as
> <rdf:RDF
> <exp:Experiment rdf:ID="i">
> ...
>
> Thanks,
> AJ
>
>
> _______________________________________________
> Rdfapi-php-interest mailing list
> Rdf...@li...
> https://lists.sourceforge.net/lists/listinfo/rdfapi-php-interest
|