clowder-framework / pyclowder

Library to assist in the development of extractors for clowder.
University of Illinois/NCSA Open Source License
10 stars 2 forks source link

Dataset Metadata request not in jsonld format #101

Closed minump closed 5 months ago

minump commented 7 months ago

The download_metadata() method in pyclowder/api/v1 returns the metdata definitions and not the user uploaded metadata.jsonld data. Currently it returns

[
    {
        "id": "635bf2e9e4b0b2cb0e249f62",
        "json": {
            "label": "Alternative Title",
            "uri": "http://purl.org/dc/terms/alternative",
            "type": "string"
        }
    },
    {
        "id": "635bf2e9e4b0b2cb0e249f67",
        "json": {
            "label": "Annotating CSV File",
            "uri": "https://clowder.ncsa.illinois.edu/metadata/terms/variable_annotation",
            "type": "annotation",
            "definitions_url": "http://ecgs.ncsa.illinois.edu/gsis/CSN"
        }
    },
    {
        "id": "635bf2e9e4b0b2cb0e249f63",
        "json": {
            "label": "Audience",
            "uri": "http://purl.org/dc/terms/audience",
            "type": "string"
        }
    },
    {
        "id": "635bf2e9e4b0b2cb0e249f66",
        "json": {
            "label": "CSDMS Standard Name",
            "uri": "http://csdms.colorado.edu/wiki/CSN_Searchable_List",
            "type": "list",
            "definitions_url": "http://ecgs.ncsa.illinois.edu/gsis/CSN"
        }
    },
    {
        "id": "635bf2e9e4b0b2cb0e249f65",
        "json": {
            "label": "Date and Time",
            "uri": "http://purl.org/dc/terms/date",
            "type": "datetime"
        }
    },
    {
        "id": "635bf2e9e4b0b2cb0e249f6d",
        "json": {
            "label": "Funding Institution",
            "uri": "http://sead-data.net/terms/FundingInstitution",
            "type": "string"
        }
    },
    {
        "id": "635bf2e9e4b0b2cb0e249f72",
        "json": {
            "label": "GeoJSON",
            "uri": "http://geojson.org/geojson-spec.html",
            "type": "wkt"
        }
    },
    {
        "id": "635bf2e9e4b0b2cb0e249f6e",
        "json": {
            "label": "Grant Number",
            "uri": "http://sead-data.net/terms/GrantNumber",
            "type": "string"
        }
    },
    {
        "id": "635bf2e9e4b0b2cb0e249f68",
        "json": {
            "label": "ODM2 Variable Name",
            "uri": "http://vocabulary.odm2.org/variablename",
            "type": "list",
            "definitions_url": "http://ecgs.ncsa.illinois.edu/gsis/sas/sn/odm2"
        }
    },
    {
        "id": "635bf2e9e4b0b2cb0e249f71",
        "json": {
            "label": "Primary/Initial Publication",
            "uri": "http://sead-data.net/terms/PrimaryPublication",
            "type": "string"
        }
    },
    {
        "id": "635bf2e9e4b0b2cb0e249f6c",
        "json": {
            "label": "Principal Investigator(s)",
            "uri": "http://sead-data.net/terms/PrincipalInvestigator",
            "type": "string"
        }
    },
    {
        "id": "635bf2e9e4b0b2cb0e249f64",
        "json": {
            "label": "References",
            "uri": "http://purl.org/dc/terms/references",
            "type": "string"
        }
    },
    {
        "id": "635bf2e9e4b0b2cb0e249f6f",
        "json": {
            "label": "Related Publications",
            "uri": "http://sead-data.net/terms/RelatedPublications",
            "type": "string"
        }
    },
    {
        "id": "635bf2e9e4b0b2cb0e249f6a",
        "json": {
            "label": "SAS Spatial Geocode",
            "uri": "http://ecgs.ncsa.illinois.edu/gsis/sas/geocode",
            "type": "listgeocode",
            "definitions_url": "http://ecgs.ncsa.illinois.edu/gsis/sas/geocode",
            "query_parameter": "loc"
        }
    },
    {
        "id": "635bf2e9e4b0b2cb0e249f69",
        "json": {
            "label": "SAS Variable Name",
            "uri": "http://ecgs.ncsa.illinois.edu/gsis/sas/vars",
            "type": "scientific_variable",
            "definitions_url": "http://ecgs.ncsa.illinois.edu/gsis/sas/vars/unit/udunits2",
            "query_parameter": "term"
        }
    },
    {
        "id": "635bf2e9e4b0b2cb0e249f70",
        "json": {
            "label": "Time Periods",
            "uri": "http://purl.org/dc/terms/PeriodOfTime",
            "type": "string"
        }
    },
    {
        "id": "635bf2e9e4b0b2cb0e249f6b",
        "json": {
            "label": "Unit",
            "uri": "http://ecgs.ncsa.illinois.edu/gsis/sas/unit/udunits2",
            "type": "list",
            "definitions_url": "http://ecgs.ncsa.illinois.edu/gsis/sas/unit/udunits2"
        }
    },
    {
        "id": "635bf2e9e4b0b2cb0e249f73",
        "json": {
            "label": "vega5-spec",
            "description": "Visualization specs for Vega v5 or Vega Lite v4",
            "uri": "https://vega.github.io/schema/",
            "type": "string"
        }
    }
]

This is the metadata definitions from mongodb and not the user uploaded metadata.

User uploaded metadata is returned in when the url points to metadata.jsonld instead of metadata. Change the url to reflect the below curl request request GET 'http://localhost:8000/api/datasets/6616e17ae4b097f5136d1115/metadata.jsonld?key='

The same change can be made in the upload_metadata method too. The upload_metadata() method gives error requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: http://clowder:9000/api/datasets/6616e17ae4b097f5136d1115/metadata?key= . This should also be changed to metadata.jsonld