-
Notifications
You must be signed in to change notification settings - Fork 133
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
feat/rdfstar support #311
feat/rdfstar support #311
Changes from 7 commits
2f7d6e8
37ab09c
f837b8d
da945e9
624e3e1
d27b920
2af5e05
0ac4c46
0337ed8
99d6b72
d258f22
56cc184
2f0f57d
0539be9
e7646d9
6140e86
bec8395
8ce8428
211bf07
4489772
c76f3fd
8a6dcbb
7df44bc
545e646
90e15b9
6907296
73791d8
8e3b997
2e655fb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -188,6 +188,10 @@ export class DefaultGraph extends Term { | |
DEFAULTGRAPH = new DefaultGraph(); | ||
|
||
// ### Constructs a term from the given internal string ID | ||
// The third 'nested' parameter of this function is to aid | ||
// with recursion over nested terms. It should not be used | ||
// by consumers of this library. | ||
// See https://github.com/rdfjs/N3.js/pull/311#discussion_r1061042725 | ||
export function termFromId(id, factory, nested) { | ||
factory = factory || DataFactory; | ||
|
||
|
@@ -230,6 +234,10 @@ export function termFromId(id, factory, nested) { | |
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Questions for the future:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Any use of the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh actually - I think I see more what you're saying is that quads could just use a set of ids/hashes in the internal representation that are then looked up. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
But that could be an internal function then indeed! |
||
|
||
// ### Constructs an internal string ID from the given term or ID string | ||
// The third 'nested' parameter of this function is to aid | ||
// with recursion over nested terms. It should not be used | ||
// by consumers of this library. | ||
// See https://github.com/rdfjs/N3.js/pull/311#discussion_r1061042725 | ||
export function termToId(term, nested) { | ||
if (typeof term === 'string') | ||
return term; | ||
|
@@ -248,8 +256,6 @@ export function termToId(term, nested) { | |
term.language ? `@${term.language}` : | ||
(term.datatype && term.datatype.value !== xsd.string ? `^^${term.datatype.value}` : '')}`; | ||
case 'Quad': | ||
// To identify RDF-star quad components, we escape quotes by doubling them. | ||
// This avoids the overhead of backslash parsing of Turtle-like syntaxes. | ||
const res = [ | ||
termToId(term.subject, true), | ||
termToId(term.predicate, true), | ||
|
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.
@jeswr In what cases should
nested
be true? Is it the same asrdfStar
basically?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.
It is really just an internal parameter that is used when recursively calling
termFromId
onquad
terms within other quads.The only place that parameter should ever be used is
N3.js/src/N3DataFactory.js
Lines 224 to 229 in 56cc184
So no this is not an
rdfStar
parameter because this should still be false/undefined on the asserted triple.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've added a comment clarifying this
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.
So only by itself; gotcha.