Question

In ROWLEX is it possible to remove "rdf:datatype" attribute of each property and/or use common RDF Schema instead?

Example:

<MyOntology:Channel>
   <MyOntology:title rdf:datatype="http://www.w3.org/2001/XMLSchema#string">My news</MyOntology:title>
   <MyOntology:description rdf:datatype="http://www.w3.org/2001/XMLSchema#string">My desc</MyOntology:description>
</MyOntology:Channel>
Was it helpful?

Solution

The question is quite unclear, so you get a generic answer :) Every OWL property must be either data type or an object type.

  • Object type properties connect two nodes of the graph, namely not only the subject but the object of the triple is an URI (or blank node), too.
  • Data type property: the object of the triple is a concrete value that can be string, integer, date time etc. These concrete values are called "literal"-s. The base type of literals is "Literal", from these are the concrete types (string, integer, datetime...) subclassed.

When you define your ontology, it is not demanded from you to restrict your data type properties to a particular literal type. You may keep it generic, accepting any kinds of literals. ROWLEX does support this. There is a generic RdfLiteral class and a hosts of specific literal classes like RdfLiteralString, RdfLiteralDateTime etc. Every specific literal class contains explicit and implicit cast implementations to convert .NET types to literals and back. Therefore in ROWLEX, you may write:

    RdfDocument rdfDoc = new RdfDocument();
    // Assuming that Person class and DateOfBirth data type property 
    // are autogenerated from your person-ontology, AND
    // your DateOfBirth data type property is restricted to DateTime
    Person p = new Person("joe", rdfDoc); 
    // Implicit casting from DateTime to RdfLiteralDateTime
    p.DateOfBirth = new Sytem.DateTime(1946, 12, 31); // Compiles OK
    p.DateOfBirth = 26; // Compiler error
    p.DateOfBirth = "Hello World"; // Compiler error

If your DateOfBirth data type property in your ontology is not restricted to DateTime then all the above lines compile without errors. However, my personal opinion is that if you can be more specific, be more specific, because you can prevent errors and miscommunication.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top