Re: [External] : Can a triple-term in an N-Triple 1.2 statement have "infinite" number of atomic terms?

May be I am just ignorant, but a simple dynamic data structure (e.g., naïvely with pointers) to store triple terms would be the way to go, say, for triple terms with at least one level of nesting.
Obviously, without triple terms this does not introduce any inefficiency.
—e.

On 27 Jan 2025, at 16:44, Souripriya Das <souripriya.das@oracle.com> wrote:

Sorry, I meant the following Turtle 1.2 statement ... (not the shortcut version involving << ... >> — thanks to Pierre-Antoine and Enrico for pointing this out)
    :s1 :p1 <<( :s2 :p2  ... <<( :sN :pN  :oN )>>  ... )>> .

So, can an implementation support a chosen upper limit for the depth of nesting -- to say 0 (yes, even 0), 1, 2, or whatever -- for triples-terms and still be conformant with RDF 1.2?

Since there is no way to represent a triple involving an N-depth triple-term in a triplestore that supports depth less than N, interoperability of data will be affected. The following statement, for example,
     :s1 :p1 <<( :s2 :p2 <<( :s3 :p3  <<( :s4 :p4 :o4 )>> )>> )>> .
cannot be stored in a triplestore that does not support the depth of nesting needed for this statement.

Pierr-Antoine wrote:
> Note however that this is an extreme corner case, since most of the time, people would make statements about reifiers rather than about triple terms themselves.

My concern is whether we are putting too much complexity into RDF1.2 to support rare situations and thereby creating potential for interoperability issues.

Thanks,
Souri.

________________________________
From: Franconi Enrico <franconi@inf.unibz.it<mailto:franconi@inf.unibz.it>>
Sent: Monday, January 27, 2025 9:13 AM
To: Souripriya Das <souripriya.das@oracle.com<mailto:souripriya.das@oracle.com>>
Cc: Pierre-Antoine Champin <pierre-antoine@w3.org<mailto:pierre-antoine@w3.org>>; Andy Seaborne <andy@apache.org<mailto:andy@apache.org>>; public-rdf-star-wg@w3.org<mailto:public-rdf-star-wg@w3.org> <public-rdf-star-wg@w3.org<mailto:public-rdf-star-wg@w3.org>>
Subject: Re: [External] : Can a triple-term in an N-Triple 1.2 statement have "infinite" number of atomic terms?

Souripriya Das  wrote:
So, if we go with such a "no nested triples-terms" restriction in N-Triples 1.2, conversion of the following Turtle 1.2 statement (containing a nested triple-term)
    :s1 :p1 <<( :s2 :p2  ... <<( :sN :pN  :oN )>>  ... )>> .
to N-Triples 1.2 will be the following set of statements:
    :s1 :p1 _:b2 .
    _:b2 rdf:reifies <<( :s2 :p2 _:b3 )>> .
              ...
    _:bN rdf:reiffes <<( :sN :pN :oN )>> .

No. The Turtle 1.2 statement
:s1 :p1 <<( :s2 :p2  ... <<( :sN :pN  :oN )>>  ... )>> .
is represented in N-Triples in the same way, since it does not make use of a Turtle 1.2 shortcut.
Therefore you need to have in N-Triples "nested triples-terms”, otherwise we would not be able to capture the RDF 1.2 grammar as we have decided. I expect that triples with nested triple terms will be rare, just like triples with triple terms without rdf:reifies will be rare; their combination will be even more rare.
On the other hand, the Turtle 1.2 statement
:s1 :p1 << :s2 :p2  ... << :sN :pN  :oN >>  ... >> .
uses a shortcut, and it is expanded in N-Triples as you say:
:s1 :p1 _:b2 .
 _:b2 rdf:reifies <<( :s2 :p2 _:b3 )>> .
...
_:bN rdf:reiffes <<( :sN :pN :oN )>> .

cheers
—e.

________________________________
From: Pierre-Antoine Champin <pierre-antoine@w3.org<mailto:pierre-antoine@w3.org>>
Sent: Monday, January 27, 2025 7:36 AM
To: Souripriya Das <souripriya.das@oracle.com<mailto:souripriya.das@oracle.com>>; Andy Seaborne <andy@apache.org<mailto:andy@apache.org>>; public-rdf-star-wg@w3.org<mailto:public-rdf-star-wg@w3.org> <public-rdf-star-wg@w3.org<mailto:public-rdf-star-wg@w3.org>>
Subject: Re: [External] : Can a triple-term in an N-Triple 1.2 statement have "infinite" number of atomic terms?


On 27/01/2025 13:01, Souripriya Das wrote:
So, in short, N-Triples 1.2 will allow potentially "infinite"-length statements, including ones like the following:

    :s1 :p1 <<( :s2 :p2  ... <<( :sN :pN  :oN )>>  ... )>> .
I would rather say "unbounded" (triple terms, even nested, are always finite), but yes.
Note however that this is an extreme corner case, since most of the time, people would make statements about reifiers rather than about triple terms themselves.

Note that in theory, literals in N-Triples (and in RDF abstract syntax) are also unbounded; same for IRIs. Yet, I assume that all implementations have limits on the size of the IRIs and literals they can accept. So I would not be surprised or concerned if implementations also had limits on the depth of nesting that they accept...

