-
Notifications
You must be signed in to change notification settings - Fork 126
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
N3Parser should allow literal subjects #26
Comments
http://www.w3.org/TR/2014/REC-rdf11-concepts-20140225/#section-triples |
@tibotiber As @akuckartz says, subjects and predicates cannot be literals in RDF. However, do you have a reference whether they are allowed in N3? |
There is a table with a header "Literal subj" which indicates that N3 allows literals as subjects |
Indeed, I think I'll allow that too then. Note that the table is obsolete, though. For instance, Turtle supports numeric literals now (but no literal subjects). |
Hi all, sorry for missing out. Thanks for looking this up and I will look forward to this update. |
I have tried this with the following code: var N3 = require('n3');
var store = new N3.Store();
store.addTriple('a', 'b', '"c"');
store.addTriple('"a"', 'b', 'c');
console.log(store.find('"a"', null, null)); This works as expected. Also, nothing in the @tibotiber What problem do you encounter adding triples with a literal as subject/predicate? |
After a day of fixing, this issue would be the only showstopper for version 0.3.0. |
Woaw, I was not paying attention to emails on a good sunday and what a surprise bunch of issue solving I find this morning. Great job! :) I will try to find time later this week to check all of your updates. On this particular one since it is the showstopper, some more info below, sorry for not posting earlier. var parser = N3.Parser();
parser.parse(stream, function (error, triple, prefixes) {
if(!error) {
// add triples to the store
if (triple)
store.addTriple(triple);
else
//done parsing triples
cb(null);
} else {
cb(error);
}
}, function(prefix, uri) {
// some other stuff
}); and I get the following error:
Below is the content of line 280:
It seems to be coming from |
That's right, the current parser is a Turtle parser, not (yet) an N3 parser. As such, parsing a triple with a literal in the subject would violate the specification. As the name of the library implies, N3.js will parse N3 at some point, but I have to write a parser then with two distinct modes (Turtle / N3). I will thus close this issue for now and proceed with v0.3.0. |
@RubenVerborgh If I understand this correctly then this issue is not resolved. I therefore suggest to use GitHub milestones instead of closing the issue. |
Well, the issue is part of a larger feature to be implemented. |
Perhaps I could attach a “future” label to this issue? |
I see. I think it is important to make it possible to automatically determine all unresolved issues. A "future" label should do that. |
Fair enough. Here you go 😄 |
Hi! Thanks for the clarification on this matter. No issue with keeping it for later as I have patched it with finer N3 rules. Will look forward to the implementation of that double parser in the future though :). |
This has been supported for some time now. |
Hi Ruben,
It seems that the store accepts literals only for objects, it will refuse them for subjects right? This made my application crash when loading the store with triples parsed from EYE inference results using the following rule.
I have solved it by modifying the rule to
I was wondering whether it would be better to make the store more permissive on this aspect. What do you think?
Thibaut.
The text was updated successfully, but these errors were encountered: