Hi,
when loading an ontology from file, only FunctionalProperty and InverseFunctionalProperties are considered. The remaining characteristics are ignored: Here is the test ontology: <?xml version="1.0"?> <rdf:RDF xmlns="http://www.semanticweb.org/ontologies/2023/6/untitled-ontology-16#" xml:base="http://www.semanticweb.org/ontologies/2023/6/untitled-ontology-16" xmlns:owl="http://www.w3.org/2002/07/owl#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:xsd="http://www.w3.org/2001/XMLSchema#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"> <owl:Ontology rdf:about="http://www.semanticweb.org/ontologies/2023/6/untitled-ontology-16"/> <owl:ObjectProperty rdf:about="http://www.semanticweb.org/ontologies/2023/6/untitled-ontology-16#is_all"> <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#FunctionalProperty"/> <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#InverseFunctionalProperty"/> <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#SymmetricProperty"/> <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#AsymmetricProperty"/> <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#TransitiveProperty"/> <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#ReflexiveProperty"/> <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#IrreflexiveProperty"/> </owl:ObjectProperty> <owl:ObjectProperty rdf:about="http://www.semanticweb.org/ontologies/2023/6/untitled-ontology-16#is_asymmetric"> <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#AsymmetricProperty"/> </owl:ObjectProperty> <owl:ObjectProperty rdf:about="http://www.semanticweb.org/ontologies/2023/6/untitled-ontology-16#is_functional"> <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#FunctionalProperty"/> </owl:ObjectProperty> <owl:ObjectProperty rdf:about="http://www.semanticweb.org/ontologies/2023/6/untitled-ontology-16#is_inverse_functional"> <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#InverseFunctionalProperty"/> </owl:ObjectProperty> <owl:ObjectProperty rdf:about="http://www.semanticweb.org/ontologies/2023/6/untitled-ontology-16#is_irreflexive"> <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#IrreflexiveProperty"/> </owl:ObjectProperty> <owl:ObjectProperty rdf:about="http://www.semanticweb.org/ontologies/2023/6/untitled-ontology-16#is_reflexive"> <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#ReflexiveProperty"/> </owl:ObjectProperty> <owl:ObjectProperty rdf:about="http://www.semanticweb.org/ontologies/2023/6/untitled-ontology-16#is_symmetric"> <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#SymmetricProperty"/> </owl:ObjectProperty> <owl:ObjectProperty rdf:about="http://www.semanticweb.org/ontologies/2023/6/untitled-ontology-16#is_transitive"> <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#TransitiveProperty"/> </owl:ObjectProperty> </rdf:RDF> This is the test code: from owlready2 import * def print_property_characteristics(): onto = get_ontology("file://test2.owl").load(only_local=True) for prop in onto.properties(): print(prop.name, prop.is_a) print_property_characteristics() And this is the produced output: is_all [owl.ObjectProperty, owl.FunctionalProperty, owl.InverseFunctionalProperty, owl.ObjectProperty, owl.ObjectProperty, owl.ObjectProperty, owl.ObjectProperty, owl.ObjectProperty] is_asymmetric [owl.ObjectProperty, owl.ObjectProperty] is_functional [owl.ObjectProperty, owl.FunctionalProperty] is_inverse_functional [owl.ObjectProperty, owl.InverseFunctionalProperty] is_irreflexive [owl.ObjectProperty, owl.ObjectProperty] is_reflexive [owl.ObjectProperty, owl.ObjectProperty] is_symmetric [owl.ObjectProperty, owl.ObjectProperty] is_transitive [owl.ObjectProperty, owl.ObjectProperty] |
This post was updated on .
I think it is only this line in namespace.py (639):
elif 105 <= obj <= 109: main_type = ObjectPropertyClass; types.append(ObjectProperty) # TransitiveProperty, SymmetricProperty, AsymmetricProperty, ReflexiveProperty, IrreflexiveProperty Can you fix this please with the next version? Fix: elif 105 <= obj <= 109: main_type = ObjectPropertyClass if obj == 105: types.append(owlready2.prop.TransitiveProperty) elif obj == 106: types.append(owlready2.prop.SymmetricProperty) elif obj == 107: types.append(owlready2.prop.AsymmetricProperty) elif obj == 108: types.append(owlready2.prop.ReflexiveProperty) elif obj == 109: types.append(owlready2.prop.IrreflexiveProperty) |
Free forum by Nabble | Edit this page |