aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMunyoki Kilyungi2023-12-07 10:44:27 +0300
committerBonfaceKilz2023-12-07 16:11:31 +0300
commitc5b72f613ab08dfac258b351e82a8b8bdb4d5369 (patch)
tree429b800e4e46113d8da98be6fc391aeab3b1c089
parentfa4fc7fdeb5d774936ea37c82c9ec017a88b0903 (diff)
downloadgenenetwork3-c5b72f613ab08dfac258b351e82a8b8bdb4d5369.tar.gz
Refactor metadata mappings for improved dataset representation.
* gn3/api/metadata.py: (DATASET_CONTEXT): Remove "ex:" prefixes. Add new prefixes for citation, platform, GoTree, tissueInfo, contactWebUrl and contactName. (datasets): Update query. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
-rw-r--r--gn3/api/metadata.py64
1 files changed, 31 insertions, 33 deletions
diff --git a/gn3/api/metadata.py b/gn3/api/metadata.py
index 2ae615b..24cbf11 100644
--- a/gn3/api/metadata.py
+++ b/gn3/api/metadata.py
@@ -37,21 +37,26 @@ DATASET_CONTEXT = {
"foaf": "http://xmlns.com/foaf/0.1/",
"geoSeriesId": "gnt:hasGeoSeriesId",
"gnt": "http://genenetwork.org/term/",
- "inbredSet": "ex:belongsToInbredSet",
- "info": "ex:info",
+ "inbredSet": "gnt:belongsToGroup",
"label": "rdfs:label",
"normalization": "gnt:usesNormalization",
+ "platformInfo": "gnt:hasPlatformInfo",
"notes": "gnt:hasNotes",
"organization": "foaf:Organization",
- "platform": "ex:platform",
"prefLabel": "skos:prefLabel",
+ "citation": "dct:isReferencedBy",
+ "platform": "gnt:gnt:usePlatform",
+ "GoTree": "gnt:hasGoTreeValue",
"processingInfo": "gnt:hasDataProcessingInfo",
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
"skos": "http://www.w3.org/2004/02/skos/core#",
"specifics": "gnt:hasContentInfo",
- "tissue": "ex:tissue",
"title": "dct:title",
"xkos": "http://rdf-vocabulary.ddialliance.org/xkos#",
+ "tissueInfo": "gnt:hasTissueInfo",
+ "tissue": "gnt:hasTissue",
+ "contactWebUrl": "foaf:homepage",
+ "contactName": "foaf:name",
}
SEARCH_CONTEXT = {
@@ -139,34 +144,27 @@ def datasets(name):
$prefix
CONSTRUCT {
- ?dataset ?predicate ?term ;
- rdf:type dcat:Dataset ;
- rdfs:label ?datasetName ;
- dct:identifier ?accesionId ;
- ex:belongsToInbredSet ?inbredSetName ;
- gnt:usesNormalization ?normalizationLabel ;
- dcat:contactPoint ?investigatorName ;
- xkos:classifiedUnder ?altName ;
- gnt:hasContentInfo ?contentInfo ;
- dct:creator ?contributors ;
- ex:platform ?platform ;
- ex:tissue ?tissue .
+ ?dataset ?predicate ?term .
+ ?inbredSet rdfs:label ?inbredSetName .
?platform ?platformPred ?platformObject ;
- ex:info ?platformInfo .
- ?tissue rdfs:label ?tissueName ;
- rdf:type gnc:tissue ;
- ex:info ?tissueInfo .
+ gnt:hasPlatformInfo ?platformInfo .
+ ?normalization ?normalizationPred ?normalizationObj .
+ ?tissue ?tissuePred ?tissueObj ;
+ gnt:hasTissueInfo ?tissueInfo .
+ ?investigator foaf:name ?investigatorName ;
+ foaf:homepage ?homepage .
+ ?type skos:prefLabel ?altName .
} WHERE {
?dataset rdf:type dcat:Dataset ;
- xkos:classifiedUnder ?inbredSet ;
- rdfs:label ?datasetName ;
+ ?predicate ?term ;
(rdfs:label|dct:identifier|skos:prefLabel) "$name" .
- OPTIONAL { ?dataset dct:identifier ?accesionId . } .
- OPTIONAL { ?dataset dct:creator ?contributors . } .
- OPTIONAL { ?dataset gnt:hasContentInfo ?contentInfo . } .
+ FILTER (!regex(str(?predicate), '(hasTissueInfo)', 'i')) .
+ FILTER (!regex(str(?predicate), '(usesNormalization)', 'i')) .
+ FILTER (!regex(str(?predicate), '(platformInfo)', 'i')) .
OPTIONAL {
?inbredSet ^skos:member gnc:Set ;
- rdfs:label ?inbredSetName .
+ ^gnt:belongsToGroup ?dataset ;
+ rdfs:label ?inbredSetName .
} .
OPTIONAL {
?type ^xkos:classifiedUnder ?dataset ;
@@ -174,25 +172,25 @@ CONSTRUCT {
skos:prefLabel ?altName .
} .
OPTIONAL {
- ?normalization ^gnt:usesNormalization ?dataset ;
- rdfs:label ?normalizationLabel .
- } .
- OPTIONAL {
?investigator foaf:name ?investigatorName ;
+ foaf:homepage ?homepage ;
^dcat:contactPoint ?dataset .
} .
OPTIONAL {
?platform ^gnt:usesPlatform ?dataset ;
?platformPred ?platformObject .
} .
+ OPTIONAL {
+ ?normalization ^gnt:usesNormalization ?dataset ;
+ ?normalizationPred ?normalizationObj .
+ }
OPTIONAL { ?dataset gnt:hasPlatformInfo ?platformInfo . } .
OPTIONAL { ?dataset gnt:hasTissueInfo ?tissueInfo . } .
OPTIONAL {
?dataset gnt:hasTissue ?tissue .
- ?tissue rdfs:label ?tissueName .
+ ?tissue rdfs:label ?tissueName ;
+ ?tissuePred ?tissueObj .
} .
- FILTER (!regex(str(?predicate), '(classifiedUnder|usesNormalization|contactPoint|hasPlatformInfo|tissueInfo)', 'i')) .
- FILTER (!regex(str(?platformPred), '(classifiedUnder|geoSeriesId|hasGoTreeValue)', 'i')) .
}""").substitute(prefix=RDF_PREFIXES, name=name)
_context = {
"@context": BASE_CONTEXT | DATASET_CONTEXT,