1

The resource description framework (RDF) allows specifying a distributed system of resources. For example, I could specify that I am friends with Bill using the triple <http:example.com/me> <http:example.com/friendsWith> <http:otherExample.com/Bill>. And "http:otherExample.com/Bill" could be dereferenced if it turns out that "http:otherExample.com/Bill" is an rdf resource (e.g., application/rdf+xml). However, what if I want to dereference "http:otherExample.com/Bill" as some literal with some dataType?

The problem is that it seems impossible to specify that the object should be a literal with a datatype at some remote location given the contradiction of specifying rdfs:range of some property to be a datatype and then providing a URI instead. For example, if I specify a property ex:hasProfilePic with rdfs:range xsd:base64Binary, but then I have a triple such that <http:otherExample.com/Bill> ex:hasProfilePic <http://otherExample.com/BillsProfilePic>, wouldn't this be invalid since the range of the specified ex:hasProfilePic is actually a URI resource?

A possible solution is to include a datatype in the dereferenced URL, "data:image/png;base64,iVBORw0KGgoAAAANS...", but this still wouldn't encode a literal in the RDF graph.

Ideally, I think there would be a datatype that is a union of URI and a datatype so that that the literal is interpreted as either based on the content. For example, ex:externalImage could be a union datatype of URI and image and allow specifying literals using datatype notation "http://otherExample.com/BillsProfilePic"^^ex:externalImage. Does such a datatype scheme already exist? Or are there other ways of dereferencing literals with datatypes in RDF?

Sven Voigt
  • 91
  • 7
  • Far as I can tell that wouldn't be a literal. Literals are defined as a type and a string fully representing a value in the value space for that type. Putting the "data:/image..."^^your_image_datatype would work, but the URL of an image would be just an IRI. You can do that now but they type of the value is either IRI or string, with any further advanced treatment left to the application. – Ignazio Mar 01 '23 at 16:29
  • Not following. What wouldn't be a literal? 1- a URI resource is definitely not a literal. 2- a literal with a datatype that can be interpreted differently based on content should be a literal no? And not sure what you mean with value is either IRI or string. IRI resource is a possible value and so is a literal IRI with datatype xsd:anyURI. – Sven Voigt Mar 01 '23 at 20:56
  • Not sure I understand everything you say, or maybe you are confusing things. Let us simplify: suppose you have `

    rdfs:range xsd:integer`. Am I correct assuming you would like to say `

    ` such that `someURI` dereference to an integer?

    – Antoine Zimmermann Mar 05 '23 at 10:10
  • @AntoineZimmermann I am asking if given

    , can be interpreted as xsd:integer? I am guessing no but would like clarification. Therefore, I am trying to find an existing standard of datatypes to express

    "ex:locationofInt"^^namespace:unionOfURIAndInt OR

    "ex:5"^^namespace:unionOfURIAndInt, where the datatype expresses that the literal should be interpreted based on content. Does such a standard of datatypes exist?

    – Sven Voigt Mar 07 '23 at 17:23
  • In RDF, a URI can be interpreted as anything, including numbers, strings, dates, whatever. However, OWL (2) DL puts additional restrictions. In OWL DL, URIs cannot denote numbers, strings, dates, etc. If you use an OWL DL editor like Protégé, you won't be able to put a URI as object if you use a datatype property, and you won't be able to use a literal with an object property. But if you don't need your data to interact with OWL DL tools, you can use a URI to denote a number, or an `xsd:base64Binary` for that matter. – Antoine Zimmermann Mar 09 '23 at 07:45
  • @AntoineZimmermann Sure it can be interpreted as anything. I guess interpret has a different meaning and I was trying to ask "what can someURI be dereferenced as?". If dereferences as a base64binary, then what would a resulting graph look like? I would have

    and

    "VGhlIHF1a..."? My understanding is that if is dereferencable then there are additional triples at someURI. For example if someURI is an rdf resource of triples "text", then after dereferencing I have the triples

    and "text". How this applies to binary idk.

    – Sven Voigt Mar 09 '23 at 22:43

1 Answers1

1

The world of RDF is not divided into "URI resources" and "literals". A resource is anything, any entity that is worthy of describing or identifying. A certain subset of resources are literal values (class rdfs:Literal); these are entities in the value space of datatypes (rdfs:Datatype), i.e. any entity that can be mapped to by a literal is an instance of rdfs:Literal. URI nodes and literal nodes are merely means of identifying the resources in the universe, either using an address/name, or the value (and datatype, language tag etc.).

This is fine:

<p> rdfs:range xsd:integer .

<a> <p> <http://example.org/some_integer> .

Under RDFS Schema, it can be entailed that <http://example.org/some_integer> a rdfs:Literal, and there is no contradiction in that ‒ you know that http://example.org/some_integer identifies some integer, and you give a name (the URI) to this integer, just without specifying its value. After all, something like http://dbpedia.org/resource/Graham's_number is perfectly valid to use and there is not much other choice anyway.

It's up to you what you host at the URI, but there are some options:

<> owl:sameAs 10 .

This is recognizable under OWL Full, and easily readable and understandable as well.

<> a rdf:CompoundLiteral ;
  a xsd:integer ;
  rdf:value "10" ;

This seems reasonable to me as well, but might not be as understandable.

{
  "@type": "xsd:integer",
  "@value": "10"
}

Offering this JSON-LD also seems like a viable alternative to me, but I am not sure whether there is something that could interpret this correctly.

IS4
  • 11,945
  • 2
  • 47
  • 86