- From: Andy Seaborne <andy@apache.org>
- Date: Thu, 18 Apr 2024 16:02:26 +0100
- To: public-rdf-dev@w3.org
Hi Rui,
On 18/04/2024 13:24, Rui Zhao wrote:
> Hi,
>
> We are using Turtle as a data format for our development, and uses RDF
> Lists on it. However, we see some weird behaviours over the tools we use.
>
> In short, can I have a *Named* RDF List (Collection)?
Yes, if you mean can the list cells have URI subjects and not blank nodes.
It won't print in a pretty form. The Turtle syntax for lists assumes
blank nodes and exactly one each of rdf:first, rdf:rest per list
element. It may look messy if the data deviates from that.
> For example, is
> the following data valid?
As Turtle, there is no DOT at the end but otherwise, yes.
> @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
> @prefix : <http://example.org#>.
>
> :node1
> :has :node2.
>
> :node2
> a rdf:List;
> rdf:first [a :Wow];
> rdf:rest rdf:nil
>
> We have found that this is rejected by rdflib (JS), and
> https://www.easyrdf.org/converter also showed unexpected output with
> this data (e.g. if outputting in N3 syntax).
What did you get?
rdf:nil may be printed as () as in:
"""
:node2 rdf:type rdf:List;
rdf:first [ rdf:type :Wow ];
rdf:rest () .
"""
which is correct (its the same triples) in the sense that "()" is a
syntax for rdf:nil.
>
> ||
>
> I have consulted the RDF spec https://www.w3.org/TR/rdf-schema/#ch_list,
> which did not seem to say anything about this.
>
>
> Best regards,
>
> Rui
>
Received on Thursday, 18 April 2024 15:02:35 UTC