You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As seen in the current webr3/master c79068c on Node.js v0.3.3-pre 1a894b39b3c622e7c7d228c049e68b65e4334ee5 (with a js3.js file as seen below symlinked to js3.node.js, though it doesn't seem to make a difference), and in Chromium 8.0.552.224 (0)
The .toNT() and the .graphify() functions don't seem to output all of the triples that are present within the structure.
DATA NT
_:songs "0" _:b1 .
_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> _:song .
_:songs "1" _:b2 .
_:songs "2" _:b3 .
(Graphify shows the same thing)
In addition to the actual output, NT should be outputting
_:b2 dc:title _:song .
_:b3 rdf:type _:song .
If the object to those triples is modified, the triple is output. I suspect it has something to do with the index thing the functions use.
Also, shouldn't an Array be parsed as an RDF Container? And adding .toList() before or after .ref(...) only adds the triple
_:songs "list" "true"^^http://www.w3.org/2001/XMLSchema#boolean .
which seems to be wrong, replacing .ref(...) with .toList() makes .toNT() and .graphify() non-functional ("no method 'graphify'"). Clearly these functions need work?
The problem lies on node.js3.js:268 (or rather, source/core.js:36 it looks like) where triple.subject.value and triple.property.value is always the string "function () { return this; }". Replacing with triple.property.toString() as seen below appears to fix the problem, though I'm not sure if avoiding that was deliberate.
add: function(triple) {
if(!this.index[triple.subject.toString()]) this.index[triple.subject.toString()] = {};
if(!this.index[triple.subject.toString()][triple.property.toString()]) this.index[triple.subject.toString()][triple.property.toString()] = [];
if(this.index[triple.subject.toString()][triple.property.toString()].some(function(o){return o.equals(triple.object)})) return;
this.length++;
this.index[triple.subject.toString()][triple.property.toString()].push(triple.object);
this.graph.push(triple);
},
Actually, .toString(), .value(), and removing .value entirely all seem to work equally as well. Since .value() just returns this I'll will be taking it out entirely.
The text was updated successfully, but these errors were encountered:
As seen in the current webr3/master c79068c on Node.js v0.3.3-pre 1a894b39b3c622e7c7d228c049e68b65e4334ee5 (with a js3.js file as seen below symlinked to js3.node.js, though it doesn't seem to make a difference), and in Chromium 8.0.552.224 (0)
The .toNT() and the .graphify() functions don't seem to output all of the triples that are present within the structure.
Example code:
require('js3');
Actual Output:
DATA n3
_:songs 0 [ rdf:type _:song ];
1 [ dc:title _:song ];
2 [ rdf:type _:song ] .
(Graphify shows the same thing)
In addition to the actual output, NT should be outputting
_:b2 dc:title _:song .
_:b3 rdf:type _:song .
If the object to those triples is modified, the triple is output. I suspect it has something to do with the index thing the functions use.
Also, shouldn't an Array be parsed as an RDF Container? And adding .toList() before or after .ref(...) only adds the triple
_:songs "list" "true"^^http://www.w3.org/2001/XMLSchema#boolean .
which seems to be wrong, replacing .ref(...) with .toList() makes .toNT() and .graphify() non-functional ("no method 'graphify'"). Clearly these functions need work?
The problem lies on node.js3.js:268 (or rather, source/core.js:36 it looks like) where triple.subject.value and triple.property.value is always the string "function () { return this; }". Replacing with triple.property.toString() as seen below appears to fix the problem, though I'm not sure if avoiding that was deliberate.
add: function(triple) {
if(!this.index[triple.subject.toString()]) this.index[triple.subject.toString()] = {};
if(!this.index[triple.subject.toString()][triple.property.toString()]) this.index[triple.subject.toString()][triple.property.toString()] = [];
if(this.index[triple.subject.toString()][triple.property.toString()].some(function(o){return o.equals(triple.object)})) return;
this.length++;
this.index[triple.subject.toString()][triple.property.toString()].push(triple.object);
this.graph.push(triple);
},
Actually, .toString(), .value(), and removing .value entirely all seem to work equally as well. Since .value() just returns
this
I'll will be taking it out entirely.The text was updated successfully, but these errors were encountered: