David Nickerson wrote:
> Hi all,
>
> I have just been looking through the graphing metadata specification 
> (http://www.cellml.org/specifications/metadata/graphs) and have a couple 
> of questions (pretty much due to my continuing RDF ignorance). This 
> specification seems to have dropped behind the simulation specification 
> a bit, so I'm using the simulation spec rather than the example given in 
> the graphing spec.
>
> In the fragment
>
> <cg:x-variable rdf:parseType="Resource">
>    <cg:simulation rdf:nodeID="mainsim"/>
>    <cg:variable><rdf:Description rdf:about="#time"/></cg:variable>
> </cg:x-variable>
>
> (and similar for the y-variable and the text states the use of 
> cg:simulation but the example contains cs:simulation) I can see how the 
> use of the rdf:nodeID on the cg:simulation works when the simulation and 
> the graph metadata are contained in the same graph. But what I want to 
> do is have my graph metadata independent of the simulation (and model) 
> metadata. For example, I want to specify a graph which plots variables 
> from different models each specified in a different model at different 
> URIs. So my question is whether the following RDF is the equivalent of 
> the above fragment for the case where the graph metadata is in a 
> different RDF graph to the simulation:
>
> <cg:x-variable rdf:parseType="Resource">
>    <cg:simulation
>      rdf:resource="file:///example/models/swing.xml#mainsim"/>
>    <cg:variable><rdf:Description rdf:about="#time"/></cg:variable>
> </cg:x-variable>
>
> given the cs:simulation is defined
>
> <cs:simulation rdf:ID="mainsim" rdf:parseType="Resource">
> ...
> </cs:simulation>
>   
The fragment you have given reifies the anonymous node generated by 
parseTypeResourcePropertyElement, as per .

http://www.w3.org/TR/2004/REC-rdf-syntax-grammar-20040210/#parseTypeLiteralPropertyElt

 i.e. what you have is equivalent to (I am assuming that the above 
fragment is in <rdf:Description rdf:about="#mymodel"> ), and writing out 
very
long hand, unoptimised RDF:
<rdf:Description rdf:about="#mymodel">
  <cg:simulation>
    <rdf:Description 
rdf:about="http://www.example.org/generated-anonymous-node-URL#00000"; />
  </cg:simulation>
</rdf:Description>
<rdf:Description rdf:about="#mainsim">
  <rdf:subject><rdf:Description rdf:about="#mymodel"/></rdf:subject>
  <rdf:predicate><rdf:Description 
rdf:about="http://www.cellml.org/metadata/graphs/1.0#simulation"/></rdf:predicate>
  <rdf:object><rdf:Description 
rdf:about="http://www.example.org/generated-anonymous-node-URL#00000"/></rdf:object>
  <rdf:type><rdf:Description 
rdf:about="|http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement|"/></rdf:type>
</rdf:Description>

This is clearly not what you want. You can't use 
rdf:parseType="Resource" to get this, because that always generates an 
anonymous node. Instead, you need to explictly add an rdf:Description 
like this:
<rdf:Description rdf:about="#mymodel">
  <cg:simulation>
    <rdf:Description rdf:ID="mainsim">
      ...
    </rdf:Description>
  </cg:simulation>
</rdf:Description>
> in the file at the URI file:///example/models/swing.xml ??
>
> And if this is the case, is it then valid to also define a rdf:nodeID on 
> the same simulation node for use in graphs within simulation's graph? or 
> in such a case is it better to just always use the rdf:ID?
>   
Nodes can only have one URL. If it is an anonymous node, the RDF parser 
will generate a URL for it (unless it has an rdf:nodeID which matches an 
existing rdf:nodeID, in which case it will use the existing URL 
instead). Since you don't know what URL is generated, you cannot refer 
to an anonymous node outside of the document. If you use an rdf:ID, you 
explicitly set the URL to xml:base "#" rdf:ID.

In summary:
* You can have rdf:nodeID, or rdf:ID, but not both.
* Use anonymous nodes if it would never make sense to access the node 
from outside the document.
* Assign an explicit URL with rdf:ID or rdf:about if it would make sense 
to access the node from outside the document.

Of course, it could be argued that it should be possible to define a 
graph externally for any simulation, and that would suggest that we 
should never use anonymous nodes to describe simulations.

BTW if you are unsure what RDF graph gets generated from RDF/XML, the 
W3C RDF validator has a feature to visualise this. See 
http://www.w3.org/RDF/Validator/

Best regards,
Andrew

_______________________________________________
cellml-discussion mailing list
[email protected]
http://www.cellml.org/mailman/listinfo/cellml-discussion

Reply via email to