First of all, a fantastic tool!
I played with it today making ontology. I noticed issues in generated ontology if I use "/" instead of "#" for entities IRIs. Code for IRIs which use "/": onto = get_ontology("http://knowledge.graph/wind/") define_datatype_in_ontology(VestasNaming, "http://knowledge.graph/wind/VestasNaming", onto) class DO(Thing): namespace = onto class notation(Thing >> VestasNaming): namespace = onto HorWdSpd = DO("HorWdSpd", namespace = onto, label="Horizontal Wind Speed", comment="IEC data object instance for Horizontal Wind Speed") HorWdSpd.notation.append(VestasNaming("WindSpeed")) onto.save("./ontology.xml") which results in <?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:xsd="http://www.w3.org/2001/XMLSchema#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:owl="http://www.w3.org/2002/07/owl#" xmlns:wind="http://knowledge.graph/wind/" xmlns="http://knowledge.graph/wind/"> <owl:Ontology rdf:about="http://knowledge.graph/wind"/> <owl:DatatypeProperty rdf:about="notation"> <rdfs:domain rdf:resource="http://www.w3.org/2002/07/owl#Thing"/> <rdfs:range rdf:resource="VestasNaming"/> </owl:DatatypeProperty> <owl:Class rdf:about="DO"> <rdfs:subClassOf rdf:resource="http://www.w3.org/2002/07/owl#Thing"/> </owl:Class> <rdfs:Datatype rdf:about="VestasNaming"/> <wind:DO rdf:about="HorWdSpd"> <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#NamedIndividual"/> <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Horizontal Wind Speed</rdfs:label> <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">IEC data object instance for Horizontal Wind Speed</rdfs:comment> <wind:notation rdf:datatype="VestasNaming">WindSpeed</wind:notation> </wind:DO> </rdf:RDF> which when loaded to Protege results in two DO classes instead of one. One of those DO classes has correct IRI but no instances/individuals related to it, the second one with an IRI equal to the filepath to onotology (i.e., wrong IRI) has a HorWdSpd individual related to it. However, if I use "#" instead for IRI entities (e.g., base_iri#ClassName): onto = get_ontology("http://knowledge.graph/wind") define_datatype_in_ontology(VestasNaming, "http://knowledge.graph/wind#VestasNaming", onto) class DO(Thing): namespace = onto class notation(Thing >> VestasNaming): namespace = onto HorWdSpd = DO("HorWdSpd", namespace = onto, label="Horizontal Wind Speed", comment="IEC data object instance for Horizontal Wind Speed") HorWdSpd.notation.append(VestasNaming("WindSpeed")) onto.save("./ontology.xml") everything works as expected and resulting XML is correct: <?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:xsd="http://www.w3.org/2001/XMLSchema#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:owl="http://www.w3.org/2002/07/owl#" xml:base="http://knowledge.graph/wind" xmlns="http://knowledge.graph/wind#"> <owl:Ontology rdf:about="http://knowledge.graph/wind"/> <owl:DatatypeProperty rdf:about="#notation"> <rdfs:domain rdf:resource="http://www.w3.org/2002/07/owl#Thing"/> <rdfs:range rdf:resource="#VestasNaming"/> </owl:DatatypeProperty> <owl:Class rdf:about="#DO"> <rdfs:subClassOf rdf:resource="http://www.w3.org/2002/07/owl#Thing"/> </owl:Class> <rdfs:Datatype rdf:about="#VestasNaming"/> <DO rdf:about="#HorWdSpd"> <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#NamedIndividual"/> <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Horizontal Wind Speed</rdfs:label> <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">IEC data object instance for Horizontal Wind Speed</rdfs:comment> <notation rdf:datatype="#VestasNaming">WindSpeed</notation> </DO> </rdf:RDF> which when loaded in Protege result in a single class DO, and HorWdSpd instance of it. Is there anything I should do to make sure that entity IRIs which use "/" work properly when ontology is exported to XML? |
Free forum by Nabble | Edit this page |