Hi, thank you for reply.

I sure know all these builtin functions but I'm not sure that they pass to my 
case. May be I have to describe the scenario in more details.

Here pseudo code:


given (?s hasList ?list)
if for all ?p in ?list

    (?s1 ?p ?o1) (?s2 ?p ?o2) equal(?o1 ?o2)
then         

    -> do smth


I have already written a bultin function for this functionality (pseudo):

(?s hasList ?list)
-> myBuiltin(?s1 ?s2 ?list)


but I have to do graph find within the builtin's headAction to get the results 
of  (?s1 ?p ?o1) (?s2 ?p ?o2) and I'm afraid that this decrease the performance 
of the rule processing (or is it ok to do this?), therefore I'm looking for 
rule optimization.

Regards,
Igor




----- Ursprüngliche Message -----
> Von: Joshua TAYLOR <[email protected]>
> An: [email protected]; Igor Brussilowski <[email protected]>
> CC: 
> Gesendet: 20:50 Montag, 5.August 2013
> Betreff: Re: Access list values in rules
> 
> On Mon, Aug 5, 2013 at 9:02 AM, Igor Brussilowski
> <[email protected]> wrote:
>>  Hi all,
>> 
>>  I'm looking for how to access list items in a reasoner rule. E.g the 
> pattern (?S owl:kasKey ?L) returns a list of all matching objects. Is there 
> any 
> way to access here the elements of the list for further processing, e.g. to 
> print them all out?
> 
> According to the documentation [1], there are a number of builtins for
> working with lists:
> 
> listContains(?l, ?x)
> listNotContains(?l, ?x)    
> Passes if ?l is a list which contains (does not contain) the element
> ?x, both arguments must be ground, can not be used as a generator.
> 
> listEntry(?list, ?index, ?val)    
> Binds ?val to the ?index'th entry in the RDF list ?list. If there is
> no such entry the variable will be unbound and the call will fail.
> Only useable in rule bodies.
> 
> listLength(?l, ?len)    
> Binds ?len to the length of the list ?l.
> 
> listEqual(?la, ?lb)
> listNotEqual(?la, ?lb)    
> listEqual tests if the two arguments are both lists and contain the
> same elements. The equality test is semantic equality on literals
> (sameValueAs) but will not take into account owl:sameAs aliases.
> listNotEqual is the negation of this (passes if listEqual fails).
> 
> listMapAsObject(?s, ?p ?l)
> listMapAsSubject(?l, ?p, ?o)    
> These can only be used as actions in the head of a rule. They deduce a
> set of triples derived from the list argument ?l : listMapAsObject
> asserts triples (?s ?p ?x) for each ?x in the list ?l,
> listMapAsSubject asserts triples (?x ?p ?o).
> 
> [1] http://jena.apache.org/documentation/inference/#RULEbuiltins
> 
> -- 
> Joshua Taylor, http://www.cs.rpi.edu/~tayloj/
>

Reply via email to