Hi,
Since the datatype for rdfs:Literal is not present in owlready2, I wanted to define it according to the Hex- example and then use it in a property restriction:
prop_restriction = prop.some(RDFSLiteral)
to create something like this:
<owl:Restriction>
<owl:onProperty rdf:resource="
http://someproperty"/> <owl:someValuesFrom rdf:resource="
http://www.w3.org/2000/01/rdf-schema#Literal"/></owl:Restriction>
This does not work with custom datatypes, neither with declare_datatype before this statement, nor with define_in_ontology.
The only solution I see at the moment is to add the IRI with _universal_abbrev_datatype in the base.py like 'locstring'. Any idea?
Erik
Edit: I found another workaround where the code does not need to be customized.
The solution is to declare the required Datatype class within the namespace and then pass it to the property restriction:
onto = get_ontology('
http://www.w3.org/2000/01/rdf-schema#')
with onto:
class Literal(DatatypeProperty):
pass
prop_restriction = prop.some(onto.Literal)