In RDF/XML, it is possible to specify anonymous resources as follows (where p has been declared as an OWL object property):

<owl:NamedIndividual rdf:about="&ont;a">
    <rdf:type rdf:resource="&ont;A"/>
        <rdf:type rdf:resource="&ont;B"/>

(EDIT: The above fragment is syntactically incorrect RDF/XML: see Antoine's answer for the correct version)

This describes the situation where a is p-related to some instance of B, but we haven't committed to any particular individual. In OWL-API, such instances can be instantiated as objects of the OWLAnonymousIndividual (Java) interface.

My question: is there a generally accepted way of specifying and dealing with anonymous datatype literals? For instance, I can hack together something like this:

<owl:NamedIndividual rdf:about="&ont;a">
    <rdf:type rdf:resource="&ont;A"/>
    <q rdf:datatype="&rdfs;float"></q>

This gets at what I'm after, which is to assert that a is q-related to some floating point number, but we're not making a commitment about what it actually is in the domain of floats. This appears to be valid RDF/XML, and OWL-API can indeed construct an OWLLiteral object to represent it, but the only way it seems I can check if the instance is anonymous is to test if the literal component is the empty string, if the literal is indeed typed and not a string.

Is there a better way?

asked 15 Mar '12, 23:33

sharky's gravatar image

accept rate: 0%

edited 17 Mar '12, 02:47

Short answer: No, but... :-)

Long answer:

Let me start by saying that the OWL API's internal representation model mirrors the OWL 2 Structural Specification, which is (a superset of) the syntax of OWL 2 DL. This syntax of OWL has no concept of anonymous data values (i.e., anonymous instances of datatypes), only anonymous individuals are supported by this syntax. If you check through the details of the specification of the syntax, you will not find any treatment of anonymous individuals in positions where data values are expected. For example, the syntax definition for data property assertions requires object of sort "targetValue" in value position, which, according to the BNF given in Sec. 9.6, can only be a literal. Having a blank node in such a position would simply be a syntax error (blank nodes indicate anonymous individuals in the Structural Specification just as in RDF).

This is also reflected by the (reverse) OWL 2 RDF Mapping: there are no translation rules that would lead from an RDF graph with blank nodes in data value position to a corresponding ontology in the Structural Specification. For example, the only such rule that leads to an expression of the form "DataPropertyAssertion(...)" starts from an RDF triple having a literal in its object position (see Table 16).

It is also noteworthy in this context that the OWL 2 Direct Semantics, which is the Semantics of OWL 2 DL and which is defined on top of the OWL 2 Structural Specification, strictly separates between individuals (instances of classes) and data values (instances of datatypes), see Sec. 2.2. Hence, anonymous individuals can never be interpreted as data values under the OWL 2 Direct Semantics (and, therefore, never in OWL DL).

Consequently (at least to my best knowledge), OWL API does not support anonymous data values.

However, anonymous data values are allowed and interpreted as such in OWL 2 Full. They are allowed, because OWL 2 Full allows for arbitrary RDF graphs as valid syntax, in particular those RDF graphs having blank nodes in data value position. And they are interpreted as data values due to the specific nature of the semantics of OWL 2 Full, the OWL 2 RDF-Based Semantics, which is an extension of RDFS. Actually, data values are simply individuals under this semantics, in contrast to the OWL 2 Direct Semantics, which, as said above, strictly separates individuals from data values.

But while OWL 2 Full does the job, the OWLAPI does not help you, because the OWLAPI has not been designed to work with arbitrary RDF graphs (i.e., arbitrary OWL Full ontologies). While the OWLAPI pretty rarely reports a syntax error when given an RDF graphs for which there is no reverse RDF mapping to an ontology for the Structural Specification, what the OWLAPI actually does with such input is "repairing" such graphs into a form that matches its internal representation model, which, as said, mirrors the OWL 2 Structural Specification. This may then easily lead to changes that the original author did not intend, in particular, blank nodes in data value position will not be retained as such, simply because there is no way to represent them internally within the OWLAPI.

permanent link

answered 16 Mar '12, 08:04

Michael%20Schneider's gravatar image

Michael Schn... ♦
accept rate: 34%

Thanks Michael, great explanation.

(17 Mar '12, 02:38) sharky sharky's gravatar image

There is a better (and correct) way to do that.

First, there is an error in your RDF/XML code. You cannot have a property element as a direct child of a property element. Here, you have rdf:type as a direct child of p. Also, you would need a prefix for p (let's say ont). It should read:

<owl:NamedIndividual rdf:about="&ont;a">
    <rdf:type rdf:resource="&ont;A"/>
            <rdf:type rdf:resource="&ont;B"/>

but you can write it in a more compact way:

<ont:A rdf:about="&ont;a">

The term owl:NamedIndividual is not required, but you can keep it if you want or need to.

Your second example does not introduced an anonymous literal. It actually introduce the literal ""^^rdfs:float, that is, a literal with an empty string and type rdfs:float. There are two problems: (1) the standard datatype for floats is xsd:float; (2) an empty element does not give you an anonymous individual.

You can rewrite your second snippet as follows:

<ont:A rdf:about="&ont;a>

Alternatively, you may want to restrict the range of ont:q to xsd:float, then write:

<owl:ObjectProperty rdf:about="&ont;q">
    <rdfs:range rdf:resource="&xsd;float"/>
<ont:A rdf:about="&ont;a>

If you write your examples in Turtle or NTriples, you can better see the RDF graph in terms of triples.

First example:

ont:a  a  ont:A ;
       ont:p  [ a  ont:B ] .

Second example:

ont:a  a  ont:A ;
       ont:p  [ a  xsd:float ] .

Third example:

ont:q  a  owl:ObjectProperty ;
       rdfs:range  xsd:float .
ont:a  a  ont:A ;
       ont:p  [] .
permanent link

answered 16 Mar '12, 04:05

Antoine%20Zimmermann's gravatar image

Antoine Zimm... ♦
accept rate: 34%

@Antoine, the question mentions the OWLAPI several times. Did you check your examples with the OWLAPI?

(16 Mar '12, 08:09) Michael Schn... ♦ Michael%20Schneider's gravatar image

Michael, no I didn't, you can downvote my answer for that if you want ;)

(16 Mar '12, 09:16) Antoine Zimm... ♦ Antoine%20Zimmermann's gravatar image

Why should I? The answer is ok, it just should be clarified to what it refers to (namely to the general question about anonymous data values, and it also points out problems in the original question), and to what not (namely to how to deal with them in the OWLAPI and in OWL DL).

(16 Mar '12, 11:11) Michael Schn... ♦ Michael%20Schneider's gravatar image

Antoine, thanks for your answer (+1). Between your response and Michael's, I've got my answers - but I really was interested in why OWL-API didn't seem to deal with this in the manner I otherwise (incorrectly) expected.

(17 Mar '12, 02:35) sharky sharky's gravatar image
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 15 Mar '12, 23:33

question was seen: 2,552 times

last updated: 17 Mar '12, 02:47