Skip to content

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

Merged
jesper-friis merged 16 commits intomasterfrom
json-literal
Aug 16, 2024
Merged

Add better and more convenient support for rdf:JSON datatype#228
jesper-friis merged 16 commits intomasterfrom
json-literal

Conversation

@jesper-friis
Copy link
Contributor

@jesper-friis jesper-friis commented Jun 28, 2024

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

  • Bug fix and code cleanup
  • New feature
  • Documentation update
  • Testing

Checklist for the reviewer

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

  • Is the change limited to one issue?
  • Does this PR close the issue?
  • Is the code easy to read and understand?
  • Do all new feature have an accompanying new test?
  • Has the documentation been updated as necessary?
  • Is the code properly tested?

@jesper-friis jesper-friis marked this pull request as draft June 28, 2024 15:15
@codecov
Copy link

codecov bot commented Jun 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

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

Additional details and impacted files
@@            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              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jesper-friis jesper-friis changed the title WIP: Add better and more convenient support for RDF:JSON datatype Add better and more convenient support for RDF:JSON datatype Aug 15, 2024
@jesper-friis jesper-friis marked this pull request as ready for review August 15, 2024 15:16
@jesper-friis jesper-friis changed the title Add better and more convenient support for RDF:JSON datatype Add better and more convenient support for rdf:JSON datatype Aug 15, 2024
Copy link
Contributor

@francescalb francescalb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good.

@jesper-friis jesper-friis merged commit 40c5a57 into master Aug 16, 2024
@jesper-friis jesper-friis deleted the json-literal branch August 16, 2024 14:34
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

Successfully merging this pull request may close these issues.

2 participants