CredentialEngine / CredentialRegistry

Repository for development of the Credential Registry
Apache License 2.0
12 stars 10 forks source link

Handling concept URIs in the search API in a more user-friendly way #593

Closed siuc-nate closed 1 year ago

siuc-nate commented 1 year ago

Per our 2022-09-29 meeting: In reference to https://github.com/CredentialEngine/Schema-Development/issues/839 We discussed looking at a means of having the search API handle aliasing for varying kinds of URIs (specifically concept URIs), to make it easier to write queries. For example, all three of these URIs mean (and ultimately lead to) the same resource:

creditUnit:DegreeCredit (which, per the JSON-LD context, expands to) https://purl.org/ctdl/vocabs/creditUnit/DegreeCredit (which redirects to) https://credreg.net/ctdl/vocabs/creditUnit/DegreeCredit

Unless I have missed something, this pattern holds true throughout the schemas (with "ctdlasn" or "qdata" in place of "ctdl" where appropriate). There is a slight exception with the QData vocabularies not using purl URIs, but a mapping/aliasing here should still include them, both for simplicity and because we may add them at a later date.

There is one sort-of outlier, the ceterms:credentialType property, whose values are the URIs for the various types of credential rather than for a concept, e.g.: ceterms:Certificate (which expands to) https://purl.org/ctdl/terms/Certificate (which redirects to) https://credreg.net/ctdl/terms/Certificate

The mappings for the concept scheme parts of the URIs can be found in the context files and at the tops of the terms pages (the "Controlled Vocabulary Concepts References (SKOS)" tables, specifically), but they should all follow the same pattern: https://credreg.net/ctdl/terms https://credreg.net/ctdlasn/terms https://credreg.net/qdata/terms

excelsior commented 1 year ago

@siuc-nate This feature is deployed onto sandbox. The following queries are equivalent:

Shorthand URI

{
    "ceterms:creditValue": {
        "ceterms:creditUnitType": {
            "ceterms:targetNode": "creditUnit:DegreeCredit"
        }
    }
}

Full URI

{
    "ceterms:creditValue": {
        "ceterms:creditUnitType": {
            "ceterms:targetNode": "https://purl.org/ctdl/vocabs/creditUnit/DegreeCredit"
        }
    }
}

Redirect URI

{
    "ceterms:creditValue": {
        "ceterms:creditUnitType": {
            "ceterms:targetNode": "https://credreg.net/ctdl/vocabs/creditUnit/DegreeCredit"
        }
    }
}
siuc-nate commented 1 year ago

Very nice! Thank you. Is there any reason not to push this to production as well?

excelsior commented 1 year ago

@siuc-nate Just wanted to make sure it works as expected on sandbox first. It's now available on production as well.

siuc-nate commented 1 year ago

Looks good to me, thanks.