Hacker News new | ask | show | jobs
by axylos 2019 days ago
You mentioned that sparql/Xquery don’t suit your needs but those aren’t for reasoning.

It’s not Datalog, but the Apache Jena inference api caters to these concerns: https://jena.apache.org/documentation/inference/

Or is there something particular about Datalog, other than that it already exists, that is missing?

1 comments

The various OWL dialects are intended for reasoning, in combination with RDF etc.

In my opinion, all these languages fall short for the reasons I mentioned: In particular, even though one can express knowledge and rules in these languages, they do not allow convenient reasoning about the rules themselves, for example in order to dynamically interpret them with custom execution strategies.

Jena suffers from the same shortcoming. The documentation you link to shows an example that illustrates the issue:

    Model rdfsExample = ModelFactory.createDefaultModel();
    Property p = rdfsExample.createProperty(NS, "p");
    Property q = rdfsExample.createProperty(NS, "q");
    rdfsExample.add(p, RDFS.subPropertyOf, q);
    rdfsExample.createResource(NS+"a").addProperty(p, "foo");
I can now create an inference model that takes this knowledge into account:

    InfModel inf = ModelFactory.createRDFSModel(rdfsExample);
OK, but how do I actually process these relations themselves if I want to reason about them? For example, suppose I want to write a program that tries to minimize the relations, or rewrite them for more efficient processing. How do I represent and access the rules themselves within this framework, when I want to reason about the rules instead of only using them with fixed reasoning engines?

Datalog makes this easy, because every Datalog knowledge base is also a valid Prolog program, and every Prolog program is a sequence of Prolog terms. Hence, we can use Prolog to easily reason about knowledge and rules that are stated in Datalog or Prolog syntax. This ability is what I miss most severely in the current semantic web stack.

I admit I'm not terribly familiar with Prolog/Datalog, but it sounds similar to class expressions + properties in Jena:

https://jena.apache.org/documentation/ontology/#ontology-cla...

https://jena.apache.org/documentation/ontology/#ontology-pro...

where you can apply sub/super classes and define a property as disjoint/transitive/equivalent to other properties.

I guess at that point I would wonder how much more is really practically necessary for a 'web of semantic data'. Imo, that's already over-powered for the basic use case which is linking one schema and its properties to another and defining an exchange protocol via the linked data platform.

Again, I admit I'm not very familiar with these things and I appreciate you taking the time to read through this stuff.