Can FOAF and RDF classes/properties used in owlready2 program?

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

Can FOAF and RDF classes/properties used in owlready2 program?

laeeq
Hello,
I am a newbie to semantic web and owlready2, so this might be a dumb question.
I am trying to use properties and classes from RDF and FOAF namespaces.

I am basiclly trying to translate following rdflib program to one using owlready2

=======================================
rom rdflib import URIRef, Graph
from rdflib.namespace import RDF, FOAF

john = URIRef("John")
g = Graph()
g.add((john, RDF.type, FOAF.Person))
print(g.serialize(format='xml').decode('u8'))


''' output ---------------
<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
>
  <rdf:Description rdf:about="John">
    <rdf:type rdf:resource="http://xmlns.com/foaf/0.1/Person"/>
  </rdf:Description>
</rdf:RDF>
'''
=======================================

I am unable to locate some examples how to do this using owlready2.
I know how to create my own classes/properties and use them in owlready2 programs.
But I want to use existing vocabularies like FOAF, RDF etc.
Any help would be greatly appreciated.
Reply | Threaded
Open this post in threaded view
|

Re: Can FOAF and RDF classes/properties used in owlready2 program?

Jiba
Administrator
Hi,

Owlready is designed for OWL, so you need OWL properties (i.e. ObjectProperty, DataProperty or AnnotationProperty), not untyped RDF properties (i.e. Property).

I've just tested with FOAF, and it appears that FOAF properties are proper OWL properties. So it is Ok for FOAF. For other RDF resources, it will depend how the properties are declared.

Jiba