graphdb推理规则 - 对变量的多重约束

时间:2017-06-15 11:26:38

标签: inference graphdb

是否可以拥有一个inf。规则对变量有多个约束。例如,是否可以扩展以下规则

  a b c [Constraint b != <rdf:type>]
  b <rdfs:domain> d
------------------------------------
  a <rdf:type> d
像这样(试过但规则没有激活)

  a b c [Constraint b != <rdf:type>,  b != <rdfs:label>]
  b <rdfs:domain> d
------------------------------------
  a <rdf:type> d

由于

1 个答案:

答案 0 :(得分:2)

根据最新的GraphDB documentation,这是一种有效的规则语法。两个约束都使用AND执行,因此该规则仅适用于rdf:typerdfs:label值。以下是完整的示例:

Prefices
{
    rdf : http://www.w3.org/1999/02/22-rdf-syntax-ns#
    rdfs : http://www.w3.org/2000/01/rdf-schema#
}

Axioms
{
}

Rules
{
    Id: test

    a b c [Constraint b != <rdf:type>,  b != <rdfs:label>]
    b <rdfs:domain> d
    ------------------------------------
    a <rdf:type> d

}

插入示例文件后,您将只获得<urn:a1>的隐式结果:

<urn:a1> <urn:b1> <urn:c1> .
<urn:b1> <http://www.w3.org/2000/01/rdf-schema#domain> <urn:d1> .
<urn:a2> <http://www.w3.org/2000/01/rdf-schema#label> <urn:c2> .
<urn:b2> <http://www.w3.org/2000/01/rdf-schema#domain> <urn:d2> .