Such a statement in N-Triples 1.2 will contain 2N+1 "atomic" RDF 1.1, possibly unique, terms in a single line (i.e., ending with EOL).

Please confirm.

Thanks,
Souri.



________________________________
From: Pierre-Antoine Champin <pierre-antoine@w3.org><mailto:pierre-antoine@w3.org>
Sent: Monday, January 27, 2025 6:29 AM
To: Souripriya Das <souripriya.das@oracle.com><mailto:souripriya.das@oracle.com>; Andy Seaborne <andy@apache.org><mailto:andy@apache.org>; public-rdf-star-wg@w3.org<mailto:public-rdf-star-wg@w3.org> <public-rdf-star-wg@w3.org><mailto:public-rdf-star-wg@w3.org>
Subject: Re: [External] : Can a triple-term in an N-Triple 1.2 statement have "infinite" number of atomic terms?


On 27/01/2025 11:36, Souripriya Das wrote:
Andy wrote:
>> That's the N-Triples that I'm getting for that Turtle example.
It does not have a nested triple term.

That's good but just to be sure, let me tweak the Turtle 1.2 statement a bit to avoid the use of explicit reifiers.

Would the following statement in Turtle 1.2:
    :s :believes << :s2 :believes << :s3 :p3 :o3 >>  >> .
be a valid statement in N-Triples 1.2 as well?
No, because the '<< ... >>' construct (reification) is only part of Turtle, not of N-Triples.
Not ot be confused with the '<<( ... )>>' construct (triple terms), which is also part of N-Triples.
And yes, recursive triple terms are possible, e.g.

  _:b1 rdf:reifies <<( _:b2 rdf:reifies <<( <tag:s> <tag:p> <tag:o> )>> )>> .

This is valid N-Triples, and contains 1 (asserted) triple.

  best


Or, would it always require use of multiple statements in N-Triples, something like the following?
    :s believes _:b2 .
    _:b2 rdf:reifies <<( :s2 :believes _:b3 )>> .
    _:b3 rdf:reifies <<( :s3 :p3 :o3 )>> .

Thanks,
Souri.

________________________________
From: Andy Seaborne <andy@apache.org><mailto:andy@apache.org>
Sent: Saturday, January 25, 2025 7:09 AM
To: public-rdf-star-wg@w3.org<mailto:public-rdf-star-wg@w3.org> <public-rdf-star-wg@w3.org><mailto:public-rdf-star-wg@w3.org>
Subject: Re: [External] : Can a triple-term in an N-Triple 1.2 statement have "infinite" number of atomic terms?




On 24/01/2025 17:31, Souripriya Das wrote:
In N-Triple 1.1 syntax, a statement consists of exactly three (atomic) terms and I am hoping that N-Triple 1.2 will be a simple extension that will allow 5-term statements as well, subject to the restriction that the predicate for such 5-term statements will always be rdf:reifies.

Thus, the following statement in Turtle 1.2:
    :s :believes << :s2 :believes << :s3 :p3 :o3 ~ :r3 >> ~ :r2 >> .
will be written in N-Triple 1.2 as follows:
    :s believes :r2 .
    :r2 rdf:reifies <<( :s2 :believes :r3 )>> .
    :r3 rdf:reifies <<( :s3 :p3 :o3 )>> .

Is this aligned with the current thinking in the WG?

That's the N-Triples that I'm getting for that Turtle example.
It does not have a nested triple term.


Thanks,
Souri.
________________________________
From: Souripriya Das <souripriya.das@oracle.com><mailto:souripriya.das@oracle.com>
Sent: Thursday, January 23, 2025 11:59 AM
To: RDF-star WG <public-rdf-star-wg@w3.org><mailto:public-rdf-star-wg@w3.org>
Subject: [External] : Can a triple-term in an N-Triple 1.2 statement have "infinite" number of atomic terms?

Would the following be a valid N-Triple 1.2 statement, where n can be, say, 1000?
(There will be a total of 2*1000 + 1 = 2001 "atomic" terms in the triple-term used as the object.)

    :s :p <<( :s1 :p1 <<( :s2 :p2 <<( ... <<(  :sn :pn :on )>> )>> )>> )>> .

The RDF Abstract Syntax allows it and N-triples has concrete syntax for it.
https://www.w3.org/TR/rdf12-concepts/#section-triples<https://urldefense.com/v3/__https://www.w3.org/TR/rdf12-concepts/*section-triples__;Iw!!ACWV5N9M2RV99hQ!JYEvlde5NuL_h5csMvH6AwkIwDQ-0an7pS64QPbyPujF1z1Hq5zPtm0_FQrFPc5jqgNd1kTb5R4zo_5x$>
https://www.w3.org/TR/rdf12-concepts/#section-triple-terms<https://urldefense.com/v3/__https://www.w3.org/TR/rdf12-concepts/*section-triple-terms__;Iw!!ACWV5N9M2RV99hQ!JYEvlde5NuL_h5csMvH6AwkIwDQ-0an7pS64QPbyPujF1z1Hq5zPtm0_FQrFPc5jqgNd1kTb5XDNa7h2$> (2nd point)

Personally, I think nesting in triple terms will not be common, and many levels very, very uncommon.
But the ability to create triple terms for any triple data does lead to providing for nesting.

    Andy



Thanks,
Souri.

Received on Monday, 27 January 2025 15:54:07 UTC