Hi Charbel,

Why don’t you just build up the graph by adding the triples you want like this:

g = Graph()
g.add((S1, P1, O1))
g.add((S2, P2, O2))
...

That gives you fine-grained control as you can add anything that RDF supports 
directly.

Nick 

— 
Dr Nicholas Car
Data Systems Architect
SURROUND Australia
0477 560 177
[email protected]

> On 21 Nov 2019, at 10:44 am, 'Charbel Kaed' via rdflib-dev 
> <[email protected]> wrote:
> 
> 
> Hello, 
> 
> I am trying to use rdf lib to create the following: (a protege screenshot in 
> the attachment)
> 
>   <Class rdf:about="http://www.abc#Building";>
>         <rdfs:subClassOf rdf:resource="http://www.abc#PhysicalLocation"/>
>         <rdfs:subClassOf>
>             <Restriction>
>                 <onProperty rdf:resource="http://www.abc#hasFloor"/>
>                 <allValuesFrom rdf:resource="http://abc#Floor"/>
>             </Restriction>
>         </rdfs:subClassOf>
>         <rdfs:comment>This is a type for BUILDING facilities 
> object</rdfs:comment>
>         <rdfs:label>Building</rdfs:label>
>     </Class>
>     
> 
> 
> But the only way I am able to create something are restrictions on properties 
> and not classes such as:
> <owl:ObjectProperty rdf:about="http://www.abc#hasFloor";>
>   <rdfs:domain rdf:resource="http://www.abc#Building"/>
>   <rdfs:subPropertyOf rdf:resource="http://www.abc#hasPhysicalLocation"/>
>   <rdfs:range>
>     <owl:Restriction rdf:nodeID="N73e2705103db4e57b37b969e7a1d4780">
>       <owl:onProperty rdf:resource="http://www.abc#hasFloor"/>
>       <owl:allValuesFrom rdf:resource="http://www.abc#Floor"/>
>     </owl:Restriction>
>   </rdfs:range>
> </owl:ObjectProperty>
> 
> Using the following code:
> 
> 
> restriction_floor = Restriction(
>     constants.NS.hasFloor,
>     allValuesFrom=constants.NS.Floor,
>     graph=graph)
> Property(
>     has_floor,
>     graph=graph,
>     domain=constants.NS.Building,
>     range=restriction_floor)
> 
> I would like to be able to create the restriction at the subClassOf level, 
> how is it possible to do this?
> 
> Thank you
> Best
> 
> Charbel
> -- 
> http://github.com/RDFLib
> --- 
> You received this message because you are subscribed to the Google Groups 
> "rdflib-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/rdflib-dev/b3c19cbc-10db-4910-8d55-e84cce9ceb57%40googlegroups.com.
> <Screenshot from 2019-11-20 18-38-21.png>

-- 
http://github.com/RDFLib
--- 
You received this message because you are subscribed to the Google Groups 
"rdflib-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rdflib-dev/5FCC7AE1-9535-4984-B420-717A6F6B7E75%40surroundaustralia.com.

Reply via email to