On 20/03/2024 17:18, Arne Bernhardt wrote:
Hi Ryan,

there is no "term graph" to be found via Google. From Jena 5.0 on, the
default in-memory Graph in Jena will treat typed literals everywhere as
described under "literals term equality" in
https://www.w3.org/TR/rdf11-concepts/#section-Graph-Literal.

Before Jena 5, the default in-memory graph "indexed" object nodes based on
their values for typed literals, and methods like Graph#find and
Graph#contains found matches based on the values.

As far as I know, Fuseki always evaluated SPARQL with the
standard-compliant literal term equality.
But if one executed a query via the query API on the Jena 4 in-memory
graphs, the query execution would use object value equality.

I hope my explanation was roughly correct and helpful.

Arne

Hi Ryan,

In RDF, a literal looks like

"1"^^xsd:int

It is one of the kinds of RDF term

https://www.w3.org/TR/rdf11-concepts/#section-rdf-graph

"1" is lexical form.
xsd:int is the datatype.

The datatype xsd:int determines how these are mapped to values.
"+1", "0001" and "1" all map to the value one.

Two literal terms are the same term if and only if they have the same lexical form and same datatype (and language tag).

"+1"^^xsd:int has a different lexical form to "1"^^xsd:int so it is a different RDF term, yet they represent the same value.

In SPARQL,
   SAMETERM("1"^^xsd:int, "+1"^^xsd:int) is false.
   "1"^^xsd:int = "+1"^^xsd:int  is true.

Some Jena models stored literal by value.
RDF and SPARQL are defined to work with a graph made our of RDF terms, not values.

A "term graph" is one where Graph.find(,,1) or Model.listStatements() only considers RDF terms.

A "value graph" is one where looking for the literal "1"^^xsd:int might find "+1"^^xsd:int.


The change shouldn't have a widespread impact but it could be visible.
XSD datatypes define a canonical form - the preferred way to write a value. "1"^^xsd:int is canonical; "+1"^^xsd:int is not canonical.
Most published data uses canonical forms.

    Andy

Shaw, Ryan <[email protected]> schrieb am Mi., 20. März 2024, 13:32:


On Mar 20, 2024, at 5:05 AM, Andy Seaborne <[email protected]> wrote:

** Term graphs

Graphs are now term graphs in the API or SPARQL. That is, they do not
match "same value" for some of the Java mapped datatypes. The model API
already normalizes values written.

TDB1, TDB2 keep their value canonicalization during data loading.

A legacy value-graph implementation can be obtained from GraphMemFactory.

Can someone point me to an explanation of what this means? I am not
familiar with the terminology of "term graph" and "value graph" and a quick
web search turns up nothing that looks relevant.




Reply via email to