Re: Example from sequence of triples to an RDF List

Hi Patrick,

The following should work fine

$ cat test.n3
@prefix log: <http://www.w3.org/2000/10/swap/log#>.
@prefix list: <http://www.w3.org/2000/10/swap/list#>.
@prefix : <http://example.org/ns#>.

:part1 :order 1 .
:part3 :order 3.
:part2 :order 2.

{   ((?B ?A) {?A :order ?B} ?C) log:collectAllIn ?SCOPE.
    ?C list:unique ?D.
    (?F {?D list:member (?E ?F)} ?G) log:collectAllIn ?SCOPE.
} => {
    :Collection :parts ?G.
}.

With the latest version of eye (supporting list:unique) you should get

$ eye --nope --quiet test.n3 --pass 2>/dev/null
@prefix log: <http://www.w3.org/2000/10/swap/log#>.
@prefix list: <http://www.w3.org/2000/10/swap/list#>.
@prefix : <http://example.org/ns#>.

:part1 :order 1 .
:part3 :order 3 .
:part2 :order 2 .
:Collection :parts (:part1 :part2 :part3).


Jos

-- https://josd.github.io


On Sat, Aug 27, 2022 at 9:43 AM Patrick Hochstenbach <
Patrick.Hochstenbach@ugent.be> wrote:

> Hi,
>
> I'm still struggling with RDF List and to use N3 (or SPARQL) for schema
> alignment.
> I the past the group provided solution to go from an RDF List to a
> sequence of triples (See: "Example how to count in N3" thread
> https://lists.w3.org/Archives/Public/public-n3-dev/2022Jul/0022.html).
>
> But how could the opposite route be done?
>
> From:
>
> :part1 :order 1 .
> :part2 :order 2.
> :part3 :order 3.
>
> to
>
> :Collection :parts (:part1 :part2 :part3 ).
>
> I tried my best and can invent rules to generate any combination of
> (infinite) lists, but not this example. I tried to list:append or trying to
> create a list by hand using rdf:next ..but this keeps producing blank nodes
> in a loop.
>
> In general, it is a question how to create an RDF List from scratch in N3
> using the input data.
>
> Patrick
>
>

Received on Saturday, 27 August 2022 11:34:02 UTC