Skip to content

Add Certification class (#3230)#3441

Merged
danbri merged 6 commits intomainfrom
certs
Jan 15, 2024
Merged

Add Certification class (#3230)#3441
danbri merged 6 commits intomainfrom
certs

Conversation

@alex-jansen
Copy link
Contributor

@danbri
Copy link
Contributor

danbri commented Jan 15, 2024

@alex-jansen it looks like there are some mistakes in the examples markup. Extracted from the giant failed build log:

Failures:

  1) Examples schemaorg-all-examples.txt[28365] - eg-0482 (jsonld)
     Failure/Error: specify("schemaorg-all-examples.txt[28365] - eg-0482 (jsonld)") {expect("/home/runner/work/schemaorg/schemaorg/software/scripts/spec/data/eg-0482-jsonld.html").to lint_cleanly}

       Source: <script type="application/ld+json">
       {
         "@context": "https://schema.org/",
         "@type": "Certification",
         "name": "EPREL",
         "description": "Registration of products in the European Product Registry for Energy Labeling (EPREL)",
         "url": "https://eprel.ec.europa.eu/screen/product/dishwashers2019/1779994",
         "about": {
           "@type": "Product",
           "@id": "https://www.dishwashers.com/en/built-in-dishwashers/1377-built-in-dishwasher-gsi1399xx"
         },
         "issuedBy": {
           "@type": "Organization",
           "name": [
             "European Commission, Directorate-General for Energy",
             "EC"
           ],
           "url": "https://eprel.ec.europa.eu/screen/home"
         },
         "certificationStatus": "https://schema.org/CertificationActive",
         "expires": "2026-05-12",
         "datePublished": "2023-06-01",
         "validFrom": "2023-05-12",
         "auditDate": "2023-10-01",
         "validIn": {
           "@type": "AdministrativeArea",
           "name": "European Union",
           "address": {
             "@type": "PostalAddress",
             "addressCountry": ["AT","BE","BG","CY","CZ","DE","DK","EE","ES","FI","FR","GR",
                                "HR","HU","IE","IT","LT","LU","LV","MT","NL","PL","PT","RO",
                                "SE","SI","SK"]
           }
         },
         "logo": "https://eprel.ec.europa.eu/assets/images/label/thumbnails/E-Left-LightOrange-WithAGScale.png",
         "certificationIdentification": "1779994",
         "hasMeasurement": {
           "@type": "QuantitativeValue",
           "name": "Energy Efficiency Index (EEI)",
           "valueReference": "https://eur-lex.europa.eu/eli/reg_del/2019/2017/2021-05-01#anx_IV",
           "value": 55.9
         }
       }
       </script>


       Results:
       property  schema:logo
         Subject _:g296460(schema:Certification) not compatible with domainIncludes (schema:Brand,schema:Organization,schema:Place,schema:Product,schema:Service)
     # ./spec/examples_spec.rb:1296:in `block (2 levels) in <top (required)>'

  2) Examples schemaorg-all-examples.txt[28481] - eg-0484 (jsonld)
     Failure/Error: specify("schemaorg-all-examples.txt[28481] - eg-0484 (jsonld)") {expect("/home/runner/work/schemaorg/schemaorg/software/scripts/spec/data/eg-0484-jsonld.html").to lint_cleanly}

       Source: <script type="application/ld+json">
       {
         "@context": [
           "https://schema.org/",
           "https://www.w3.org/ns/credentials/v2"
         ],
         "id": "http://certification.example/credentials/3732",
         "type": [
           "VerifiableCredential",
           "CertificationCredential"
         ],
         "issuer": "https://certification.example/issuers/14",
         "validFrom": "2023-01-01T19:23:24Z",
         "credentialSubject": {
           "type": "Product",
           "id": "https://www.example.com/12345678901231",
           "hasCertification": {
             "type": "Certification",
             "name": "CO2 Measured",
             "certificationStatus": "CertificationActive",
             "authority": {
               "type": "Organization",
               "name": "CO2 Trust",
               "url": "https://www.co2trust.com/"
             },
             "logo": "https://www.co2trust.com/c02-measured-logo.jpg",
             "hasMeasurement": {
               "@type": "QuantitativeValue",
               "name": "CO2e",
               "value": 0.158,
               "unitCode": "KGM"
             }
           }
         },
         "proof": {
           "type": "DataIntegrityProof",
           "cryptosuite": "ecdsa-rdfc-2019",
           "created": "2023-12-11T14:58:20Z",
           "verificationMethod": "https://certification.example/issuers/14#key-1",
           "proofPurpose": "assertionMethod",
           "proofValue": "z5dqTceMhzmpFSfwEphYDnWJJiAtcGaitiZ2FgpRWEcLJmfQBRMUpaTihmhpdHbiMJN9Ranx1PXLaGSePQjV74nLC"
         }
       }
       </script>


       Results:
       property  schemas:name
         Subject _:g297020(schema:Certification) not compatible with domainIncludes (schemas:Thing)
         Subject _:g297040(schema:Organization) not compatible with domainIncludes (schemas:Thing)
         Subject _:g297060(schema:QuantitativeValue) not compatible with domainIncludes (schemas:Thing)
       property  schema:logo
         Subject _:g297020(schema:Certification) not compatible with domainIncludes (schema:Brand,schema:Organization,schema:Place,schema:Product,schema:Service)
     # ./spec/examples_spec.rb:1302:in `block (2 levels) in <top (required)>'

  3) Examples schemaorg-all-examples.txt[28618] - eg-0486 (jsonld)
     Failure/Error: specify("schemaorg-all-examples.txt[28618] - eg-0486 (jsonld)") {expect("/home/runner/work/schemaorg/schemaorg/software/scripts/spec/data/eg-0486-jsonld.html").to lint_cleanly}

       Source: <script type="application/ld+json">
         {
           "@context": "https://schema.org/",
           "@type": "Product",
           "hasCertification": [
             {
               "@type": "Certification",
               "name": "FCC",
               "certificationStatus": "http://schema.org/CertificationActive",
               "certificationIdentification": {
                 "@type": "DefinedTerm",
                 "termCode": "BCG-E3307A",
                 "inDefinedTermSet": "https://apps.fcc.gov/coresWeb/publicHome.do"
               },
               "logo": "https://www.fcc.gov/sites/default/files/fcc-logo-black-2020-large.png",
               "issuedBy": {
                 "@type": "Organization",
                 "url": "https://www.fcc.gov/",
                 "name": "Federal Communications Commission"
               }
             },
             {
               "@type": "Certification",
               "certificationStatus": "http://schema.org/CertificationActive",
               "name": "CE",
               "issuedBy": {
                 "@type": "Organization",
                 "url": "https://europa.eu/",
                 "name": "European Commission"
               }
             }
           ]
         }
       </script>


       Results:
       property  schema:logo
         Subject _:g297400(schema:Certification) not compatible with domainIncludes (schema:Brand,schema:Organization,schema:Place,schema:Product,schema:Service)
     # ./spec/examples_spec.rb:1308:in `block (2 levels) in <top (required)>'

  4) Examples schemaorg-all-examples.txt[28672] - eg-0487 (jsonld)
     Failure/Error: specify("schemaorg-all-examples.txt[28672] - eg-0487 (jsonld)") {expect("/home/runner/work/schemaorg/schemaorg/software/scripts/spec/data/eg-0487-jsonld.html").to lint_cleanly}

       Source: <script type="application/ld+json">
       {
         "@context": [
           "https://schema.org/",
           "https://www.w3.org/ns/credentials/v2"
         ],
         "@type": "VerifiableCredential",
         "validFrom": "2022-01-01T16:00:00Z",
         "id": "http://certification.example/credentials/99876",
         "issuer": "https://certification.example/issuers/1562",
         "credentialSubject": {
           "type": "Product",
           "name": "WolfCrypt",
           "hasCertification": {
             "type": "Certification",
             "name": "FIPS compliance",
             "url": "https://csrc.nist.gov/projects/cryptographic-module-validation-program/certificate/3389",
             "certificationStatus": "CertificationActive",
             "issuedBy": {
               "type": "Organization",
               "name": "NIST",
               "url": "https://www.nist.gov/"
             },
             "certificationIdentification": "3389",
             "expires": "2024-03-03"
           }
         },
         "proof": {
           "type": "DataIntegrityProof",
           "cryptosuite": "ecdsa-rdfc-2019",
           "created": "2023-12-11T13:00:00Z",
           "verificationMethod": "https://certification.example/issuers/1562#key-1",
           "proofPurpose": "assertionMethod",
           "proofValue": "998qTceMhzmpFSfwEphYDnWJJiAtcGaitiZ2FgpRWEcLJmfQBRMUpaTihmhpdHbiMJN9Ranx1PXLaGSePQjV74nLC"
         }
       }
       </script>


       Results:
       property  schemas:name
         Subject _:g297580(schema:Product) not compatible with domainIncludes (schemas:Thing)
         Subject _:g297600(schema:Certification) not compatible with domainIncludes (schemas:Thing)
         Subject _:g297620(schema:Organization) not compatible with domainIncludes (schemas:Thing)
     # ./spec/examples_spec.rb:1311:in `block (2 levels) in <top (required)>'

