-
Notifications
You must be signed in to change notification settings - Fork 146
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
Improve typing of DataFactory #406
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works mostly ok with maslib - there's one bug though, which is that it requires termToNQ
in canonical-data-factory.ts to handle terms that are graphs. I think a possible solution is to handle GraphTermType
same as NamedNodeTermType
, but I'm not well versed enough in RDF to know for certain.
If you could fix the handling of terms with type 'Graph', I think we're all good with this PR.
I've invited @timbl to review this as well, as he is very interested in how we handle types in rdflib.
Sorry, I don't fully understand:
Do you have a code example of what breaks? |
Sorry for my imprecisessness - if I build the data browser with the current changes, I get the following error:
I've pushed a possible solution to feature/extended-typing-toNQ-fix, but not sure if this is correct. |
This comment has been minimized.
This comment has been minimized.
Ok seems like we're still doing
stuff, which we really should not. However, my main mission was to unblock you on #397, which I think I've achieved. I think the route for fixing the problem is getting rid of |
Should we create a ticket to track this?
Yes, thank you again 😸
Yeah, I think we should create a ticket to track the issue, and then remove the hack introduced in feature/extended-typing-toNQ-fix. I've created #407 that can be merged when everything's in order. |
Just my 2cents, but perhaps this strange looking 'Graph' type is one of the N3 types that Tim mentioned were extensions to the standard RDF types...!? |
It's a misnomer in any case then. Notation3 has formulas. |
N3 has things it calls formulas and other people call graphs. So not really a misnomer. (Like Symbol/NamedNode, Formula/Graph, Statement/Arc, etc these are differences between talking about it as a logic language and as a graph. It is useful to be able to look at it either way, as for core RDF a lot of people thing of the graph, but for N3 you have a language which is clean superset of the RDF but where is more than a graph) I suspect the solution is to check if the given thing is of termtype Graph, and if so raise a run time value error, saying ' This is N3 data, it is too complex to be serialized as an NQuad item" or words to that effect. I always thought we would need run-time errors when we build the system which mix N3 and and base RDF. It is fine to have people use rdflib.hs most of the time for plain RDF, but it would be be bad for the types they are using not t allow them to be able to express more complex things wher ethey ned to. JUst f they try to serialize a query or a rule etc in say turtle ot RDF/XML the system will raise a run time error not a compile time type mismatch. |
I think a specific termtype for Graphs are identified by URIs (or blank nodes), so I'm missing arguments as to why they would be a separate thing. As a note, N3.js parses Notation3 and remains within the RDF/JS model. |
I've noticed #404, maybe it would be possible to have rdflib.js stick to RDF and have distinct n3.js depend on it and extend it with N3 specific functionality. I can imagine developers intending to use rdflib.js to handle RDF getting confused if they see some N3 errors thrown at them. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is ready to be merged into master. Does anyone object to this? (Pinging @timbl)
This is breaking change, but think this is what Tim wants
I think this should conform to RDF/JS spec and still make sure that rdflib works as expected
f609159
to
2e3e22c
Compare
Seems that we need to fix one more type error that was hidden with Will try to fix this tonight to get this merged and a new version of rdflib released. |
An ugly fix possible, pushed as #414. If this is ok, I think I should be able to merge this to master and release a new version of rdflib. |
…al-hack An ugly hack to make Literal.fromValue compatible with Node.fromValue
No description provided.