Hi Marynas, The word "unless" in your spec appears to need non-monotonic reasoning.
Here's how to do this in Executable English: class some-class1 is a subclass of class some-class2 at level some-l2 that-class2 has a parameter some-par2 with value some-value2 not : class that-class1 has a parameter that-par2 with a value -------------------------------------------------------------------------------------------- class that-class1 inherits parameter that-par2 with value that-value2 from class that-class2 at level some-l some-class has a parameter some-par with value some-value -------------------------------------------------------------------------------- class that-class has a parameter that-par with a value at level this-l this-class has a parameter this-par with value this-value ========================================================================= 1 topclass par1_1 99 2 midclass par2_1 88 3 botclass par1_1 77 at level some-l1 some-class1 has a parameter some-par1 with value some-value1 at level some-l2 some-class2 has a parameter some-par2 with value some-value2 that-l1 + 1 = that-l2 ------------------------------------------------------------------------- class that-class2 is a subclass of class that-class1 class some-class1 is a subclass of class some-class2 class that-class2 is a subclass of class some-class3 ----------------------------------------------------- class that-class1 is a subclass of class that-class3 You can edit, run and change the above at executable-english.com . Select the example MartynasInherit1. HTH, -- Adrian Adrian Walker Reengineering LLC San Jose, CA, USA 860 830 2085 www.executable-english.com On Wed, Sep 28, 2016 at 12:20 PM, Martynas Jusevičius <marty...@graphity.org > wrote: > Hey, > > is it possible to express such condition using Jena rules: > "Subclasses inherit parameter arguments from superclasses, unless an > argument with the same predicate already is a subclass parameter"? > > For example > > # 1 > > :SuperClass ldt:param [ a ldt:Argument ; spl:predicate foaf:name ], > [ a ldt:Argument ; spl:predicate dct:title ] . > > :SubClass rdfs:subClassOf :SuperClass . > > should infer new triples: > > :SubClass ldt:param [ a ldt:Argument ; spl:predicate foaf:name ], > [ a ldt:Argument ; spl:predicate dct:title ] . > > # 2 > > :SuperClass ldt:param [ a ldt:Argument ; spl:predicate foaf:name ], > [ a ldt:Argument ; spl:predicate dct:title ] . > > :SubClass rdfs:subClassOf :SuperClass ; > ldt:param [ a ldt:Argument ; spl:predicate dct:title ] , > [ a ldt:Argument ; spl:predicate sioc:name ] . > > should infer new triples: > > :SubClass ldt:param [ a ldt:Argument ; spl:predicate foaf:name ] . > # no dct:title param inferred, because it exists already > > > What I use currently is this: > > [arg1: (?template rdf:type <http://www.w3.org/ns/ldt#Template>), > (?template <http://www.w3.org/ns/ldt#param> ?arg), (?arg rdf:type > <http://www.w3.org/ns/ldt#Argument>), (?subTemplate rdfs:subClassOf > ?template), (?subTemplate rdf:type > <http://www.w3.org/ns/ldt#Template>), noValue(?subTemplate > <http://www.w3.org/ns/ldt#param>) -> (?subTemplate > <http://www.w3.org/ns/ldt#param> ?arg)] > > [arg2: (?template rdf:type <http://www.w3.org/ns/ldt#Template>), > (?template <http://www.w3.org/ns/ldt#param> ?arg), (?arg rdf:type > <http://www.w3.org/ns/ldt#Argument>), (?subTemplate rdfs:subClassOf > ?template), (?subTemplate rdf:type > <http://www.w3.org/ns/ldt#Template>), (?arg > <http://spinrdf.org/spl#predicate> ?predicate), (?subTemplate > <http://www.w3.org/ns/ldt#param> ?subArg), noValue(?template > <http://www.w3.org/ns/ldt#param> ?subArg), noValue(?subArg > <http://spinrdf.org/spl#predicate> ?predicate) -> (?subTemplate > <http://www.w3.org/ns/ldt#param> ?arg)] > > Sometimes I get desired results, sometimes only a single param is inferred. > > Are the rules wrong or is this can't be done with monotonic rules? > > > Thanks, > > Martynas >