Code Monkey home page Code Monkey logo

Comments (1)

nicholascar avatar nicholascar commented on September 24, 2024

Hi @marrog, I can confirm this is a real issue.

It occurs because csvwlib binds a whole pile of prefixes & namespaces to the rdflib Graph() (see https://github.com/DerwenAI/csvwlib/blob/master/csvwlib/utils/rdf/Namespaces.py#L13) and then the rdflib-jsonld serializer puts everything in the graph's namespaces list into the context (see https://github.com/RDFLib/rdflib-jsonld/blob/master/rdflib_jsonld/serializer.py#L116). This only occurs for JSON-LD and not any other "default" RDF format because the serializers are completely independent.

A real solution here would be to introduce a checker into the rdflib-jsonld code to ensure only used namespaces are placed into Context. Another solution would be to do a similar thing in csvwlib i.d. only bind used prefixes to the graph.

While I think either or both could be done, I would have to check if it's expected JSON-LD behaviour: perhaps there is no requirement that context be limited in this way - to used context elements only - and there may even be reasons why it's not desired, but I suspect that it is not desired behaviour.

Sorry I don't know already, I'm pretty new to JSON-LD as I'm actually one of the rdflib maintainers and have sort of inherited rdflib-jsonld.

I'm not going to be able to fix this any time soon - I'm preoccupied with merging rdflib-jsonld into rdflib main library and adding JSON-LD 1.1 support - so I'd love any external contributions for this.

from rdflib-jsonld.

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.