Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add optional direction for literals #175

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 34 additions & 7 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
url: "https://ruben.verborgh.org/",
company: "Ghent University – imec",
companyURL: "http://idlab.ugent.be/"
}, {
name: "Ruben Taelman",
url: "https://www.rubensworks.net/",
company: "Ghent University – imec",
companyURL: "http://idlab.ugent.be/"
}],
authors: [{
name: "Thomas Bergwinkl",
Expand All @@ -47,6 +52,11 @@
url: "https://ruben.verborgh.org/",
company: "Ghent University – imec",
companyURL: "http://idlab.ugent.be/"
}, {
name: "Ruben Taelman",
url: "https://www.rubensworks.net/",
company: "Ghent University – imec",
companyURL: "http://idlab.ugent.be/"
}],
bugTracker: {
open: "https://github.com/rdfjs/data-model-spec/issues?utf8=%E2%9C%93&q=is%3Aissue%20is%3Aopen%20",
Expand Down Expand Up @@ -225,6 +235,7 @@ <h3><dfn>Literal</dfn> interface</h3>
attribute DOMString termType;
attribute DOMString value;
attribute DOMString language;
attribute DOMString? direction;
attribute NamedNode datatype;
boolean equals(optional Term? other);
};
Expand All @@ -241,11 +252,17 @@ <h3><dfn>Literal</dfn> interface</h3>
<dfn>language</dfn> the language as lowercase [[BCP47]] string (examples:
<code>"en"</code>, <code>"en-gb"</code>) or an empty string if the literal has no language.
</p>
<p>
<dfn>direction</dfn> is not falsy if the string is a directional language-tagged string.
In this case, the <code>direction</code> MUST be either be <code>"ltr"</code> or <code>"rtl"</code>.
</p>
<p>
<dfn>datatype</dfn> a <code>NamedNode</code> whose IRI represents the datatype of the literal.
</p>
<p>
If the literal has a language, its datatype has the IRI
If the literal has a language and a direction, its datatype has the IRI
<code>"http://www.w3.org/1999/02/22-rdf-syntax-ns#dirLangString"</code>.
If the literal has a language without direction, its datatype has the IRI
<code>"http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"</code>. Otherwise, if no
datatype is explicitly specified, the datatype has the IRI
<code>"http://www.w3.org/2001/XMLSchema#string"</code>.
Expand All @@ -254,7 +271,8 @@ <h3><dfn>Literal</dfn> interface</h3>
<dfn>equals()</dfn> returns <code>true</code> if
all general <a>Term.equals</a> conditions hold,
<code>term.value</code> is the same string as <code>other.value</code>,
<code>term.language</code> is the same string as <code>other.language</code>, and
<code>term.language</code> is the same string as <code>other.language</code>,
<code>term.direction</code> is the same string as <code>other.direction</code> or are both falsy, and
<code>term.datatype.equals(other.datatype)</code> evaluates to <code>true</code>;
otherwise, it returns <code>false</code>.
</p>
Expand Down Expand Up @@ -383,13 +401,19 @@ <h3><dfn>DataFactory</dfn> interface</h3>
interface DataFactory {
NamedNode namedNode(DOMString value);
BlankNode blankNode(optional DOMString value);
Literal literal(DOMString value, optional (DOMString or NamedNode) languageOrDatatype);
Literal literal(DOMString value, optional (DOMString or NamedNode or DirectionalLanguage) languageOrDatatype);
Variable variable(DOMString value);
DefaultGraph defaultGraph();
Quad quad(Term subject, Term predicate, Term _object, optional Term? graph);
Term fromTerm(Term original);
Quad fromQuad(Quad original);
};

[Exposed=(Window,Worker)]
interface DirectionalLanguage {
attribute DOMString language;
attribute DOMString? direction;
};
</pre>

<p>
Expand All @@ -404,10 +428,13 @@ <h3><dfn>DataFactory</dfn> interface</h3>
parameter is undefined a new identifier for the blank node is generated for each call.
</p>
<p>
<dfn>literal()</dfn> returns a new instance of <code>Literal</code>. If
<code>languageOrDatatype</code> is a <code>NamedNode</code>, then it is used for the value of
<code>datatype</code>. Otherwise <code>languageOrDatatype</code> is used for the value of
<code>language</code>.
<dfn>literal()</dfn> returns a new instance of <code>Literal</code>.
If <code>languageOrDatatype</code> is a <code>NamedNode</code>,
then it is used for the value of <code>datatype</code>.
If <code>languageOrDatatype</code> is a <code>DirectionalLanguage</code>,
then its <code>language</code> and <code>direction</code> attributes
are respectively used for the literal's <code>language</code> and <code>direction</code>, where <code>direction</code> is optional or can be falsy.
Otherwise <code>languageOrDatatype</code> is used for the value of <code>language</code>.
</p>
<p>
<dfn>variable()</dfn> returns a new instance of <code>Variable</code>. This method is
Expand Down