RDF (rdfs) syntax

Posted by casserole on
URL: http://owlready.306.s1.nabble.com/RDF-rdfs-syntax-tp2389.html

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?