Use of typed URI in sesame sail openrdf

370 views Asked by At

My question is simple but maybe non-sense. (in that case , sorry to people who gonna spend time to explain me why ) I'd like to create a resource like (i dont show all the resource declaration here ) :

<owl:DatatypeProperty rdf:about="relation:isPartOf">
    <rdfs:domain rdf:resource="http://www.w3.org/2004/02/skos/core#note"/>
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#anyURI"/>
</owl:DatatypeProperty>

<rdf:Description rdf:about="resource:context:sc#c1">
<skos:note rdf:datatype="relation:isPartOf" rdf:resource="resource:context:sc#c2">
    </skos:note>
</rdf:Description>

Important to see is the triple about a skos:note relation
Subject : c1 a uri. Predicate : a skos:note , Object : a typed URI My URI is not a direct URI but a "relation;isPartOf" uri. I create a custom typedUri class to do that / i used a home made triple store so i can use my own class. I change a little bit the RDFXMWritter to output these example. so "it works". My question is more : Can a URI be typed like this ? why sesame openrdf do not provide a TypedURI class ? I'm sure there is a good reason ? any help, ideas or answers would be nice.

i'm quite sure , my idea to create a TypedURi class is wrong somewhere . but where ? :-) thank you

EDIT : the TypedURI is not really a new kind of resource. The URI in my context is still a URI. i just declare that inside my skos:note statement , that for c1 , the object of the statement is a data of type "relation:isPartOf" and the range of the data is a anyURI. ... The typedURI helps to implements the datatype with such a range.

1

There are 1 answers

3
Jeen Broekstra On

First of all: no, a URI can not be typed like this in RDF. Which also answers your second question: OpenRDF Sesame does not provide this functionality because it is not part of the RDF model.

Typing of URIs (or more accurately, resources, which are identified using URIs) is done by using an rdf:type relation, linking the resource URI to a class URI. For example, to make the resource ex:p1 of type foaf:Person, we would say (using Turtle syntax for RDF):

ex:p1 rdf:type foaf:Person .

There's another kind of typing in RDF, namely datatyping. This only applies to literal values so it can not be used on a URI. It is used to make a literal value a string, an integer number, a date, etc.

Update a confusion may arise because xsd:anyURI is a valid datatype in RDF, and it is (in XML Schema) defined to be a type for URIs. However, when using a datatype in RDF, its lexical space is always a literal (simply because the spec only allows for literals to actually have a datatype). So you could indeed do something like this (using Turtle syntax for literal notation):

"http://www.example.org/some/uri"^^xsd:anyURI  

But from the point of view of the RDF model, this is not a URI, but a literal string (with datatype xsd:anyURI). So in a sense, yes, you can add types to URIs in RDF, but you can only do this by "converting" them to literals first.