On Wed, Feb 25, 2015 at 10:51 AM, Miguel Bento Alves
<[email protected]> wrote:
>
> I don’t understand how works lists in Jena rule engine. How can I create a 
> list in Jena rules? Anyone has an example with lists in jena rules to 
> understand better how it works?
>

Make sure you understand how RDF lists work, first.  They're just
singly linked lists where a list node is some resource, the element of
the node is indicated by rdf:first, and the rest of the list is
indicated by rdf:rest.  There's also rdf:nil as the empty list.  So an
RDF list of "a" and "b" might be:

    [ rdf:first "a" ; rdf:rest [ rdf:first "b" ; rdf:rest rdf:nil ] ]

So you'd create a list by creating resources (often, but not
necessarily, blank nodes), and adding rdf:first and rdf:rest
properties to them.  There are some builtins (e.g., listContains,
listNotContains, listEntry, listLength, etc.) that make working with
lists a bit easier.

//JT
-- 
Joshua Taylor, http://www.cs.rpi.edu/~tayloj/

Reply via email to