第一个本体论如下:
问题本体成员(类):
<http://www.issueonto.com/ontologies/issues#issues>
<http://www.issueonto.com/ontologies/issues#products>
谓词/属性:
<http://www.issueonto.com/ontologies/issues#hasIssues>
这个本体的三重存储(原始数据),我在这里用Turtle格式显示:
@prefix : <http://www.issueonto.com/ontologies/issues#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@base <http://www.issueonto.com/ontologies/issues> .
:Fido rdf:type :products ,
owl:NamedIndividual ;
:productName "FidoProdCEO_12"^^xsd:string ;
:hasIssues :issue_1239 .
### http://www.issueonto.com/ontologies/issues#issue_1239
:issue_1239 rdf:type :issues ,
owl:NamedIndividual ;
:issueName "FeatureIssue"^^xsd:string .
第二本体论如下:
项目本体成员(类):
<http://www.projectexample.com/ontology/project#GroupProject>
<http://www.projectexample.com/ontology/project#Project>
<http://www.projectexample.com/ontology/project#ProjectVersion>
谓词/属性:
<http://www.projectexample.com/ontology/project#belongsTo>
<http://www.projectexample.com/ontology/project#dependsOn>
本体(原始数据)的三重存储,我在这里用Turtle格式显示:
@prefix : <http://www.projectexample.com/ontology/project#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@base <http://www.projectexample.com/ontology/project> .
### http://www.projectexample.com/ontology/project#Apple
:Apple rdf:type :ProjectVersion ,
owl:NamedIndividual ;
:hasProjectName "AppleTowandOne"^^xsd:string ;
:belongsTo :RedBlueCompany .
### http://www.projectexample.com/ontology/project#Fido
:Fido rdf:type :ProjectVersion ,
owl:NamedIndividual ;
:hasProjectName "FidoProdCEO"^^xsd:string ;
:dependsOn :Apple .
### http://www.projectexample.com/ontology/project#RedBlueCompany
:RedBlueCompany rdf:type :GroupProject ,
owl:NamedIndividual ;
:groupName "RedGroupCompant lmt"^^xsd:string .
问题
1-我想说,项目:来自本体项目的项目转换与问题相同:来自本体问题的产品,这是可能的以及如何?
2-如果问题(1)是肯定的,我如何从共享概念中推断出相似的个体,即,如果我们说项目版本与产品相同,则并不意味着所有个体都相似,在本例中,我想自动推断个别问题:Fido类型的问题:产品与个别项目相同:Fido类型的项目:projectversion。根据推断的事实,我会自动推断该项目:Fido问题:hasissue问题:issues_1239。最后,我想运行SPARQL查询如下:
SELECT ?product ?issue FROM <namegraph>
WHERE{
?product issues:hasIssues ?issue.
}
我应该得到的结果如下:
?product ?issue
--------------------------------------------------------------------------
<http://www.projectexample.com/ontology/project#Fido> <http://www.issueonto.com/ontologies/issues#issue_1239>
<http://www.issueonto.com/ontologies/issues#Fido> <http://www.issueonto.com/ontologies/issues#issue_1239>
答案 0 :(得分:2)
我想说,项目:来自本体项目的projectversion相同 作为问题:来自本体问题的产品,这是可能的以及如何?
你需要的只是三重
project:projectversion owl:equivalentClass issues:product
我不知道你是如何结合这些本体的;您是否只是将数据从两者加载到三重存储中,或创建第三个本体,导入两者并将其(以及其导入)加载到三重存储中,但在某处您需要这个公理。对于&#34;合并&#34;像这样的本体论,我通常会创建第三个本体论来导入两个(但保持不变)并将公理添加到第三个本体论。
2-如果问题(1)是肯定的,我怎么能推断出相似的个体 从共享的概念,即,如果我们说projectversion是相同的 产品并不意味着所有的个体都是相似的 例如,我想自动推断个人 问题:Fido类型的问题:产品与个人相同 prject:Fido类型的项目:projectversion。从推断的事实来看,我 会自动推断该项目:Fido问题:hasissue 问题:issues_1239
您仍然告诉我们您将使用什么标准来决定问题:Fido和项目:Fido是同一个人。他们唯一明显的相似之处是字符串&#34; FidoProdCEO_12&#34;和&#34; FidoProdCEO&#34;。那是该决定应该基于什么?如果是这样,那么您可以执行以下操作。为方便起见,我创建了最小数据量:
@prefix o1: <urn:ex:ont1#> .
@prefix o2: <urn:ex:ont2#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
o1:A a o1:Product ;
o1:productName "ProductA_1234" ;
o1:hasIssue o1:issue42 .
o2:B a o2:ProjectVersion ;
o2:projectName "ProductA" .
o1:Product owl:equivalentClass o2:ProjectVersion .
prefix o1: <urn:ex:ont1#>
prefix o2: <urn:ex:ont2#>
prefix owl: <http://www.w3.org/2002/07/owl#>
select ?product ?issue where {
#-- A *product* is something that's an instance of
#-- o1:Product or another class that's equivalent
#-- to it.
?product a/(owl:equivalentClass|^owl:equivalentClass)* o1:Product
#-- The issues of a product are any of its
#-- o1:hasIssue values, or the o1:hasIssue
#-- value of any product that has a name
#-- beginning with its o2:projectName.
{ ?product o1:hasIssue ?issue }
union
{ ?product o2:projectName ?projectName .
?_product o1:productName ?productName ;
o1:hasIssue ?issue .
filter strstarts(?productName,?projectName)
}
}
------------------------
| product | issue |
========================
| o2:B | o1:issue42 |
| o1:A | o1:issue42 |
------------------------
当然,您最终还是必须检查projectName和productName值这一事实意味着等效的类公理实际上并没有为您提供这么多(至少就此查询而言)。也就是说,仅仅询问产品(以及具有匹配名称的项目)及其问题就足够了。&#34;也就是说,您从此查询获得相同的结果,这只是第一个查询的第二部分:
prefix o1: <urn:ex:ont1#>
prefix o2: <urn:ex:ont2#>
prefix owl: <http://www.w3.org/2002/07/owl#>
select ?product ?issue where {
{ ?product o1:hasIssue ?issue }
union
{ ?product o2:projectName ?projectName .
?_product o1:productName ?productName ;
o1:hasIssue ?issue .
filter strstarts(?productName,?projectName)
}
}
答案 1 :(得分:0)
这里的解决方案是owl:equivalentClass关系。要完成这项工作,您必须执行以下任务:
命令(通过Conductor UI的SQL CommandLine发出),用于将命名图与推理规则相关联: RDFS_RULE_SET(&#39; {rule-name}&#39;,&#39; {named-graph-uri-or-rdf-document-url}&#39;);
链接: