Search code examples
inferencegraphdb

graphdb inference rules - multiple constraint on a variable


Is it possible to have a single inf. rule with more than one constraints on a variable. For example is it possible to extend the following rule

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

like that (tried but the rule is not activated)

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

Thanks


Solution

  • According to the latest GraphDB documentation this is a valid rule syntax. Both constraints are executed with AND, so the rule will not work for rdf:type and rdfs:label values only. Here is the full example:

    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
    
    }
    

    After inserting the sample file, you will get implicit result only for <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> .