RDFLib / rdflib

RDFLib is a Python library for working with RDF, a simple yet powerful language for representing information.
https://rdflib.readthedocs.org
BSD 3-Clause "New" or "Revised" License
2.15k stars 555 forks source link

owl:qualifiedCardinality support lacked #2830

Open lithedress opened 2 months ago

lithedress commented 2 months ago

According to OWL2 Primer, Functional-Style Syntax

 ClassAssertion( 
   ObjectExactCardinality( 3 :hasChild :Parent ) 
   :John
 ) 

is valid, and is equal to Turtle Syntax

 :John  rdf:type  [
   rdf:type                  owl:Restriction ;
   owl:qualifiedCardinality  "3"^^xsd:nonNegativeInteger ;
   owl:onProperty            :hasChild ;
   owl:onClass               :Parent
 ] .

However, ns.John.type = rdflib.extras.infixowl.Restriction(ns.hasChild, graph=g, cardinality=Literal(3), someValuesFrom=Class(ns.Parent, graph=g)) will only generate Turtle Syntax

 ns:John  rdf:type  [
   rdf:type                  owl:Restriction ;
   owl:cardinality  "3"^^xsd:nonNegativeInteger ;
   owl:onProperty            ns:hasChild ;
 ] .

without owl:onClass field.

ashleysommer commented 1 month ago

@nicholascar Are you familiar with the infixowl code?