0

I'm looking for a way to express the following statement using jena java library:

final ObjectProperty label = m.createObjectProperty(RDFS + "label");
label.addDomain(sensorClass);
label.addRange(??????);

Usually in addRange I would insert a class, but how can I do if the range is rdfs:Literal or xsd:dateTime or also xsd:double which are no classes?

I tried to create a generic resource using createResource() but then, exporting the resulting owl file in Protege it raises come errors due to the fact that the resource is unknown.

For now I fixed manually creating classes Literal etc in this way:

final OntClass literalClass = m.createClass(RDFS +"Literal");
final OntClass doubleClass = m.createClass(XSD +"double");
final OntClass dateTimeClass = m.createClass(XSD +"dateTime");

setting the created class as range. Anyway I suppose this is not the right way to do it, since in this case exporting the owl in Protege I will have subclasses of owl:thing called rdfs:Literal xsd:DateTime etc...

Akinn
  • 1,896
  • 4
  • 23
  • 36
  • See https://stackoverflow.com/questions/14172610/how-to-define-my-own-ranges-for-owl-dataproperties for how this is done in RDF. – user205512 Dec 11 '17 at 11:06
  • Sorry, misread. `xsd:double` is fine as a range. Does [XSD.xdouble](https://jena.apache.org/documentation/javadoc/jena/index.html?org/apache/jena/datatypes/RDFDatatype.html) not work? (note the 'x' there, due to java syntax clash) – user205512 Dec 11 '17 at 11:14
  • Should you not be using DatatypeProperty insteed of ObjectProperty? – Henriette Harmse Dec 11 '17 at 11:42

0 Answers0