RDF (rdfs) syntax

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

RDF (rdfs) syntax

casserole
Hi everyone,

I need your help! I recently use owlready2 and don't know can I use rdf/xml syntax?

For example: I need to get all Classes and Properties from ontology

<?xml version="1.0" encoding="utf-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
         xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
         xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
         xmlns:owl="http://www.w3.org/2002/07/owl#"
         xmlns:xml="http://www.w3.org/XML/1998/namespace">

    <owl:Ontology rdf:about="http://test.org/"/>

    <rdfs:Class rdf:about="http://test.org/TestClass"/>

    <rdfs:Class rdf:about="http://test.org/TestClass2"/>

    <rdf:Property rdf:about="http://test.org/someProperty"/>

    <rdf:Property rdf:about="http://test.org/name">
        <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
        <rdfs:comment xml:lang="en-us">Name of the person.</rdfs:comment>
        <rdfs:label xml:lang="en-us">Name</rdfs:label>
    </rdf:Property>


</rdf:RDF>

onto = get_ontology("filename.owl").load()
list(onto.classes())  # return []
onto.TestClass  # return filename.TestClass


if I use without <owl:Ontology rdf:about="http://test.org/"/>

list(onto.classes())  # return []
onto.TestClass  # None

How can I get rdfs:Classes and rdf:Properties list with owl tag and without?
Reply | Threaded
Open this post in threaded view
|

Re: RDF (rdfs) syntax

Jiba
Administrator
Hi,

Owlready is devoted to OWL ontology. Consequently, RDFS is currently not supported.

However, you may translate your RDFS file into OWL by using owl:Class instead of rdfs:Class, and replacing rdf:Property with OWL properties (object, data or annotation properties).

Jiba
Reply | Threaded
Open this post in threaded view
|

Re: RDF (rdfs) syntax

casserole
Thanks for the answer, Jiba!