Furthermore, three forms of metadata value are supported in Grimoires: string to describe some simple fact, URI to refer to some defined ontology concept, and TriplesAssertion to describe some complicated metadata. By using TriplesAssertion, we can attach a RDF graph that contains multiple RDF statements to an entity.
The XML schema for metadata value:
<xsd:element name="metadataValue" type="meta:MetadataValue"/>
<xsd:complexType name="MetadataValue">
<xsd:choice>
<xsd:element ref="meta:triplesAssertion"/>
<xsd:element ref="meta:stringValue"/>
<xsd:element ref="meta:uriValue"/>
</xsd:choice>
</xsd:complexType>
<xsd:element name="stringValue" type="xsd:string"/>
<xsd:element name="uriValue" type="xsd:anyURI"/>
<xsd:element name="triplesAssertion" type="meta:TriplesAssertion"/>
<xsd:complexType name="TriplesAssertion">
<xsd:sequence>
<xsd:element name="triples" type="xsd:string"/>
<xsd:element name="resourceIdentifier" type="xsd:string"/>
<xsd:element name="language" type="xsd:string"/>
<xsd:element name="base" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
In the TriplesAssertion structure, "triples" is the RDF graph encoded n a
string. "language" is the format in which the RDF graph is encoded. Predefined
values are "RDF/XML", "N-TRIPLE" and "N3". "base" is used when converting
relative URI's to absolute URI's in the RDF graph. The base URI may be null if
there are no relative URIs to convert. A base URI of "" may permit relative URIs
to be used in the model.The usage of "resourceIdentifier" is as follows:
The metadata attachment looks like to set up a new RDF triple (annotatedEntity,
hasMetadataType, metadataValue). Let's call it Triple M. The metadataValue in
Triple M can be a RDF resource if you attach a URI metadata or a
triplesAssertion metadata. The
triples assertion contains multiple RDF triples, which in fact is able to forms
a RDF graph. If the triples assertion only forms a tree, we know the root of the
tree must be the metadataValue in Triple M. However, when the triples assertion
forms a graph, there is no way for us to tell which RDF resource should be the
metadataValue in Triple M. Therefore, the "resourceIdentifier" is used to tell
Grimoires which resource inside the triples assertion is used as the
metadataValue in Triple M.For instance, we have a service description for
Grimoires, and we want to attach a metadata to say Grimoires has a developer
called Weijian. We also want to annotate some information for Weijian, such as
Weijian is a Research Fellow working in the school of ECS, while ECS is a part
of Univ. of Southampton. By using TriplesAssertion, we can model this
information in the following way:We attach a TriplesAssertion metadata to
the Grimoires service, the metadata type is http://someNameSpace/hasDeveloper.
The metadata value is a TriplesAssertion. Its language is RDF/XML. Its base is
omitted. its triples is
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:tns="http://someNameSpace/">
<rdf:description rdf:about="tns:Weijian">
<tns:worksIn rdf:nodeID="tns:ECS"/>
</rdf:description>
<rdf:description rdf:about="tns:ECS">
<tns:belongsTo rdf:nodeID="tns:SOTON"/>
</rdf:description>
</rdf:RDF>
Obviously, the resourceIdentifier of the above triplesAssertion is http://someNameSpace/Weijian.
<meta:metadata meta:metadataKey="">
<meta:metadataType>http://someNameSpace/hasDeveloper</meta:metadataType>
<meta:metadataValue>
<meta:triplesAssertion>
<meta:triples>
(?developer, <http://someNameSpace/worksIn>, ?school)
(?school, <http://someNameSpace/belongsTo>, <http://someNameSpace/SOTON>)
</meta:triples>
<meta:resourceIdentifier>?developer</meta:resourceIdentifier>
<meta:language>RDQL</meta:language>
</meta:triplesAssertion>
</meta:metadataValue>
</meta:metadata>
The "triples" in the "triplesAssertion" actually describes the RDF graph pattern
in RDQL, with variables allowed. In the RDQL segment, the AND clause is allowed.
Do not use the USING clause to define the name space prefix.