w3c / rdf-concepts

https://w3c.github.io/rdf-concepts/
Other
16 stars 2 forks source link

mention `xsd:string` as default datatype #22

Closed VladimirAlexiev closed 1 year ago

VladimirAlexiev commented 1 year ago

"foo" is the same as "foo"^^xsd:string, eg in SPARQL:

But I don't see any mention of xsd:string as default datatype:

pfps commented 1 year ago

I don't see that the notion of a default datatype has a place in this document or, indeed, elsewhere in RDF or SPARQL. Every literal in RDF has at least a lexical form and a datatype.

That "foo" or 7 are syntax for literals in some surface syntaxes is a separate matter.

gkellogg commented 1 year ago

Indeed, all literals have explicit datatypes in the abstract syntax: a Unicode string, a datatype IRI, and a language tag is the datatype IRI is http://www.w3.org/1999/02/22-rdf-syntax-ns#langString. No defaults or options. There is a note about simple literals, which is closest to what you describe as a default datatype, but this is a description of what concrete syntaxes may support. Most (all?) concrete syntaxes do support this concept, including SPARQL. (Note that there's still a sentence "A plain literal is lower than an RDF literal with type xsd:string of the same lexical form." in the Editor's Draft which is probably obsolete).

afs commented 1 year ago

(Note that there's still a sentence "A plain literal is lower than an RDF literal with type xsd:string of the same lexical form." in the Editor's Draft which is probably obsolete).

https://github.com/w3c/sparql-query/issues/26

It is now obsolete.

VladimirAlexiev commented 1 year ago

I'm happy with the note about simple literals and I wonder how I missed it. Maybe because it mentions http://www.w3.org/2001/XMLSchema#string but not xsd:string. Would it be ok to mention the prefixed forms after the full URLs, i.e. add these two in parentheses:

Simple literals are syntactic sugar for abstract syntax literals with the datatype IRI http://www.w3.org/2001/XMLSchema#string (xsd:string). Similarly, most concrete syntaxes represent language-tagged strings without the datatype IRI because it always equals http://www.w3.org/1999/02/22-rdf-syntax-ns#langString (rdf:langString).

afs commented 1 year ago

This needs care.

RDF/XML, N-Triples and N-Quads don't have prefix abbreviations.

Prefixes do not exist in the abstract data model.

afs commented 1 year ago

"Simple literal" should be removed completely because it has a specific different meaning - no datatype, no language tag (the terminology was invested fro SPARQL due to a need for it).

This could be "string literal".

gkellogg commented 1 year ago

"Simple literal" is defined as a syntactic convention for literal forms without an explicit datatype IRI or language tag, and the spec is clear that they would have the assigned xsd:string datatype. We could potentially describe the term as being archaic, though.

There are other places in RDF Concepts where IRI prefixes are used. We define the prefixes for "rdf", "rdfs", and "xsd" (although "rdfs" is unused in the document at this point). For example we talk about rdf:HTML and rdf:XMLLiteral as datatypes where it should be clear that these are the abbreviated form from the datatype definitions. There's a specific description of using the "xsd" prefix in the Datatype IRIs and The XML Schema Built-in Datatypes sections, so adding the abbreviated form (e.g., xsd:string), or even replacing the full IRI with the prefixed name version wouldn't change the meaning of the spec.

If we were to make such a change, it should be done consistently for xsd:string and rdf:langString, but it does seem like a gratuitous change.

afs commented 1 year ago

rdf:HTML carefully uses the full IRI where it gives it's IRI.

My suggestion on the PR is to do similar - don't give the prefix form at the point of definition, and then use it in the paragraph that is about concrete syntaxes.

TallTed commented 1 year ago

I'm OK with including the prefixed identifier alongside the full URI, whether near/within the definition or not.

I suggest something along the lines of http://www.w3.org/2001/XMLSchema#string (commonly shortened to the prefixed identifier, xsd:string), as the simpler (xsd:string) doesn't make clear to the reader what it's meant to mean, though the writer may understand themselves clearly.