Logic 描述逻辑和本体:如何表示空白节点的角色域限制
请求协助,表示对空白节点的域限制。 图1:使用空白节点对多对多关系进行建模 业务规则:一次注册将一名学生映射到一个部分 我的尝试:Logic 描述逻辑和本体:如何表示空白节点的角色域限制,logic,semantic-web,owl,ontology,description-logic,Logic,Semantic Web,Owl,Ontology,Description Logic,请求协助,表示对空白节点的域限制。 图1:使用空白节点对多对多关系进行建模 业务规则:一次注册将一名学生映射到一个部分 我的尝试: ∃hasStudent.⊤ ≡ ∃hasSection.⊤ ≡ ∃grade_code.⊤ i.e. "the set of individuals that have some value for the role 'hasStudent' is the same set of individuals that have some value for the
∃hasStudent.⊤ ≡ ∃hasSection.⊤ ≡ ∃grade_code.⊤
i.e. "the set of individuals that have some value for the role 'hasStudent' is the same set of individuals that have some value for the role 'hasSection' ...e.t.c."
∃hasStudent.⊤ ≡ ∃hasSection.⊤ ≡ ∃grade_code.⊤ ≡ =1hasStudent.⊤ ≡ =1hasSection.⊤ ≡ =1grade_code.⊤
i.e. "the set of individuals that have values for the roles 'hasStudent', 'hasSection' and 'grade_code', have one and only one value for them."
我在这里假设等价,而不是包含,因为包含在两个方向上
进一步限制:
∃hasStudent.⊤ ≡ ∃hasSection.⊤ ≡ ∃grade_code.⊤
i.e. "the set of individuals that have some value for the role 'hasStudent' is the same set of individuals that have some value for the role 'hasSection' ...e.t.c."
∃hasStudent.⊤ ≡ ∃hasSection.⊤ ≡ ∃grade_code.⊤ ≡ =1hasStudent.⊤ ≡ =1hasSection.⊤ ≡ =1grade_code.⊤
i.e. "the set of individuals that have values for the roles 'hasStudent', 'hasSection' and 'grade_code', have one and only one value for them."
如能在图1中正确表示对象属性的域限制,请提供帮助或意见。
谢谢 如果我正确理解您的意图,您希望这些限制适用于这些属性的任何使用,而不是仅适用于特定类 在此假设下,您可以通过声明属性functional并将其域设置为
C
来实现这一点。在函数语法中:
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#>)
Ontology(
Declaration(Class(<urn:test:C>))
Declaration(ObjectProperty(<urn:test:hasSection>))
Declaration(ObjectProperty(<urn:test:hasStudent>))
Declaration(DataProperty(<urn:test:grade_code>))
FunctionalObjectProperty(<urn:test:hasSection>)
ObjectPropertyDomain(<urn:test:hasSection> <urn:test:C>)
FunctionalObjectProperty(<urn:test:hasStudent>)
ObjectPropertyDomain(<urn:test:hasStudent> <urn:test:C>)
FunctionalDataProperty(<urn:test:grade_code>)
DataPropertyDomain(<urn:test:grade_code> <urn:test:C>)
SubClassOf(<urn:test:C> ObjectIntersectionOf(ObjectSomeValuesFrom(<urn:test:hasSection> owl:Thing) ObjectSomeValuesFrom(<urn:test:hasStudent> owl:Thing) DataSomeValuesFrom(<urn:test:grade_code> rdfs:Literal)))
)
前缀(owl:=)
前缀(rdf:=)
前缀(xml:=)
前缀(xsd:=)
前缀(rdfs:=)
本体论(
声明(类())
声明(ObjectProperty())
声明(ObjectProperty())
声明(DataProperty())
FunctionalObjectProperty()
ObjectPropertyDomain()
FunctionalObjectProperty()
ObjectPropertyDomain()
FunctionalDataProperty()
DataPropertyDomain()
子类(ObjectIntersectionOf(ObjectSomeValuesFrom(owl:Thing)ObjectSomeValuesFrom(owl:Thing)DataSomeValuesFrom(rdfs:Literal)))
)
如果我正确理解您的意图,您希望这些限制适用于这些属性的任何使用,而不是仅适用于特定类
在此假设下,您可以通过声明属性functional并将其域设置为C
来实现这一点。在函数语法中:
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#>)
Ontology(
Declaration(Class(<urn:test:C>))
Declaration(ObjectProperty(<urn:test:hasSection>))
Declaration(ObjectProperty(<urn:test:hasStudent>))
Declaration(DataProperty(<urn:test:grade_code>))
FunctionalObjectProperty(<urn:test:hasSection>)
ObjectPropertyDomain(<urn:test:hasSection> <urn:test:C>)
FunctionalObjectProperty(<urn:test:hasStudent>)
ObjectPropertyDomain(<urn:test:hasStudent> <urn:test:C>)
FunctionalDataProperty(<urn:test:grade_code>)
DataPropertyDomain(<urn:test:grade_code> <urn:test:C>)
SubClassOf(<urn:test:C> ObjectIntersectionOf(ObjectSomeValuesFrom(<urn:test:hasSection> owl:Thing) ObjectSomeValuesFrom(<urn:test:hasStudent> owl:Thing) DataSomeValuesFrom(<urn:test:grade_code> rdfs:Literal)))
)
前缀(owl:=)
前缀(rdf:=)
前缀(xml:=)
前缀(xsd:=)
前缀(rdfs:=)
本体论(
声明(类())
声明(ObjectProperty())
声明(ObjectProperty())
声明(DataProperty())
FunctionalObjectProperty()
ObjectPropertyDomain()
FunctionalObjectProperty()
ObjectPropertyDomain()
FunctionalDataProperty()
DataPropertyDomain()
子类(ObjectIntersectionOf(ObjectSomeValuesFrom(owl:Thing)ObjectSomeValuesFrom(owl:Thing)DataSomeValuesFrom(rdfs:Literal)))
)
OWL的开放世界假设将阻止您找到“角色‘Hastudent’、‘hasSection’和‘grade_code’具有值的一组个人,他们只有一个值。”
但是,使用SPARQL,您可以创建一个ASK查询,该查询正好满足您的要求:
ASK {
SELECT (count(?student) AS ?stcount) (count(?section) AS ?secount) (count(?course) AS ?ccount)
WHERE {
?indiv :hasStudent ?student .
?indiv :hasSection ?section .
?indiv :grade_course ?course .
} GROUP BY ?student ?section ?course
HAVING (stcount = 1 && ?secount = 1 && ?ccount = 1)
}
语法上有点偏激,因为聚合需要由SELECT语句计算。如果“约束”(参见HAVING子句)均为true,否则ASK将返回true
作为将来的参考,W3C的工作旨在支持这些用OWL无法解决的约束冲突问题。OWL的开放世界假设将阻止您找到具有角色“hasStudent”、“HassSection”和“grade_code”值的个人集只有一个值 但是,使用SPARQL,您可以创建一个ASK查询,该查询正好满足您的要求:
ASK {
SELECT (count(?student) AS ?stcount) (count(?section) AS ?secount) (count(?course) AS ?ccount)
WHERE {
?indiv :hasStudent ?student .
?indiv :hasSection ?section .
?indiv :grade_course ?course .
} GROUP BY ?student ?section ?course
HAVING (stcount = 1 && ?secount = 1 && ?ccount = 1)
}
语法上有点偏激,因为聚合需要由SELECT语句计算。如果“约束”(参见HAVING子句)都为true,否则ASK将返回true
<3> W3C的工作是为了支持这些无法用OWL回答的约束违反问题。谢谢你的回复!所以我的目标是在图中描述本体,而不给空白节点一个类型。我想限制它的属性的域(你已经完成了)。不是通过给空白节点提供一个类型,而是通过描述节点来表达。谢谢你的回复!所以我的目标是在图中描述本体,而不给空白节点一个类型。我想限制它的属性的域(你已经完成了)。不是通过给空白节点提供一个类型并引用它,而是通过描述节点。我们得到了一些地方。谢谢。现在,引用空白节点实例不是一个目标;通过域(和范围)紧密地定义属性。限制在上面。这是我在描述逻辑中尝试做的…您的SPARQL查询是我想要在OWL R-Box中执行的…上面的DL尝试是否正确地表示了此限制?它的OWL相关性是否也有效?+1用于查询并提供引用。我们取得了一些进展。谢谢。现在,引用空白节点这里的目标不是实例;通过域(和范围)严格定义属性限制在上面。这是我在描述逻辑中尝试做的…您的SPARQL查询是我想要在OWL R-Box中执行的…上面的DL尝试是否正确地表示了此限制?它的OWL相关性是否也有效?+1用于查询并提供引用。