Skip to content

Commit

Permalink
core: owl: allow all facets for custom data properties
Browse files Browse the repository at this point in the history
Before this commit, attempting to build an OWL expression of the form:

DatatypeRestriction(my:dataType <facet> [<facet])

would result in an exception being thrown due to the fact that for
custom datatypes there is no known constraining facet applicable.
While it is arguable whether to allow restricting custom datatypes
with contraining facets since there is no known facet space defined
for the datatype, the thrown exception definetely represents a bug
due to the Facet enum not being able to deal with custom datatypes.

This commit fixes this behaviour, while taking a relaxed approach
on what facets can be applied to custom datatypes, essentially
allowing the use of all possible constraining facets since even if
this has no clear semantic meaning (hence no reasoning will be possible),
it is still syntactically correct.
If at a later time we decide that this kind of expression should be
forbidden by the syntactic check, it would be enough to simply return
an empty set of facets for custom datatypes.

See: #177
  • Loading branch information
mnamici committed Apr 21, 2022
1 parent adf3223 commit cda8f3b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions eddy/core/owl.py
Original file line number Diff line number Diff line change
Expand Up @@ -2177,7 +2177,7 @@ def forDatatype(cls, value):
:type value: IRI
:rtype: list
"""
allvalues = [x for x in cls]
allvalues = [x.value for x in cls]
numbers = [OWL2Facet.maxExclusive.value, OWL2Facet.maxInclusive.value, OWL2Facet.minExclusive.value, OWL2Facet.minInclusive.value]
strings = [OWL2Facet.langRange.value, OWL2Facet.length.value, OWL2Facet.maxLength.value, OWL2Facet.minLength.value, OWL2Facet.pattern.value]
binary = [OWL2Facet.length.value, OWL2Facet.maxLength.value, OWL2Facet.minLength.value]
Expand Down Expand Up @@ -2218,4 +2218,4 @@ def forDatatype(cls, value):
OWL2Datatype.unsignedLong.value: numbers,
OWL2Datatype.unsignedShort.value: numbers,
OWL2Datatype.XMLLiteral.value: []
}[value]
}.get(value, allvalues)

0 comments on commit cda8f3b

Please sign in to comment.