Dataproperty cardinality setting problem

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Dataproperty cardinality setting problem

synsem950
I am trying to restrict a dataproperty to the min/max/exactly etc but it does not seem to
be reflected in the resulting owl file. What could be the problem?

onto = get_ontology("http://navy.mil/Proto")
with onto:
    shipProperties = types.new_class("ShipProperties", (DataProperty,))
    navyProperties = types.new_class("NavyProperties", (shipProperties,))
    fregaPropertiesName = types.new_class("FregatPropertiesName", (navyProperties,))
    fregaPropertiesName.range.append(str)
    fregaPropertiesName.min(0,None)
    fregaPropertiesName.max(2,None)
   
default_world.save()
onto.save(file="./navy.owl",format="rdfxml")
============navy.owl====================
   1 <?xml version="1.0"?>
      2 <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
      3          xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
      4          xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
      5          xmlns:owl="http://www.w3.org/2002/07/owl#"
      6          xml:base="http://navy.mil/Proto"
      7          xmlns="http://navy.mil/Proto#">
      8
      9 <owl:Ontology rdf:about="http://navy.mil/Proto"/>
     10
     11 <owl:DatatypeProperty rdf:about="#ShipProperties"/>
     12
     13 <owl:DatatypeProperty rdf:about="#NavyProperties">
     14   <rdfs:subPropertyOf rdf:resource="#ShipProperties"/>
     15 </owl:DatatypeProperty>
     16
     17 <owl:DatatypeProperty rdf:about="#FregatPropertiesName">
     18   <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
     19   <rdfs:subPropertyOf rdf:resource="#NavyProperties"/>
     20 </owl:DatatypeProperty>
     21
     22
     23 </rdf:RDF>
Reply | Threaded
Open this post in threaded view
|

Re: Dataproperty cardinality setting problem

Jiba
Administrator
Hi,

DataProperty.min (or max) creates a restriction class, but it does not restrict the property itself. You need to apply the restriction to a class, by defining that class as a subclass of the restriction, for example:

C.is_a.append( fregaPropertiesName.max(2,None) )

where C is the domain class for the "fregaPropertiesName" property.

Jiba
Reply | Threaded
Open this post in threaded view
|

Re: Dataproperty cardinality setting problem

synsem950
Hello Jiba,

Thanks for the hint. Makes sense now when I see it that it operates on the domain.
The restriction is collected on the domain in the owl file as well.
Best r,
synsem