GraphDB Constraint Validation

Skip to end of metadata
Go to start of metadata
You are viewing an old version of this page. View the current version. Compare with Current  |   View Page History

GraphDB Enterprise supports consistency violation checks using standard OWL2RL semantics. It is possible to define rulesets that contain consistency rules.

Consistency checks

  • Materialisation and consistency mix: the rulesets support the definition of a mixture of materialization and consistency rules. This follows the existing naming syntax “id:” and “Consistency:”
  • Multiple named rulesets: GraphDB Enterprise supports multiple named rulesets.
  • No down time deployment: The deployment of new/updated rulesets can be done to a running instance.
  • Update transaction ruleset: Each update transaction can specify which named ruleset to apply. This is done by using “special” RDF statements within the update transaction.
  • Consistency violation exceptions: GraphDB Enterprise throws exceptions if a consistency rule is violated. The exception includes details as which rule has been violated and to which RDF statements.
  • Consistency Rollback: if a consistency rule is violated within an update transaction, the transaction will be rolled back and no statements will be committed.

GraphDB inference engine background

In order to instantiate an inferencer, first GraphDB requires the .pie file of each ruleset to be compiled. The process includes several steps:

  • Generating a java code out of the pie file contents using the built-in GraphDB rule compiler
  • Compiling the java code (it requires JDK instead of JRE, hence the java compiler will be available through standard java instrumentation infrastructure)
  • Instantiating the java code using a custom bytecode class loader.

At the moment such inferencer is instantiated when the repository is initialized. The process is slow and may take some time depending on the ruleset used and the rules included.

Operations on rulesets

All examples below assume the sys: namespace, defined as:

Operation Add a custom ruleset from .pie file
Predicate sys:addRuleset
Description Will add a custom ruleset from the specified .pie file. The ruleset will be named after the filename, without the .pie extension.
Example INSERT DATA { _:b sys:addRuleset <file://c:/graphdb/test-data/test.pie> }
This will create a new ruleset "test"


Operation Add a built-in ruleset
Predicate sys:addRuleset
Description Will add a built-in ruleset (one of the the rulesets that GraphDB supports natively)
Example INSERT DATA { _:b sys:addRuleset "owl-max" }
This will add the "owl-max" ruleset to the list of rulsets in the repository.


Operation Add a custom ruleset with SPARQL INSERT
Predicate sys:addRuleset
Description Will add a custom ruleset from the specified .pie file. The ruleset will be named after the filename, without the .pie extension.
Example INSERT DATA { <:custom> sys:addRuleset "Prefices { a : http://a/

} Axioms {} Rules {
Id: custom
a b c
a <a:custom1> c
-----------------------
b <a:custom1> a
}
"}
This will create a new ruleset "custom"


Operation List all rulesets
Predicate sys:listRulesets
Description Will list all ruleset available in the repository.
Example SELECT ?state ?ruleset { ?state sys:listRulesets ?ruleset }


Operation Explore a ruleset
Predicate sys:exploreRuleset
Example SELECT * { ?content sys:exploreRuleset "test" }


Operation Set a default ruleset
Predicate sys:defaultRuleset
Description Switch the default ruleset to the one, specified in the object literal.
Example INSERT DATA { _:b sys:defaultRuleset "test" }
This will set the default ruleset to "test". All transaction will use this ruleset, unless they specify another ruleset as the first operation in the transaction.


Operation Rename a ruleset
Predicate sys:renameRuleset
Description Will rename the ruleset from "custom" to "test". Note that "custom" is specified as the subject URI in the default namespace.
Example INSERT DATA { <:custom> sys:renameRuleset "test" }


This will rename the ruleset "custom" to "test"

Operation Delete a ruleset
Predicate sys:removeRuleset
Description Will delete the ruleset "test", specified in the object literal.
Example INSERT DATA { _:b sys:removeRuleset "test" }


Operation Consistency check
Predicate sys:consistencyCheckAgainstRuleset
Description Check if the repository is consistent with the specified ruleset.
Example INSERT DATA { _:b sys:consistencyCheckAgainstRuleset "test" }


Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.