regen-network / regen-registry-standards

:seedling: RDF and SHACL schemas for Regen Registry
4 stars 1 forks source link

resolving issues with http/https in prefix of context URIs #44

Closed wgwz closed 1 year ago

wgwz commented 1 year ago

our shacl schema use "http" as the url prefix for the xsd and schema parts of the context (among others). if a json-ld data graph uses "https" instead of "http" for the xsd or schema prefixes our shacl validation will fail.

here's a test case, given the following C03 project document:

{
  "@type": "regen:C03-Project",
  "@context": {
    "xsd": "https://www.w3.org/2001/XMLSchema#",
    "regen": "https://schema.regen.network#",
    "schema": "https://schema.org/",
    "schema:itemListElement": {
      "@container": "@list"
    }
  },
  "schema:name": "VCS-674",
  "regen:vcsProjectId": {
    "@type": "xsd:integer",
    "@value": "674"
  },
  "regen:toucanProjectTokenId": {
    "@type": "xsd:integer",
    "@value": "3"
  },
  "regen:approvedMethodologies": {
    "@type": "schema:ItemList",
    "schema:itemListElement": [
      {
        "schema:name": "VM0004",
        "schema:identifier": "VM0004"
      }
    ]
  }
}

if you run the validations against that data graph, you will get errors. if you change "https" to "http" for the "xsd" and "schema" context fields, the validations pass. the reason this is happening is because in our shacl schema, we always specify the prefix with "http":

https://github.com/regen-network/regen-registry-standards/blob/9f8ab866575d45604341d127b48bbf1f23c74801/shacl/projects/C03-project.ttl#L2 https://github.com/regen-network/regen-registry-standards/blob/9f8ab866575d45604341d127b48bbf1f23c74801/shacl/methodologies/methodology.ttl#L1

if possible, the ideal solution would be to rewrite our shacl schema to accept either version of the URI. however we might have to use the http version... more research is needed to find out what the best solution moving forward is

wgwz commented 1 year ago

we're going to use http prefixes, except for our own regen prefix. since this is the standard and almost all existing namespaces use http, see for example:

https://prefix.cc/popular/all

closing since no changes required.