Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cubicweb
OWL2YAMS
Commits
ef9c11eca047
Commit
ef9c11ec
authored
Oct 26, 2021
by
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
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
owl2yams/__init__.py
View file @
ef9c11ec
...
...
@@ -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
(
...
...
test/data/test_multi_
attribute
.owl
→
test/data/test_multi_
relation
.owl
View file @
ef9c11ec
...
...
@@ -2,5 +2,5 @@
@prefix loutre2: <http://loutre2.fr/>.
@prefix owl: <http://www.w3.org/2002/07/owl#>.
loutre:toto a owl:
Datatype
Property.
loutre2:toto a owl:
Datatype
Property.
loutre:toto a owl:
Object
Property.
loutre2:toto a owl:
Object
Property.
test/test_owl2yams.py
View file @
ef9c11ec
...
...
@@ -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
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment