data-model-spec icon indicating copy to clipboard operation
data-model-spec copied to clipboard

Make termType values a closed set

Open RubenVerborgh opened this issue 6 years ago • 6 comments

Following https://lists.w3.org/Archives/Public/public-rdfjs/2017Sep/0003.html, I suggest we make the language more strict and only allow those 5 values.

RubenVerborgh avatar Sep 21 '17 08:09 RubenVerborgh

I propose changing the following sentence describing a Term:

Possible values include "NamedNode", "BlankNode", "Literal", "Variable" and "DefaultGraph".

to

Allowed values are "NamedNode", "BlankNode", "Literal", "Variable" and "DefaultGraph".

or

The only allowed values are "NamedNode", "BlankNode", "Literal", "Variable" and "DefaultGraph".

rubensworks avatar Sep 21 '17 08:09 rubensworks

To make it an absolute requirement we should define it using MUST https://tools.ietf.org/html/rfc2119

elf-pavlik avatar Sep 21 '17 12:09 elf-pavlik

@bergos you wrote all the WebIDL in ReSpec version, I wonder if we should use WebIDL Enumerations

enum TermType {  "NamedNode", "BlankNode", "Literal", "Variable", "DefaultGraph };
interface Term {
    attribute TermType termType;
    attribute string value;
    boolean equals(Term other);
};

elf-pavlik avatar Oct 01 '17 16:10 elf-pavlik

Well, what happens when you extend a term to be able to be a nested graph? Maybe add "Graph" to the list now?

timbl avatar Dec 08 '17 20:12 timbl

@timbl does it mean that in a Quad you would like to use a "Graph" for subject or object? In Generalized RDF1.1 s, p, o, g can take IRI, blank node or literal

A generalized RDF triple is a triple having a subject, a predicate, and object, where each can be an IRI, a blank node or a literal. A generalized RDF graph is a set of generalized RDF triples. A generalized RDF dataset comprises a distinguished generalized RDF graph, and zero or more pairs each associating an IRI, a blank node or a literal to a generalized RDF graph.

How does a "nested graph" differ from having a graph named with IRI (NamedNode) or BlankNode and Quads just using those names to reference them instead of "nesting"?

elf-pavlik avatar Dec 09 '17 02:12 elf-pavlik

+1 to make to having a closed set. In practice (e.g. when used in a quad), in the current spec, a term is already a closed set. See http://rdf.js.org/#quad-interface , where the quad positions are subsets of the current term types (e.g. subject is NamedNode, BlankNode or Variable)

LaurensRietveld avatar Oct 18 '18 06:10 LaurensRietveld