BCODMO / webcomponent_data_viewer

Visualize a Frictionless Data Package
0 stars 1 forks source link

Update the Field Information with KG data #20

Closed ashepherd closed 3 years ago

ashepherd commented 3 years ago

The datapackage we are presently pointing to is from s3://laminar-dump and eventually will be at s3://bcodmo.files. The workflow for metadata currently is that

1) data is processed and we have minimal dataset parameter info a this stage. 2) DataManager works in OSPREY to update parameter metadata

This means that the OSPREY (and the KG) has more up-to-date information on a dataset's parameters than the datapackage.json from Laminar.

Future Plans: 1) add more parameter info at submit.bco-dmo.org from the submitter 2) consider if parameter defining by DataManager should happen before or as part of Laminar?? 3) As datasets get DOI'd, we start with the datapackage.json from s3://bcodmo.files (moved there from s3://laminar-dump), and update it with OSPREY metadata to create a fully-fleshed out datapackage.json in a public S3 bucket s3://bcodmo.datasets

NOW:

1) Have the web component read the field information from the datapackage.json, but then query the KG and update the field information (linking the information via the shared column header).

KG query for JSON Data: https://lod.bco-dmo.org/sparql?default-graph-uri=http%3A%2F%2Fwww.bco-dmo.org%2F&query=SELECT+DISTINCT+%3Fdp+%3Fname+%3Fdefinition+%3Fdatatype+%3Fformat+%3Funits+%3Fndv+%3Frequires_conversion+%3Fparameter+%3Fp_name+%3Fp_def+%3Fp_units+%3Fp_ndv%0D%0AWHERE+%7B%0D%0A++VALUES+%3Fdataset+%7B+%3Chttp%3A%2F%2Flod.bco-dmo.org%2Fid%2Fdataset%2F3300%3E+%7D%0D%0A++%3Fdataset+odo%3AstoresValuesFor+%3Fdp+.%0D%0A++%3Fdp+skos%3AprefLabel+%3Fname%0D%0A++OPTIONAL+%7B+%3Fdp+skos%3Adefinition+%3Fdefinition+%7D%0D%0A++OPTIONAL+%7B+%3Fdp+odo%3AvalueFormat+%3Fformat+%7D%0D%0A++OPTIONAL+%7B+%3Fdp+odo%3Adatatype+%5B+odo%3AfrictionlessdataDatatype+%3Fdatatype+%5D+%7D%0D%0A++OPTIONAL+%7B+%3Fdp+odo%3AhasNoDataValue+%3Fndv+%7D%0D%0A++OPTIONAL+%7B+%3Fdp+odo%3ArequiresConversion+%3Frequires_conversion+%7D%0D%0A++OPTIONAL+%7B+%3Fdp+odo%3AhasUnitOfMeasure+%5B+rdf%3Avalue+%3Funits+%5D+%7D%0D%0A++OPTIONAL+%7B+%0D%0A++++%3Fdp+odo%3AisInstanceOf+%3Fparameter+.%0D%0A++++%3Fparameter+skos%3AprefLabel+%3Fp_name+.%0D%0A++++%3Fparameter+skos%3Adefinition+%3Fp_def+.%0D%0A++++OPTIONAL+%7B+%3Fparameter+odo%3AhasUnitOfMeasure+%5B+rdf%3Avalue+%3Fp_units+%5D+%7D%0D%0A++++OPTIONAL+%7B+%3Fparameter+odo%3AhasNoDataValue+%3Fp_ndv+%7D%0D%0A++%7D%0D%0A%7D%0D%0AORDER+BY+%3Fdp&format=application%2Fsparql-results%2Bjson&timeout=0

SELECT DISTINCT ?dp ?name ?definition ?datatype ?format ?units ?ndv ?requires_conversion ?parameter ?p_name ?p_def ?p_units ?p_ndv
WHERE {
  VALUES ?dataset { <http://lod.bco-dmo.org/id/dataset/3300> }
  ?dataset odo:storesValuesFor ?dp .
  ?dp skos:prefLabel ?name
  OPTIONAL { ?dp skos:definition ?definition }
  OPTIONAL { ?dp odo:valueFormat ?format }
  OPTIONAL { ?dp odo:datatype [ odo:frictionlessdataDatatype ?datatype ] }
  OPTIONAL { ?dp odo:hasNoDataValue ?ndv }
  OPTIONAL { ?dp odo:requiresConversion ?requires_conversion }
  OPTIONAL { ?dp odo:hasUnitOfMeasure [ rdf:value ?units ] }
  OPTIONAL { 
    ?dp odo:isInstanceOf ?parameter .
    ?parameter skos:prefLabel ?p_name .
    ?parameter skos:definition ?p_def .
    OPTIONAL { ?parameter odo:hasUnitOfMeasure [ rdf:value ?p_units ] }
    OPTIONAL { ?parameter odo:hasNoDataValue ?p_ndv }
  }
}
ORDER BY ?dp
ashepherd commented 3 years ago

Added in branch kg-field-info