Commit ef9c11ec authored by Fabien Amarger's avatar Fabien Amarger
Browse files

feat(owl2yams): Raise ValueError if relation already defined

parent 3eeda7b1a671
Pipeline #90264 passed with stages
in 3 minutes and 3 seconds
......@@ -133,6 +133,8 @@
if object_property_uri_fragment is None:
print(f"Warning: object property {object_property_uri} could not be parsed")
continue
if object_property_uri_fragment in schema:
raise ValueError(f"Error: relation {object_property_uri} already defined")
schema.add_relation_type(RelationType(object_property_uri_fragment))
all_types = list(ETYPE_URI.keys())
domain_fragments = yams_domain_from_urirefs(
......
......@@ -2,5 +2,5 @@
@prefix loutre2: <http://loutre2.fr/>.
@prefix owl: <http://www.w3.org/2002/07/owl#>.
loutre:toto a owl:DatatypeProperty.
loutre2:toto a owl:DatatypeProperty.
loutre:toto a owl:ObjectProperty.
loutre2:toto a owl:ObjectProperty.
......@@ -45,6 +45,10 @@
with self.assertRaises(ValueError):
self._load_owl_and_yams("test_multi_attribute.owl")
def test_raise_multi_relation(self):
with self.assertRaises(ValueError):
self._load_owl_and_yams("test_multi_relation.owl")
if __name__ == "__main__":
unittest.main()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment