0

I am making a static RDFS-Plus inference engine.

I have written a function that will make the appropriate inferences for all of the constructs included. For example if this function is passed the triple C1 rdf:subClassOf C2, then for all X's in triples of the form X rdf:type C1, a new triple of the form X rdf:type C2 will be produced.

Where I am struggling is in figuring out how to make all possible inferences. The struggle comes from the fact that I must make inferences based off inferences.

Here is where I am at in my program:

1. Parse a `.ttl` file and assert all the triples into a data store.
2. Separate out the triples that represent RDFS-Plus constructs into a list.
3. ??? (make all possible inferences somehow)

The only idea that I am sure would work is to generate all the permutations of the RDFS-Plus list (giving a list of lists), and then for each inner list map my infer function. This is a useless solution though as it is so inefficient.

Is my infer function enough to be able to produce all possible inferences or did I go down a barren path? Do I have enough in place to make a rule dependency graph? I do not know how to calculate if a modelling construct may depend on another construct. For example could owl:FunctionalProperty depend on rdfs:subClassOf or is this just gibberish?

I would really appreciate some insight.

Nicholas Hubbard
  • 527
  • 2
  • 15
  • What is a better place to ask this question? – Nicholas Hubbard Dec 28 '20 at 21:55
  • 1
    there is no magic behind this - people already did what you want to do, I did what you want to do - not sure why you want to reinvent the wheel, but that's not the question here. Obviously, the procedure is always the same. You have a set of rules, some depend on the output of other rules, which makes it possible to create a *rule dependency graph*. Once you have cycles in the graph, you obviously have to apply *fixpoint iteration*, i.e. repeat the whole cycle until no new inferences have been computed. Done. – UninformedUser Dec 29 '20 at 07:02
  • I do not understand how I am supposed to know what rules depend on what? Can this be calculated? I was able to find some reading about this but none of these readings actually said how to calculate these dependencies. Would I be correct in saying that the two rules most depended on would be `rdfs:subPropertyOf` and `rdfs:subClassOf`? – Nicholas Hubbard Dec 29 '20 at 15:07
  • Any rule has premise and conclusion or not? Like input and output. Isn't this obvious then? Some rules consume the output of other rules, that's all you need. It should be obvious that triples with `rdf:type` as predicate can come from the original graph but also from other rules "producing" those triples. – UninformedUser Dec 29 '20 at 15:11
  • I don't understand what you mean with the last part of your comment given that you didn't show any rule but just two properties. But it doesn't matter. I guess I clarified it with my previous comment. Compute the dependency graph, then investigate it and see which rules can be computed independently and which need input from other rules and which part of the ruleset has to be repeated until no new triples occur. – UninformedUser Dec 29 '20 at 15:12
  • also I hope you understand what an inference rule is ... that's how RDFS semantics and others can be encoded and materialized – UninformedUser Dec 29 '20 at 15:17
  • So for `A rdfs:subClassOf B` the "inputs" to this construct are `x rdf:type A` and the output is the triple `x rdf:type B`? So in the graph I would say that `x rdf:type B` depends on the two triples `A rdfs:subClassOf B` AND `x rdf:type A`? – Nicholas Hubbard Dec 29 '20 at 15:38
  • ehm, `A rdfs:subClassOf B` is nothing but a triple or maybe a triple pattern. Clearly, given that RDF is made of triples the only important part is the predicate. This is not how RDFS semantics nor RDFS Plus semantics is defined. The semantics is defined by means of rules. Like `(A rdfs:subClassOf B), (x rdf:type A) -> (x rdf:type B)` - this is a rule and one of the most important inferences in RDFS. If some other rule does "consume" or has an atom with `rdf:type` as predicate in its rule body, then it obviously depends on the previous rule. – UninformedUser Dec 29 '20 at 18:49
  • And yes, this rule depends on itself. Can be avoided if you comute the transitive closure of `rdfs:subClassOf` indeed - the proof for this is trivial. Try it. – UninformedUser Dec 29 '20 at 18:49
  • Whatever you're doing right now, you should re-think about it and re-read about RDFS and rules. Or I'm missing something important in your approach, I don't know. If so, let me know – UninformedUser Dec 29 '20 at 18:53
  • I have a bunch of functions for making inferences based off the RDFS-Plus rules. For example I have `infer_rdfs:subClassOf(Sub,Super)` that forall triples of the form `(X,rdf:type,Sub)` produces a new triple `(X,rdf:type,Super)`. Maybe this was not clear. The general flow of my program to this point is that I parse a `.ttl` file and separate all the triples that use RDFS-Plus. I now want to use all of my inference functions, `infer_subClassOf`,`infer_functionalProperty`, etc, to make all possible inferences. – Nicholas Hubbard Dec 29 '20 at 19:44
  • I don't know. But are you still stuck? I don't get what you're doing. RDFS inference is done by means of rules. Why are you not using an existing reasoner? I mean, you methods do nothing but encode the inference rules differently. Like your method `infer_rdfs:subClassOf(Sub,Super)` needs the subclass relations, i.e. `sub rdfs:subClassOf Super` and `(X,rdf:type,Sub)` - where is the point in your algorithm? – UninformedUser Jan 03 '21 at 06:52
  • Yes still stuck. I am doing this to solidify my knowledge of prolog. `infer_rdfs:subClassOf(Sub,Super)` is called by another function when passed the full triple `Sub rdfs:subClassOf Super`. When it is called it searches for all triples of the form `(X,rdf:type,Sub)` and asserts a new triple `(X,rdf:type,Super)`. ---- my programs main function is very simple and should show what I am trying to do: http://dpaste.com/3W53ESPQW – Nicholas Hubbard Jan 03 '21 at 15:51

0 Answers0