RDF: Extract value from type

I have previously asked this question here, but I was asked to post the question on this forum.

I have an .owl file which has an entitiy something like this:

<owl:NamedIndividual rdf:about="http://example.org/kb/object_test.owl#obj_1234_pose">
    <rdf:type rdf:resource="http://example.org/kb/example.owl#Transform"/>
    <example:quaternion rdf:datatype="http://example.org/kb/example.owl#vec4">0.0 0.0 1.0 0.0</example:quaternion>
    <example:translation rdf:datatype="http://www.w3.org/2001/XMLSchema#vec3">0.0 0.5 0.2</example:translation>
</owl:NamedIndividual>

When I do a prolog query (triple is part of the framework’s query language):

triple('http://example.org/kb/object_test.owl#obj_1234_pose', 'http://example.org/kb/example.owl#translation', A).

I get the response:

type('http://www.w3.org/2001/XMLSchema#vec3','0.0 0.5 0.2').

Firstly, I do not get type in the response when rdf:datatype is a string. In case of a &xsd;string, I get the result as (for example): 0.0 0.5 0.2 Why is that so?

Secondly, is there any way to extract the value from the type? Or do I need to treat it a string manipulation?

1 Like

AFAIK (its been a while since I was actively involved in RDF), RDF only defines that the value space must be implemented for a limited set of XML Schema types. I think the various numeric types, boolean and the various date/time formats.

There is some scattered support for extending the value space, partly in the triple parsers and partly in the old and new rdf API. If you already have your own stuff on top I’d extend that.

1 Like