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
3eeda7b1a671
Commit
3eeda7b1
authored
Oct 26, 2021
by
Fabien Amarger
Browse files
feat(owl2yams): Raise ValueError if attribute already defined
parent
0974d609a9e9
Changes
3
Hide whitespace changes
Inline
Side-by-side
owl2yams/__init__.py
View file @
3eeda7b1
...
...
@@ -67,7 +67,7 @@
if
class_fragment
is
None
:
print
(
f
"Warning: class
{
class_uri
}
could not be parsed"
)
continue
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"
)
continue
if
datatype_property_uri_fragment
in
schema
:
raise
ValueError
(
f
"Error: attribute
{
datatype_property_uri
}
already defined"
)
schema
.
add_relation_type
(
RelationType
(
datatype_property_uri_fragment
))
# take first range, if no range use RDFS.Literal
_
,
_
,
literal_type
=
next
(
...
...
test/data/test_multi_attribute.owl
0 → 100644
View file @
3eeda7b1
@prefix loutre: <http://loutre.fr/>.
@prefix loutre2: <http://loutre2.fr/>.
@prefix owl: <http://www.w3.org/2002/07/owl#>.
loutre:toto a owl:DatatypeProperty.
loutre2:toto a owl:DatatypeProperty.
test/test_owl2yams.py
View file @
3eeda7b1
...
...
@@ -41,6 +41,10 @@
with
self
.
assertRaises
(
ValueError
):
self
.
_load_owl_and_yams
(
"test_multi_class.owl"
)
def
test_raise_multi_attribute
(
self
):
with
self
.
assertRaises
(
ValueError
):
self
.
_load_owl_and_yams
(
"test_multi_attribute.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