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

Delete inactive grant relationships and associated metadata #41

Open
paulalbert1 opened this issue Dec 7, 2021 · 0 comments
Open

Delete inactive grant relationships and associated metadata #41

paulalbert1 opened this issue Dec 7, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@paulalbert1
Copy link
Contributor

paulalbert1 commented Dec 7, 2021

Problem

RAC has an unfortunate habit of removing grants from the InfoEd view. The existing code removes the grants (mostly) from VIVO but not the role data. This leads to seeing the missing activity data error like so...

Screen Shot 2021-12-07 at 3 20 06 PM

Analysis

When we run this query against InfoEd, we get 7,965 roles on grants.

select CWID, Account_Number from WC_InfoEdProd_Integration.dbo.VIVO
where Confidential = 'N'

We can identify all grant roles in VIVO using this query.

PREFIX core: <http://vivoweb.org/ontology/core#> 
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wcmc: <http://weill.cornell.edu/vivo/ontology/wcmc#>
PREFIX vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#>
PREFIX obo: <http://purl.obolibrary.org/obo/> 
select ?s ?o
{
      GRAPH <http://vitro.mannlib.cornell.edu/a/graph/wcmcCoeus> { ?s <http://purl.obolibrary.org/obo/RO_0000053> ?o . }
}

There are 357 roles in the second query but not the first. All these roles, and their associated metadata need to be deleted from VIVO: GrantRolesToDelete-2021-12-07.csv

Here's an example query that lists the associated metadata for expired grant role data in VIVO.

PREFIX core: <http://vivoweb.org/ontology/core#> 
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wcmc: <http://weill.cornell.edu/vivo/ontology/wcmc#>
PREFIX vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#>
PREFIX obo: <http://purl.obolibrary.org/obo/> 
select ?p ?o
{
      GRAPH <http://vitro.mannlib.cornell.edu/a/graph/wcmcCoeus> { <https://vivo.med.cornell.edu/individual/role-kp-0000040134-yui4001> ?p ?o . }
}

Requirement

Kindly delete role data when grants are in VIVO but no longer in the InfoEd view. This should remove the dreaded "missing activity" error.

More info

Here is the format of some queries I used to delete incorrect triples:

curl -i -d '[email protected]' -d 'password=XXXXXXX' -d 'update=PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX core: <http://vivoweb.org/ontology/core#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX wcmc: <http://weill.cornell.edu/vivo/ontology/wcmc#> PREFIX vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#> PREFIX obo: <http://purl.obolibrary.org/obo/> DELETE DATA { GRAPH <http://vitro.mannlib.cornell.edu/a/graph/wcmcCoeus> { <https://vivo.med.cornell.edu/individual/cwid-hgp2001> <http://purl.obolibrary.org/obo/RO_0000053>  <https://vivo.med.cornell.edu/individual/role-pisa-0000050069-hgp2001> . }}' 'http://XXXXXXX/api/sparqlUpdate'


curl -i -d '[email protected]' -d 'password=XXXXXXX' -d 'update=PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX core: <http://vivoweb.org/ontology/core#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX wcmc: <http://weill.cornell.edu/vivo/ontology/wcmc#> PREFIX vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#> PREFIX obo: <http://purl.obolibrary.org/obo/> DELETE DATA { GRAPH <http://vitro.mannlib.cornell.edu/a/graph/wcmcCoeus>  {  <https://vivo.med.cornell.edu/individual/cwid-zhz9010> <http://vivoweb.org/ontology/core#relatedBy> <https://vivo.med.cornell.edu/individual/grant-0000039922> . }}' 'http://XXXXXXX/api/sparqlUpdate'
@paulalbert1 paulalbert1 added the bug Something isn't working label Dec 7, 2021
@paulalbert1 paulalbert1 changed the title Delete inactive grants relationships and associated metadata Delete inactive grant relationships and associated metadata Dec 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants