Adding custom datatype

Posted by dguidi on
URL: http://owlready.306.s1.nabble.com/Adding-custom-datatype-tp2494.html

Hi,
I would like to add a custom datatype for holding JSON objects.

Following the docs, I've done something like:

declare_datatype(jsonObject, "http://myorg/myschema#jsonObject", parser, unparser)

and I then added a DataProperty "has_json" that binds a Class to a jsonObject datatype.

However, if I save the ontology and I open it with Protege, strange things happens - the "has_json" property is defined both as ObjectProperty and DataProperty.

If instead I create the datatype inside Protege, then the resulting ontology will have an extra definition, which is not present in the ontology saved by owlready2:

<rdfs:Datatype rdf:about="http://myorg/myschema#jsonObject">

I noticed that if I add this definition to the ontology generated by owlready2, then the it looks fine when I open it in Protege ("has_json" is defined only as DataPrtoperty).

Is there a way for me to manually add a triple like that in owlready2 before saving the ontology?

Many thanks.