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

Support for base direction #32

Closed
gkellogg opened this issue Jun 27, 2023 · 3 comments · Fixed by #34
Closed

Support for base direction #32

gkellogg opened this issue Jun 27, 2023 · 3 comments · Fixed by #34
Labels
spec:substantive Issue or proposed change in the spec that changes its normative content

Comments

@gkellogg
Copy link
Member

Relates to w3c/rdf-concepts#9 and discussed in the Text Direction Proposal.

This will support directional language-tagged strings using the following syntax:

LANGTAG ::= '@' [a-zA-Z]+ ('-' [a-zA-Z0-9]+)* ('--' [a-zA-Z0-9]+)?`

This adds some text to 2.4 RDF Literals to allow base direction and an additional triple to EXAMPLE 4. Also, additional rules in 6.1 RDF Term Constructors.

@gkellogg gkellogg added the spec:substantive Issue or proposed change in the spec that changes its normative content label Jun 27, 2023
@gkellogg
Copy link
Member Author

Alternatively, we could recognize only the directions ltr or rtl.

LANGTAG ::= '@' [a-zA-Z]+ ('-' [a-zA-Z0-9]+)* ('--' ('ltr'|'rtl'))?`

which would be matched in a case-sensitive manner, which reduces runtime checks at the expense of parse errors which could convey less meaningful error messages.

@pfps
Copy link
Contributor

pfps commented Jun 27, 2023

See #33

@afs
Copy link
Contributor

afs commented Jun 28, 2023

SPARQL is a bit more sensitive to the choice because of use in triple patterns and also in expressions.

There is a case of the sequence --1 (no spaces) being legal syntax in an expression. It has a non-nonsensical meaning. --1 is subtraction of a negative number: - (-1). As the left hand side is a directional language tagged string and the right hand side is a number, subtraction is an evaluation error.

It is easy to avoid by having no numbers in the direction part, c.f. the first subtag "language".

LANGTAG ::= '@' [a-zA-Z]+ ('-' [a-zA-Z0-9]+)* ('--' [a-zA-Z]+)?`

My preference is to have the ltr,rtl check happen the same way that the requirement to be a legal language tag happens.

gkellogg added a commit that referenced this issue Jun 29, 2023
…m construtors for creating directional language-tagged strings.

Fixes #32.
gkellogg added a commit that referenced this issue Sep 25, 2023
…m construtors for creating directional language-tagged strings.

Fixes #32.
gkellogg added a commit that referenced this issue Oct 13, 2023
* Adds BNF and text to extend LANGTAG to support base direction and term construtors for creating directional language-tagged strings. Fixes #32.
* Update spec/ntriples.bnf
* Rename `LANGTAG` to `LANG_DIR` and improve description.
* Chanage `langTag` class to `langDir`.
* Use code for codepoints, and clarify the code points used for '--'
* Update character representation and fix BNF issues based on similar changes to Turtle.
* Fix some missing local references.

---------

Co-authored-by: Andy Seaborne <andy@apache.org>
Co-authored-by: Ted Thibodeau Jr <tthibodeau@openlinksw.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
spec:substantive Issue or proposed change in the spec that changes its normative content
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants