EMMC-ASBL / tripper

Triplestore wrapper package for Python.
https://EMMC-ASBL.github.io/tripper
MIT License
6 stars 2 forks source link

Add better and more convenient support for rdf:JSON datatype #228

Closed jesper-friis closed 1 month ago

jesper-friis commented 2 months ago

Description

This PR makes it easy to represent JSON-serialisable Python objects (like lists and dicts) as literals of datatype rdf:JSON. The following is now possible:

>>> from tripper import Literal
>>> literal = Literal({'a': 1, 'b': 2})
>>> literal.value
{'a': 1, 'b': 2}
>>> literal.n3()
'"{"a": 1, "b": 2}"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#JSON>'

Type of change

Checklist for the reviewer

This checklist should be used as a help for the reviewer.

codecov[bot] commented 2 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 78.35%. Comparing base (2172204) to head (a398386). Report is 1 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #228 +/- ## ========================================== + Coverage 78.16% 78.35% +0.19% ========================================== Files 18 18 Lines 1708 1723 +15 ========================================== + Hits 1335 1350 +15 Misses 373 373 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.