Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Json ld #147

Merged
merged 21 commits into from
Sep 28, 2021
Merged

Json ld #147

merged 21 commits into from
Sep 28, 2021

Conversation

antony-wilson
Copy link
Collaborator

@antony-wilson antony-wilson commented Sep 22, 2021

This branch adds functionality to get the provenance report in a JSON-LD format.
As part of this namespaces were added to the report:

  prefix lreg <http://localhost:8000/>
  prefix reg <https://data.scrc.uk/>
  prefix fair <https://data.scrc.uk/vocab/#>
  prefix dcat <http://www.w3.org/ns/dcat#>
  prefix dcmitype <http://purl.org/dc/dcmitype/>
  prefix dcterms <http://purl.org/dc/terms/>
  prefix foaf <http://xmlns.com/foaf/spec/#>

N.B. Either the lreg or reg namespace will be used depending on if the register is local.
The fair namespace is used for terms not in the other vocabs.

In order to determine is this is a local registry and to provide a central namespace for vocal terms the variable CENTRAL_REGISTRY_URL was added to the settings files.

An additional requirement of rdflib-jsonld has been added.
The version of rdflib has been increased to 6.0.1, this include what was the rdflib-jsonld package.

In the views module there is a new renderer for JSON-LD also the comments have been restructured to improve their display on the API page.

@codecov
Copy link

codecov bot commented Sep 22, 2021

Codecov Report

Merging #147 (1453bcf) into main (4e76552) will increase coverage by 2.00%.
The diff coverage is 95.74%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #147      +/-   ##
==========================================
+ Coverage   51.95%   53.96%   +2.00%     
==========================================
  Files          18       18              
  Lines         995     1047      +52     
==========================================
+ Hits          517      565      +48     
- Misses        478      482       +4     
Flag Coverage Δ
unittests 53.96% <95.74%> (+2.00%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
data_management/prov.py 97.84% <95.40%> (-2.16%) ⬇️
data_management/rest/views.py 78.30% <100.00%> (+0.74%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4e76552...1453bcf. Read the comment docs.

@antony-wilson antony-wilson marked this pull request as ready for review September 23, 2021 09:40
@antony-wilson antony-wilson requested a review from a user September 23, 2021 09:40
@ghost
Copy link

ghost commented Sep 23, 2021

I get a 500 error when I try to navigate to (for example) http://localhost:8000/api/prov-report/1/?format=json-ld

I'll have a look at the debug output after lunch in case I'm doing something wrong.

@antony-wilson
Copy link
Collaborator Author

I get a 500 error when I try to navigate to (for example) http://localhost:8000/api/prov-report/1/?format=json-ld

I'll have a look at the debug output after lunch in case I'm doing something wrong.

Did you install rdflib-jsonld?

@ghost
Copy link

ghost commented Sep 23, 2021

Ah, no. Do you know how to install it for Mac? I've had a quick google and there's no Homebrew version that I can see.

@antony-wilson
Copy link
Collaborator Author

you should be able to pip install it

@ghost
Copy link

ghost commented Sep 23, 2021

Ah ok, found the issue. It's not to pip install rdflib-jsonld. This has been deprecated and we should use the rdflib package, which we already do, but update it to version 6.0.1. I'll make this change and push it.

@ghost
Copy link

ghost commented Sep 23, 2021

Ok, cool. Not an exhaustive test but I installed fresh from this branch directly, used the add_example_data function and then was able to generate json_ld reports for the couple of data products that I checked. Thanks @antony-wilson !

@ghost
Copy link

ghost commented Sep 23, 2021

Should we also update the requirements.txt for the remote registry, just for consistency? Possibly a question for @alahiff ?

@sonarcloud
Copy link

sonarcloud bot commented Sep 28, 2021

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
1.1% 1.1% Duplication

@ghost ghost mentioned this pull request Sep 28, 2021
@antony-wilson antony-wilson merged commit 9d4352e into main Sep 28, 2021
@ghost ghost deleted the json_ld branch September 28, 2021 09:31
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