Code Monkey home page Code Monkey logo

Comments (3)

 avatar commented on June 10, 2024

I'm looking into implementing this using RDFLib/rdflib-jsonld#63 as a starting point. In that code HTML parsing is attempted after JSON parsing fails, but I'm looking at choosing the parse using the content type of the source.

I see that the the JSON-LD test suite in "test/jsonld/1.1" already provides a number of tests which just need to be enabled.

from rdflib.

 avatar commented on June 10, 2024

FYI: I'm occasionally working on this at https://github.com/wallberg-umd/rdflib/tree/issue-2692-embedded-jsonld-draft . I've added the basic functionality and enabled the existing tests. I'm now working through making the tests pass.

from rdflib.

wallberg avatar wallberg commented on June 10, 2024

I've completed an initial implementation for this issue, see https://github.com/wallberg/rdflib/tree/issue-2692-embedded-jsonld .

It contains one breaking change: when rdflib.plugins.shared.jsonld.util.source_to_json extracts JSON-LD from HTML, it needs to return the value of the HTML base element in addition to the JSON. I took the simplest path and returned a tuple containing the JSON and the base.

I can think of other ways to return the base without breaking the current return value:

  1. Return json when processing a json document and (json, base) when processing an html document.
  2. Add an optional parameter to return (json, base) instead of json.
  3. Continue returning only json, but add an optional parameter which will receive the value of base.

I'd like to get some feedback on the preferred approach before submitting the PR.

A note on the current status of validation:

  1. task test passes
  2. task lint passes
  3. task mypy fails, I believe to existing problems in main
  4. poetry run python -m mypy rdflib/plugins/parsers/jsonld.py rdflib/plugins/shared/jsonld/context.py rdflib/plugins/shared/jsonld/util.py test/jsonld/runner.py test/jsonld/test_context.py test/jsonld/test_onedotone.py passes

from rdflib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.