Finished in 21.61 seconds (files took 1.73 seconds to load)
9135 examples, 4 failures, 24 pending

Failed examples:

rspec ./spec/examples_spec.rb:1296 # Examples schemaorg-all-examples.txt[28365] - eg-0482 (jsonld)
rspec ./spec/examples_spec.rb:1302 # Examples schemaorg-all-examples.txt[28481] - eg-0484 (jsonld)
rspec ./spec/examples_spec.rb:1308 # Examples schemaorg-all-examples.txt[28618] - eg-0486 (jsonld)
rspec ./spec/examples_spec.rb:1311 # Examples schemaorg-all-examples.txt[28672] - eg-0487 (jsonld)

Let's look at one of them, the second:

First, here are the triples as parsed by the JSON-LD Playground (to make some it's not something at the syntax level, weirdness around context processing, use '@' in the rdf:type property shorthand, etc.

<http://certification.example/credentials/3732> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://www.w3.org/2018/credentials#VerifiableCredential> .
<http://certification.example/credentials/3732> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://www.w3.org/ns/credentials/issuer-dependent#CertificationCredential> .
<http://certification.example/credentials/3732> <https://w3id.org/security#proof> _:b0 .
<http://certification.example/credentials/3732> <https://www.w3.org/2018/credentials#credentialSubject> <https://www.example.com/12345678901231> .
<http://certification.example/credentials/3732> <https://www.w3.org/2018/credentials#issuer> <https://certification.example/issuers/14> .
<http://certification.example/credentials/3732> <https://www.w3.org/2018/credentials#validFrom> "2023-01-01T19:23:24Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
<https://www.example.com/12345678901231> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://schema.org/Product> .
<https://www.example.com/12345678901231> <https://www.w3.org/ns/credentials/issuer-dependent#hasCertification> _:b2 .
_:b1 <http://purl.org/dc/terms/created> "2023-12-11T14:58:20Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> _:b0 .
_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://w3id.org/security#DataIntegrityProof> _:b0 .
_:b1 <https://w3id.org/security#cryptosuite> "ecdsa-rdfc-2019"^^<https://w3id.org/security#cryptosuiteString> _:b0 .
_:b1 <https://w3id.org/security#proofPurpose> <https://w3id.org/security#assertionMethod> _:b0 .
_:b1 <https://w3id.org/security#proofValue> "z5dqTceMhzmpFSfwEphYDnWJJiAtcGaitiZ2FgpRWEcLJmfQBRMUpaTihmhpdHbiMJN9Ranx1PXLaGSePQjV74nLC"^^<https://w3id.org/security#multibase> _:b0 .
_:b1 <https://w3id.org/security#verificationMethod> <https://certification.example/issuers/14#key-1> _:b0 .
_:b2 <http://schema.org/hasMeasurement> _:b3 .
_:b2 <http://schema.org/logo> <https://www.co2trust.com/c02-measured-logo.jpg> .
_:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://www.w3.org/ns/credentials/issuer-dependent#Certification> .
_:b2 <https://schema.org/name> "CO2 Measured" .
_:b2 <https://www.w3.org/ns/credentials/issuer-dependent#authority> _:b4 .
_:b2 <https://www.w3.org/ns/credentials/issuer-dependent#certificationStatus> "CertificationActive" .
_:b3 <http://schema.org/unitCode> "KGM" .
_:b3 <http://schema.org/value> "1.58E-1"^^<http://www.w3.org/2001/XMLSchema#double> .
_:b3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://schema.org/QuantitativeValue> .
_:b3 <https://schema.org/name> "CO2e" .
_:b4 <http://schema.org/url> <https://www.co2trust.com/> .
_:b4 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://schema.org/Organization> .
_:b4 <https://schema.org/name> "CO2 Trust" .

@danbri
Copy link
Contributor

danbri commented Jan 15, 2024

I think the issue is the list of contexts includes the verifiable credentials context after Schema.org's, and so we give it a chance to have the last word grabbing short names for any terms it likes. And apparently 'name' is claimed there, overwriting schema.org's 'name'. I think that explains these three, although when we look at that context definition from VC W3C definition it seems to use 'name' purely as shorthand for schema.org 'name'.

  • property schemas:name
    • Subject _:g297020(schema:Certification) not compatible with domainIncludes (schemas:Thing)
      
    • Subject _:g297040(schema:Organization) not compatible with domainIncludes (schemas:Thing)
    • Subject _:g297060(schema:QuantitativeValue) not compatible with domainIncludes (schemas:Thing)

Note 'schemas' rather than 'schema'. I don't know how JSON-LD chose that short name for the verifiable credentials ns.

Here is some of their JSON-LD context:

[...]
    "description": "https://schema.org/description",
    "name": "https://schema.org/name",

    "EnvelopedVerifiableCredential":
      "https://www.w3.org/2018/credentials#EnvelopedVerifiableCredential",

    "VerifiableCredential": {
      "@id": "https://www.w3.org/2018/credentials#VerifiableCredential",
      "@context": {
        "@protected": true,

        "id": "@id",
        "type": "@type",

        "credentialSchema": {
          "@id": "https://www.w3.org/2018/credentials#credentialSchema",
          "@type": "@id"
        },
        "credentialStatus": {
          "@id": "https://www.w3.org/2018/credentials#credentialStatus",
          "@type": "@id"
        },
        "credentialSubject": {
          "@id": "https://www.w3.org/2018/credentials#credentialSubject",
          "@type": "@id"
        },
        "description": "https://schema.org/description",
        "evidence": {
          "@id": "https://www.w3.org/2018/credentials#evidence",
          "@type": "@id"
        },
        "validFrom": {
          "@id": "https://www.w3.org/2018/credentials#validFrom",
          "@type": "http://www.w3.org/2001/XMLSchema#dateTime"
        },
        "validUntil": {
          "@id": "https://www.w3.org/2018/credentials#validUntil",
          "@type": "http://www.w3.org/2001/XMLSchema#dateTime"
        },
        "issuer": {
          "@id": "https://www.w3.org/2018/credentials#issuer",
          "@type": "@id"
        },
        "name": "https://schema.org/name",
....

This one (which appears in (1.) also) seems simpler:

  • property schema:logo
    * Subject _:g297020(schema:Certification) not compatible with domainIncludes (schema:Brand,schema:Organization,schema:Place,schema:Product,schema:Service)

Does a Certification have a logo? should it? Do we try to say that anywhere?

Let's figure out the 'name' stuff first!

/cc @MatthiasWiesmann @alex-jansen @RichardWallis @msporny @philarcher

@danbri
Copy link
Contributor

danbri commented Jan 15, 2024

I tried pasting it into the validator manually and get

Linter Messages
validation http://example.org/: Failed to parse input document: loading remote context failed: https://www.w3.org/ns/credentials/v2: undefined method `sub' for nil:NilClass

validation http://example.org/: FATAL Failed to parse input document: loading remote context failed: https://www.w3.org/ns/credentials/v2: undefined method `sub' for nil:NilClass: Called from /app/vendor/bundle/ruby/3.2.0/bundler/gems/json-ld-4a13da952b2f/lib/json/ld/reader.rb:107

error RuntimeError: Graph not read

But if the schema.org tests know 'name' is defined in the VC context then it must be loading it, ... so I don't think that's the issue. Ideas?

@alex-jansen
Copy link
Contributor Author

alex-jansen commented Jan 15, 2024 via email

@alex-jansen
Copy link
Contributor Author

alex-jansen commented Jan 15, 2024 via email

@danbri
Copy link
Contributor

danbri commented Jan 15, 2024

We should figure out what’s up with “name” but the examples can always be improved later; they’re not a recommendation or requirement

@danbri
Copy link
Contributor

danbri commented Jan 15, 2024

LGTM and it has had good review from relevant nearby projects.

@alex-jansen can you draft a section for release notes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants