Re: Example from sequence of triples to an RDF List

Yes, indeed! This I certainly was something I couldn't have produced.

I didn't come across  log:collectAllIn before.

I assume

( ?Params ?FormA ?Collection ) log:collectAllIn ?FormB

Means some kind of 'Params' extraction from 'FormA' into a 'Collection'
..and then the 'FormB' is [?].

Thanks
Patrick

________________________________
From: Jos De Roo <josderoo@gmail.com>
Sent: 27 August 2022 13:33
To: Patrick Hochstenbach <Patrick.Hochstenbach@UGent.be>
Cc: public-n3-dev@w3.org <public-n3-dev@w3.org>
Subject: 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#<https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.w3.org%2F2000%2F10%2Fswap%2Flog%23&data=05%7C01%7CPatrick.Hochstenbach%40ugent.be%7C47a1fd72b6914828b72a08da88200304%7Cd7811cdeecef496c8f91a1786241b99c%7C1%7C0%7C637971968311225997%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=fZFrBtXU7PrSHGcB3SWgvl7TYmtD6r1tX5pV1TcBZrs%3D&reserved=0>>.
@prefix list: <http://www.w3.org/2000/10/swap/list#<https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.w3.org%2F2000%2F10%2Fswap%2Flist%23&data=05%7C01%7CPatrick.Hochstenbach%40ugent.be%7C47a1fd72b6914828b72a08da88200304%7Cd7811cdeecef496c8f91a1786241b99c%7C1%7C0%7C637971968311225997%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=9tpWr7H57K%2F71UXpZwtGSpMtH%2B6PNsWQCWfDjUOX1vo%3D&reserved=0>>.
@prefix : <http://example.org/ns#<https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fexample.org%2Fns%23&data=05%7C01%7CPatrick.Hochstenbach%40ugent.be%7C47a1fd72b6914828b72a08da88200304%7Cd7811cdeecef496c8f91a1786241b99c%7C1%7C0%7C637971968311225997%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=iIKo044fHRfJmpYBLUlqY2uGxeoZLwPBuLZYQLxD21I%3D&reserved=0>>.

: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#<https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.w3.org%2F2000%2F10%2Fswap%2Flog%23&data=05%7C01%7CPatrick.Hochstenbach%40ugent.be%7C47a1fd72b6914828b72a08da88200304%7Cd7811cdeecef496c8f91a1786241b99c%7C1%7C0%7C637971968311225997%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=fZFrBtXU7PrSHGcB3SWgvl7TYmtD6r1tX5pV1TcBZrs%3D&reserved=0>>.
@prefix list: <http://www.w3.org/2000/10/swap/list#<https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.w3.org%2F2000%2F10%2Fswap%2Flist%23&data=05%7C01%7CPatrick.Hochstenbach%40ugent.be%7C47a1fd72b6914828b72a08da88200304%7Cd7811cdeecef496c8f91a1786241b99c%7C1%7C0%7C637971968311225997%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=9tpWr7H57K%2F71UXpZwtGSpMtH%2B6PNsWQCWfDjUOX1vo%3D&reserved=0>>.
@prefix : <http://example.org/ns#<https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fexample.org%2Fns%23&data=05%7C01%7CPatrick.Hochstenbach%40ugent.be%7C47a1fd72b6914828b72a08da88200304%7Cd7811cdeecef496c8f91a1786241b99c%7C1%7C0%7C637971968311225997%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=iIKo044fHRfJmpYBLUlqY2uGxeoZLwPBuLZYQLxD21I%3D&reserved=0>>.

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


Jos

-- https://josd.github.io<https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fjosd.github.io%2F&data=05%7C01%7CPatrick.Hochstenbach%40ugent.be%7C47a1fd72b6914828b72a08da88200304%7Cd7811cdeecef496c8f91a1786241b99c%7C1%7C0%7C637971968311225997%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=6%2FiZa1XDzAsc7an79xSOesC9gfhmDH%2BoGbqjt9g4GYY%3D&reserved=0>


On Sat, Aug 27, 2022 at 9:43 AM Patrick Hochstenbach <Patrick.Hochstenbach@ugent.be<mailto: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<https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.w3.org%2FArchives%2FPublic%2Fpublic-n3-dev%2F2022Jul%2F0022.html&data=05%7C01%7CPatrick.Hochstenbach%40ugent.be%7C47a1fd72b6914828b72a08da88200304%7Cd7811cdeecef496c8f91a1786241b99c%7C1%7C0%7C637971968311225997%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=9AFSD88vwK1WDKRKraRNrN1T3bXLsLLWnSTuQ2mKnWk%3D&reserved=0>).

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 12:14:41 UTC