ONTOTEXT ANSWER:

This is a fairly natural question. After all, you may change your mind or just want to debug a certain rule. There are a few caveats to keep in mind, of course.

GraphDB does inference at data insertion time, and it is a forward-chaining database. So, when you insert an ontology or data file, the database produces the triples which are implied in the data. This means that the data is then available for fast queries. So, what happens when we change the ruleset?

There’s one important thing to note here – we are inserting data in two different transactions. This is because the first step parses the custom ruleset file, and the second step applies it. If we try to do this in one transaction (i.e., SPARQL update), the second step wouldn’t be aware that the file has been ingested.

If you try to do this yourself, you’ll notice that the operation is near instantaneous. This is because changing the ruleset is not, actually, ingesting data. You shouldn’t be fooled by the bright purple INSERT DATA text. This isn’t standard data you are working with here. The predicates starting with “sys” are system statements. They are not actual information stored within the graph database, but control keywords to alter its behavior.

So, if this is not ingesting data, and we infer at ingestion time, the end result would be that the behavior is changed for all future updates. So, from that moment on, any triple you ingest will be produced in accordance with your new custom ruleset.

But what if you don’t want that, and would rather prefer that each triple in the repository is changed, including triples which are already present? Well, there is a system statement for this as well:

Of course, reinference isn’t near instantaneous as switching the rulesets.

Using runtime ruleset switches, you can combine inference from various rulesets in your database. However, keep two things in mind:

  • For now, there is no way to differentiate which source produced what data. We hope to address that in the near future.
  • If you ever re-infer, this would overwrite all previous inference.

Review GraphDB