我有以下本体:
<!-- http://purl.org/ontology/bibo/Article -->
<owl:Class rdf:about="Article">
<rdfs:label xml:lang="en">Article</rdfs:label>
<rdfs:subClassOf rdf:resource="Document"/>
<rdfs:isDefinedBy rdf:datatype="&xsd;anyURI"
>http://purl.org/ontology/bibo/</rdfs:isDefinedBy>
<ns:term_status>stable</ns:term_status>
<rdfs:comment xml:lang="en"
>A written composition in prose, usually nonfiction, on a specific topic, forming an independent part of a book or other publication, as a newspaper or magazine.</rdfs:comment>
</owl:Class>
<!-- http://purl.org/ontology/bibo/AudioDocument -->
<owl:Class rdf:about="AudioDocument">
<rdfs:label xml:lang="en">audio document</rdfs:label>
<rdfs:subClassOf rdf:resource="Document"/>
<rdfs:isDefinedBy rdf:datatype="&xsd;anyURI"
>http://purl.org/ontology/bibo/</rdfs:isDefinedBy>
<ns:term_status>stable</ns:term_status>
<rdfs:comment xml:lang="en"
>An audio document; aka record.</rdfs:comment>
</owl:Class>
<!-- http://purl.org/NET/c4dm/event.owl#place -->
<owl:ObjectProperty rdf:about="&event;place">
<skos:scopeNote xml:lang="en"
>Used to relate an event such as a conference to the geographical place where it happens, for example Paris.</skos:scopeNote>
</owl:ObjectProperty>
<!-- http://purl.org/dc/terms/date -->
<owl:DatatypeProperty rdf:about="&terms;date">
<skos:scopeNote xml:lang="en"
>Use to link a bibliographic item to the date of an event. Check dcterms:created and other for proper specializations for this property</skos:scopeNote>
</owl:DatatypeProperty>
我正在尝试从类、属性定义中提取标签、评论和关于。我正在使用 RDFlib 来解析文件。我想要输出:
(about) Article
(label) Article
(comment) written composition in prose, usually nonfiction, on a specific topic, forming an independent part of a book or other
(about) AudioDocument
(label) Audio Document
(comment) An audio document; aka record.
(about) place
(scopeNote) Used to relate an event such as a conference to the geographical place where it happens, for example Paris.
(about) date
(scopeNote) use to link a bibliographic item to the date of an event. check dcterms:created and other for proper specializations
我的初始代码:
for s, p, o in graph:
if type(s) == rdflib.term.URIRef:
print 'Subject = ',s
print ' '
print 'Property = ',p
print ' '
print 'Object = ',o
print ' '
我真的不知道怎么继续!有人可以帮助我吗?