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

rdflib includes jsonparser.js but it doesn't appear to be used #87

Open
jamsden opened this issue Nov 17, 2015 · 1 comment
Open

rdflib includes jsonparser.js but it doesn't appear to be used #87

jamsden opened this issue Nov 17, 2015 · 1 comment

Comments

@jamsden
Copy link

jamsden commented Nov 17, 2015

In web.js, function parse(str, kb, base, contentType, callback) handles contentType application/ld+json by using JSON.parse to parse the JSON document, use jsonld.toRDF to convert the jsonDocument o application/nquads, then re-parses the nquads with the n3Parser - causing the text to be parsed twice in two different formats.

File jsonparser.js defines the $rdf.jsonParser which would seem to parse the JSON or JSON-LD directly into the kb without going through the extra format conversion. However, I can't find anyplace this parser is used. What is this parser intended to be used for, and why isn't used in the parse function?

@josephguillaume
Copy link

parse now uses https://github.com/linkeddata/rdflib.js/blob/7c17060/src/jsonldparser.js, which is an improvement (#349), and jsonParser is still not used or documented.

It appears the data input to parseJSON is an object of form:

      {
        subject1: {
          predicate1: { value: "value1", type: "uri|BlankNode|Literal" }
        }
      };

Subjects, predicates and source need to be valid URIs. datatype and lang are also supported in the value object

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

No branches or pull requests

2 participants