Commit 3eeda7b1 authored by Fabien Amarger's avatar Fabien Amarger
Browse files

feat(owl2yams): Raise ValueError if attribute already defined

parent 0974d609a9e9
......@@ -67,7 +67,7 @@
if class_fragment is None:
print(f"Warning: class {class_uri} could not be parsed")
if class_fragment in ETYPE_URI:
if class_fragment in schema:
raise ValueError(
f"Error: class {class_uri} and {ETYPE_URI[class_fragment]} use the same fragment"
......@@ -95,6 +95,10 @@
if datatype_property_uri_fragment is None:
print(f"Warning: data property {datatype_property_uri} could not be parsed")
if datatype_property_uri_fragment in schema:
raise ValueError(
f"Error: attribute {datatype_property_uri} already defined"
# take first range, if no range use RDFS.Literal
_, _, literal_type = next(
@prefix loutre: <>.
@prefix loutre2: <>.
@prefix owl: <>.
loutre:toto a owl:DatatypeProperty.
loutre2:toto a owl:DatatypeProperty.
......@@ -41,6 +41,10 @@
with self.assertRaises(ValueError):
def test_raise_multi_attribute(self):
with self.assertRaises(ValueError):
if __name__ == "__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