Comments (3)
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.
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.
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:
- Return
json
when processing a json document and(json, base)
when processing an html document. - Add an optional parameter to return
(json, base)
instead ofjson
. - Continue returning only
json
, but add an optional parameter which will receive the value ofbase
.
I'd like to get some feedback on the preferred approach before submitting the PR.
A note on the current status of validation:
task test
passestask lint
passestask mypy
fails, I believe to existing problems in mainpoetry 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)
- Unable to embed rdflib in a python extension
- Bug when using FROM statements HOT 4
- Bug: Comparison and arithmetic on xsd:duration HOT 1
- SPARQL Subquey parse error HOT 5
- typo in Container method name: type_of_conatiner --> type_of_container
- Incorrect working when deleting triplets in a BerkeleyDB store HOT 1
- Graph.parse: Guess format when remote source content type is "text/plain"
- Optional skolemize blank nodes on parse HOT 3
- json-ld serialize doesnt failt or raise warning, when producing invalid syntax; type is literal HOT 7
- FAILED test/test_misc/test_parse_file_guess_format.py::TestFileParserGuessFormat::test_warning HOT 2
- RFE: move away from deprecated `html5lib` HOT 1
- BUG : jsonld parser does not randomise bnodes when using local _prefixed identifiers `"@id": "_:mybnode01"` HOT 1
- Adding a value as a list to the graph HOT 4
- Bug in `longturtle` serialization HOT 2
- Rdflib 7.0.0: Inadequate Support for Importing Multiple Prefixes with the Same IRI and Base IRI HOT 2
- Unexpected recursive context inclusion exception HOT 2
- Bug: Unexpected namespace creation during turtle file serialization HOT 4
- Using `orjson` instead of default `json` library HOT 1
- Error when parsing turtle file
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rdflib.