Skip to content
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

Generator.stringify() is broken in 3.0.0-beta.0 #90

Closed
white-gecko opened this issue Aug 22, 2019 · 4 comments
Closed

Generator.stringify() is broken in 3.0.0-beta.0 #90

white-gecko opened this issue Aug 22, 2019 · 4 comments
Assignees
Labels

Comments

@white-gecko
Copy link
Contributor

So far I was using the sparqljs Generator to create SPARQL Update strings in the following way:

var sparqljs = require("sparqljs@2.2.3")
var updateStructure = {"type":"update","updates":[{"updateType":"insert","insert":[{"triples":[{"subject":"http://aksw.org/NatanaelArndt","predicate":"http://xmlns.com/foaf/0.1/name","object":"\"Natanael Arndt\"","graph":""}],"type":"graph","name":"http://aksw.org/"}]}]}
var generator = new sparqljs.Generator()
var updateString = generator.stringify(updateStructure)
console.log(updateString)

The actual and expected output was (can be reproduced on https://npm.runkit.com/sparqljs):

INSERT DATA { GRAPH <http://aksw.org/> { <http://aksw.org/NatanaelArndt> <http://xmlns.com/foaf/0.1/name> "Natanael Arndt". } }

Since the update to 3.0.0-beta.0 I get the error value.items is undefined in this line:

var items = value.items.map(this.toEntity, this), path = value.pathType;

This can be reproduced with the following code on https://npm.runkit.com/sparqljs

var sparqljs = require("sparqljs@3.0.0-beta.0")
var updateStructure = {"type":"update","updates":[{"updateType":"insert","insert":[{"triples":[{"subject":"http://aksw.org/NatanaelArndt","predicate":"http://xmlns.com/foaf/0.1/name","object":"\"Natanael Arndt\"","graph":""}],"type":"graph","name":"http://aksw.org/"}]}]}
var generator = new sparqljs.Generator()
var updateString = generator.stringify(updateStructure)
console.log(updateString)

This issue/new behavior must have been introduced with #80

@RubenVerborgh
Copy link
Owner

Note that 3.0.0 is a major version update, which comes with API breakage.

We have switched the representation of triples components from strings to RDF/JS-compatible objects. An example is in the README: https://github.com/RubenVerborgh/SPARQL.js#representation

The input value you are providing is still the old input format, which will only work with 2.x versions.

You could migrate to the new input by having 2.x generate the SPARQL query, and then letting 3.x parse it.

@white-gecko
Copy link
Contributor Author

ok, so it is intended to not support strings for the graph iri in this place anymore?

@RubenVerborgh
Copy link
Owner

Indeed, this has been deprecated in favor of RDF/JS.

@white-gecko
Copy link
Contributor Author

Thank you for the clarification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants