如何通过获取所有 类 名称属性关系来创建域 ontology 词典并将其保存在列表中
How to create domain ontology lexicon by getting all the classes name attribute relations and save it in the lists
我是 ontology 和语义分析的新手。目前,我有一个来自 BBC 网站的 public ontology 来源。来源是“.ttl”格式。
我还打算使用 eclipse 在 Jena 中加载源代码。但是,当我看到代码时,我有点迷茫。
这里有一些例子:
<http://www.bbc.co.uk/ontologies/bbc/Mobile>
a <http://www.bbc.co.uk/ontologies/bbc/Platform> ;
<http://www.w3.org/2000/01/rdf-schema#comment>
"Represents the web documents designed for a smaller, mobile screen."@en-gb ;
<http://www.w3.org/2000/01/rdf-schema#isDefinedBy>
<http://www.bbc.co.uk/ontologies/bbc> ;
<http://www.w3.org/2000/01/rdf-schema#label>
"Mobile"@en-gb .
<http://www.bbc.co.uk/ontologies/bbc/primaryContent>
a <http://www.w3.org/2002/07/owl#ObjectProperty> ;
<http://www.w3.org/2000/01/rdf-schema#comment>
"Represents the fact that a web document has as primary content the creative work (e.g., a news story about Tom Daley is the primary content of a webpage)."@en-gb ;
<http://www.w3.org/2000/01/rdf-schema#domain>
<http://www.bbc.co.uk/ontologies/bbc/WebDocument> ;
<http://www.w3.org/2000/01/rdf-schema#isDefinedBy>
<http://www.bbc.co.uk/ontologies/bbc> ;
<http://www.w3.org/2000/01/rdf-schema#label>
"primaryContent"@en-gb ;
<http://www.w3.org/2000/01/rdf-schema#range>
<http://www.bbc.co.uk/ontologies/creativework/CreativeWork> ;
<http://www.w3.org/2002/07/owl#inverseOf>
<http://www.bbc.co.uk/ontologies/bbc/primaryContentOf> .
那么如何获取所有 类 名称属性关系并将其保存在列表中?
可以在 Python 中完成吗?因为我不确定 python 中的 rdflib 是否可以使用
for subj, pred, obj in g:
subname = subj.split("/")[-1]
这样可以得到题目的名字
我是 ontology 和语义分析的新手。目前,我有一个来自 BBC 网站的 public ontology 来源。来源是“.ttl”格式。 我还打算使用 eclipse 在 Jena 中加载源代码。但是,当我看到代码时,我有点迷茫。
这里有一些例子:
<http://www.bbc.co.uk/ontologies/bbc/Mobile>
a <http://www.bbc.co.uk/ontologies/bbc/Platform> ;
<http://www.w3.org/2000/01/rdf-schema#comment>
"Represents the web documents designed for a smaller, mobile screen."@en-gb ;
<http://www.w3.org/2000/01/rdf-schema#isDefinedBy>
<http://www.bbc.co.uk/ontologies/bbc> ;
<http://www.w3.org/2000/01/rdf-schema#label>
"Mobile"@en-gb .
<http://www.bbc.co.uk/ontologies/bbc/primaryContent>
a <http://www.w3.org/2002/07/owl#ObjectProperty> ;
<http://www.w3.org/2000/01/rdf-schema#comment>
"Represents the fact that a web document has as primary content the creative work (e.g., a news story about Tom Daley is the primary content of a webpage)."@en-gb ;
<http://www.w3.org/2000/01/rdf-schema#domain>
<http://www.bbc.co.uk/ontologies/bbc/WebDocument> ;
<http://www.w3.org/2000/01/rdf-schema#isDefinedBy>
<http://www.bbc.co.uk/ontologies/bbc> ;
<http://www.w3.org/2000/01/rdf-schema#label>
"primaryContent"@en-gb ;
<http://www.w3.org/2000/01/rdf-schema#range>
<http://www.bbc.co.uk/ontologies/creativework/CreativeWork> ;
<http://www.w3.org/2002/07/owl#inverseOf>
<http://www.bbc.co.uk/ontologies/bbc/primaryContentOf> .
那么如何获取所有 类 名称属性关系并将其保存在列表中? 可以在 Python 中完成吗?因为我不确定 python 中的 rdflib 是否可以使用
for subj, pred, obj in g:
subname = subj.split("/")[-1]
这样可以得到题目的名字