9.3 SPARQL Rule-Based Inference
The RDF Graph inference extension architecture enables you to add SPARQL rule-based inference.
You can avail the full power of the SPARQL query language by specifying matching conditions for inferring new RDF triples. Unlike the limitations of normal inference, the inferred triples created using this process may even contain new RDF terms that were not originally present in the RDF network prior to the start of the inference task.
You can define your own rules using SPARQL update INSERT
statements.
- Storing SPARQL Rules
- Setting Up Sample Data to Create a SPARQL Inferred Graph
- Example Workflow to Create and Query a SPARQL Inferred Graph
Parent topic: User-Defined Inferencing and Querying
9.3.1 Storing SPARQL Rules
You can store any number of your own rules in any column of
VARCHAR
or CLOB
type in your own
tables along with match options and update options. The match options and
update options are the same as match_options
and
options
, respectively, used in SEM_APIS.UPDATE_RDF_GRAPH. They are used for hints that optimize SPARQL update
operations and can be NULL
.
All these rules are applied to an RDF triple store during inference by the SEM_APIS.CREATE_SPARQL_INFERRED_GRAPH API.
User rules can be represented as INSERT WHERE (or INSERT DATA) statements. For example:
PREFIX ex: <http://my.org/>
INSERT { ?x a ex:Employee }
WHERE { ?x ex:hours ?hrs FILTER (?hrs >= 40) }
Due to the nature of arbitrary rules, it cannot be guaranteed that the
inference will reach the transitive closure. Hence, the maximum number of iterations
should be specified. In addition, user rules can violate open world assumption which RDF
inference is based on. The use of SPARQL features that depend on a closed world
assumption (that is, NOT EXISTS
) may lead to inconsistent inferred
graph results. As such, their use should be avoided if possible.
Parent topic: SPARQL Rule-Based Inference
9.3.2 Setting Up Sample Data to Create a SPARQL Inferred Graph
Parent topic: SPARQL Rule-Based Inference
9.3.3 Example Workflow to Create and Query a SPARQL Inferred Graph
Parent topic: SPARQL Rule-Based Inference