rdfjs/N3.js

Improve N3Writer Support For Gist Style Guide Instances

svirgilgood opened this issue · 4 comments

According to the Gist Style guide (and other conventions), Instance local names start with an underscore, the N3Writer currently expects all prefixed local names to start with an alphabetic character.

Is there a reason we wouldn't want underscores to be recognized by this Regex?

This issue has been addressed in this pr

jeswr commented

Is there a reason we wouldn't want underscores to be recognized by this Regex?

Underscores are not allowed at the start of a prefix according to the turtle production grammar and I don't imagine any other grammars for the RDF syntaxes supported by this library would be different (though if they are any please correct me!).

I am sorry for the confusion: its an underscore at the start of a local name. For example: https://example.org/_instance_1.
I think the N3Writer should produce the following:

@prefix ex: <https://example.org/> .

ex:_instance_1 a ex:ExampleClass .

But with the current implementation the writer would produce the following:

@prefix ex: <https://example.org/> . 

<https://example.org/_instance_1>  a ex:ExampleClass .

@e2dubba --

Both your "should" and "current" examples include the invalid @prefix <https://example.org/> .

I'm guessing that was intended to be @prefix : <https://example.org/> . but I'm not certain.

This error makes me wonder if there are other errors in your comment, which I suggest you review and revise to be certain it's saying what you intend.

@TallTed, thank you for pointing out the typos in my comment. I had forgotten to include the prefix (the very thing we are talking about). But it is corrected now.