The head of arg3 should have been drop(5) to indicate (?template <http://www.w3.org/ns/ldt#param> ?arg2).
On Thu, Sep 29, 2016 at 1:57 AM, Martynas Jusevičius <[email protected]> wrote: > I also tried a non-monotonic versions with drop()/remove(): > https://jena.apache.org/documentation/inference/#builtin-primitives > > The following is an attempt to clone overriding arguments and remove > them if the predicate matches an existing one: > > [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>), makeTemp(?subArg) -> > (?subTemplate <http://www.w3.org/ns/ldt#param> ?subArg), (?subArg > rdf:type <http://www.w3.org/ns/ldt#Argument>), (?subArg > <http://www.w3.org/ns/ldt#overrides> ?arg)] > > [arg2: (?subArg <http://www.w3.org/ns/ldt#overrides> ?arg) (?arg ?argP > ?argO) -> (?subArg ?argP ?argO)] > > [arg3: (?template rdf:type <http://www.w3.org/ns/ldt#Template>), > (?template <http://www.w3.org/ns/ldt#param> ?arg1), (?arg1 rdf:type > <http://www.w3.org/ns/ldt#Argument>), (?arg1 > <http://spinrdf.org/spl#predicate> ?predicate1), (?template > <http://www.w3.org/ns/ldt#param> ?arg2), (?arg2 rdf:type > <http://www.w3.org/ns/ldt#Argument>), (?arg2 > <http://spinrdf.org/spl#predicate> ?predicate2), equal(?predicate1, > ?predicate2), noValue(?arg1, <http://www.w3.org/ns/ldt#overrides>) > (?arg2 <http://www.w3.org/ns/ldt#overrides> ?superArg) -> drop(6) ] > > But using this, rdf:type ldt:Argument goes missing for some reason... > > On Wed, Sep 28, 2016 at 10:43 PM, Adrian Walker <[email protected]> > wrote: >> 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 <[email protected] >>> 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 >>>
