Skip to content

Specifications

chefabien edited this page Feb 17, 2016 · 5 revisions

Objects handling

Transparent access to triple store

Objects are created, modified with no explicit link to the underlying triple store. An AutoRDF object can be created like any other C++ object, and will gain persistence in the triple store when properties are be added to it. AutoRDF objects are implicitly shared when copied. A clone() method is provided to provide a way to explicitly copy an object in the triple store.

Support for anonymous resources

Per default anonymous resourced are created for C++ objects. If a constructor which take as first parameter an IRI can be used to create named resources.

Data types handling

rdf:type is written for newly created objects, and is used when reading back objects to check that C++ type is compatible with underlying RDF ressource.

#OWL and RDFS coverage

Code generation AutoRDF supports all of RDFS, and the following subset of OWL:

##owl:Class

Each class defines a C++ interface class, and a C++ implementation class prefixed with "I". It allows easier support for OWL multiple inheritance, which is known to have shortcomings in C++.

Properties

Each property generates C++ getters and setters. Per default properties are attached to the builtin owl::Thing class. Data properties use as data container a generic ProvertyValue class that inherits std::string, or directly the builtin C++ types when data type information is available in the ontology (see below) Object properties use as container a owl::Thing Object, unless a more precise resource restriction has been set in the ontology (see below)

owl:subClassOf

Inheritance is supported, as well as multiple inheritance. For each inherited class, the C++ object inherits the C++ interface class of all its ancestors (including indirect ancestors)

owl:Restriction

owl Restrictions are used in two ways:

  • Provide more precise cardinality support. We adjust the generated setters/getters with the ontology item cardinality.
  • Provide more accurate xml to C++ data type convertion

The folowing items are unsed in conjunction with owl:Restriction:

  • owl:cardinality, owl:minCardinality, owl:maxCardinality
  • owl:qualifiedCardinality, owl:minQualifiedCardinality, owl:maxQualifiedCardinality
  • owl:onDataRange
  • owl:onClass

owl:FunctionalProperty is equivalent to owl:minCardinality=0 and owl:maxCardinality=1

owl:oneOf

owl:oneOf is used to provided convertion from/to C++ enum type.

rdfs:domain

When a domain is specified to a property, the appropriate getter/setter are generated only for the appropriate C++ class. owl:unionOf can be used so that getters/setters are generated for more than one class.

rdfs:range

Is used to specify a default data type for a property. The getters/setters will use the corresponding C++ object or C++ data type.

##owl:hasKey

For each key we generate a static method for the class that makes it easy to load item from the triple store

Documentation generation

AutoRDF extracts the following annotations and converts them to doxygen format:

  • rdfs:comment
  • rdfs:label
  • rdfs:seeAlso
  • rdfs:isDefinedBy

An ontology that contains unsupported item can be handled by AutoRDF, at the cost of some more work left to the end user of the API (Code generation will be less precise than expected by what is found in the ontology)