add new contexts to cache

This commit is contained in:
Markus Gylling 2022-09-09 10:23:54 +02:00
parent 341a15b90a
commit 2ee1e92e6b
4 changed files with 499 additions and 3 deletions

View File

@ -40,11 +40,13 @@ public class CachingDocumentLoader implements DocumentLoader {
} }
static final ImmutableMap<String, URL> bundled = ImmutableMap.<String, URL>builder() static final ImmutableMap<String, URL> bundled = ImmutableMap.<String, URL>builder()
.put("https://purl.imsglobal.org/spec/clr/v2p0/context.json",Resources.getResource("clr-v2p0.json"))
.put("https://purl.imsglobal.org/spec/ob/v3p0/context.json",Resources.getResource("ob-v3p0.json"))
.put("https://imsglobal.github.io/openbadges-specification/context.json",Resources.getResource("contexts/obv3x.jsonld"))
.put("https://www.w3.org/ns/did/v1", Resources.getResource("contexts/did-v1.jsonld")) .put("https://www.w3.org/ns/did/v1", Resources.getResource("contexts/did-v1.jsonld"))
.put("https://www.w3.org/ns/odrl.jsonld", Resources.getResource("contexts/odrl.jsonld")) .put("https://www.w3.org/ns/odrl.jsonld", Resources.getResource("contexts/odrl.jsonld"))
.put("https://w3id.org/security/suites/ed25519-2020/v1",Resources.getResource("contexts/security-suites-ed25519-2020-v1.jsonld")) .put("https://w3id.org/security/suites/ed25519-2020/v1",Resources.getResource("contexts/security-suites-ed25519-2020-v1.jsonld"))
.put("https://www.w3.org/2018/credentials/v1", Resources.getResource("contexts/2018-credentials-v1.jsonld")) .put("https://www.w3.org/2018/credentials/v1", Resources.getResource("contexts/2018-credentials-v1.jsonld"))
.put("https://imsglobal.github.io/openbadges-specification/context.json",Resources.getResource("contexts/obv3.jsonld"))
.put("https://w3id.org/security/v1", Resources.getResource("contexts/security-v1.jsonld")) .put("https://w3id.org/security/v1", Resources.getResource("contexts/security-v1.jsonld"))
.put("https://w3id.org/security/v2", Resources.getResource("contexts/security-v2.jsonld")) .put("https://w3id.org/security/v2", Resources.getResource("contexts/security-v2.jsonld"))
.put("https://w3id.org/security/v3", Resources.getResource("contexts/security-v3-unstable.jsonld")) .put("https://w3id.org/security/v3", Resources.getResource("contexts/security-v3-unstable.jsonld"))
@ -60,7 +62,8 @@ public class CachingDocumentLoader implements DocumentLoader {
.initialCapacity(32).maximumSize(64).expireAfterAccess(Duration.ofHours(24)) .initialCapacity(32).maximumSize(64).expireAfterAccess(Duration.ofHours(24))
.build(new CacheLoader<Tuple<String, DocumentLoaderOptions>, Document>() { .build(new CacheLoader<Tuple<String, DocumentLoaderOptions>, Document>() {
public Document load(final Tuple<String, DocumentLoaderOptions> id) throws Exception { public Document load(final Tuple<String, DocumentLoaderOptions> id) throws Exception {
try (InputStream is = bundled.keySet().contains(id.t1) ? bundled.get(id.t1).openStream() try (InputStream is = bundled.keySet().contains(id.t1)
? bundled.get(id.t1).openStream()
: new URI(id.t1).toURL().openStream();) { : new URI(id.t1).toURL().openStream();) {
return JsonDocument.of(is); return JsonDocument.of(is);
} }

View File

@ -0,0 +1,53 @@
{
"@context": {
"id": "@id",
"type": "@type",
"ClrCredential": {
"@id": "https://purl.imsglobal.org/spec/clr/v2p0/vocab.html#ClrCredential",
"@context": {
"id": "@id",
"type": "@type"
}
},
"ClrSubject": {
"@id": "https://purl.imsglobal.org/spec/clr/v2p0/vocab.html#ClrSubject",
"@context": {
"id": "@id",
"type": "@type",
"cred": "https://www.w3.org/2018/credentials#",
"obi": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#",
"achievement": {
"@id": "https://purl.imsglobal.org/spec/clr/v2p0/vocab.html#achievement",
"@type": "obi:Achievement",
"@container": "@set"
},
"association": {
"@id": "https://purl.imsglobal.org/spec/clr/v2p0/vocab.html#association",
"@type": "https://purl.imsglobal.org/spec/clr/v2p0/vocab.html#Association",
"@container": "@set"
},
"verifiableCredential": {
"@id": "https://purl.imsglobal.org/spec/clr/v2p0/vocab.html#verifiableCredential",
"@type": "cred:verifiableCredential",
"@container": "@set"
}
}
},
"Association": {
"@id": "https://purl.imsglobal.org/spec/clr/v2p0/vocab.html#Association",
"@context": {
"associationType": {
"@id": "https://purl.imsglobal.org/spec/clr/v2p0/vocab.html#AssociationType"
},
"sourceId": {
"@id": "https://purl.imsglobal.org/spec/clr/v2p0/vocab.html#sourceId",
"@type": "xsd:anyURI"
},
"targetId": {
"@id": "https://purl.imsglobal.org/spec/clr/v2p0/vocab.html#targetId",
"@type": "xsd:anyURI"
}
}
}
}
}

View File

@ -0,0 +1,440 @@
{
"@context": {
"id": "@id",
"type": "@type",
"xsd": "https://www.w3.org/2001/XMLSchema#",
"OpenBadgeCredential": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#OpenBadgeCredential"
},
"Achievement": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#Achievement",
"@context": {
"achievementType": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#achievementType",
"@type": "xsd:string"
},
"alignment": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#alignment",
"@type": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#Alignment",
"@container": "@set"
},
"creator": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#Profile"
},
"creditsAvailable": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#creditsAvailable",
"@type": "xsd:float"
},
"criteria": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#Criteria",
"@type": "@id"
},
"fieldOfStudy": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#fieldOfStudy",
"@type": "xsd:string"
},
"humanCode": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#humanCode",
"@type": "xsd:string"
},
"otherIdentifier": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#otherIdentifier",
"@type": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#IdentifierEntry",
"@container": "@set"
},
"related": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#related",
"@type": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#Related",
"@container": "@set"
},
"resultDescription": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#resultDescription",
"@type": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#ResultDescription",
"@container": "@set"
},
"specialization": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#specialization",
"@type": "xsd:string"
},
"tag": {
"@id": "https://schema.org/keywords",
"@type": "xsd:string",
"@container": "@set"
},
"version": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#version",
"@type": "xsd:string"
}
}
},
"AchievementCredential": {
"@id": "OpenBadgeCredential"
},
"AchievementSubject": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#AchievementSubject",
"@context": {
"achievement": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#Achievement"
},
"activityEndDate": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#activityEndDate",
"@type": "xsd:date"
},
"activityStartDate": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#activityStartDate",
"@type": "xsd:date"
},
"creditsEarned": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#creditsEarned",
"@type": "xsd:float"
},
"identifier": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#identifier",
"@type": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#IdentityObject",
"@container": "@set"
},
"licenseNumber": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#licenseNumber",
"@type": "xsd:string"
},
"result": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#result",
"@type": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#Result",
"@container": "@set"
},
"role": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#role",
"@type": "xsd:string"
},
"source": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#source",
"@type": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#Profile"
},
"term": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#term",
"@type": "xsd:string"
}
}
},
"Address": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#Address",
"@context": {
"addressCountry": {
"@id": "https://schema.org/addressCountry",
"@type": "xsd:string"
},
"addressCountryCode": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#CountryCode",
"@type": "xsd:string"
},
"addressLocality": {
"@id": "https://schema.org/addressLocality",
"@type": "xsd:string"
},
"addressRegion": {
"@id": "https://schema.org/addressRegion",
"@type": "xsd:string"
},
"geo": {
"@id" : "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#GeoCoordinates"
},
"postOfficeBoxNumber": {
"@id": "https://schema.org/postOfficeBoxNumber",
"@type": "xsd:string"
},
"postalCode": {
"@id": "https://schema.org/postalCode",
"@type": "xsd:string"
},
"streetAddress": {
"@id": "https://schema.org/streetAddress",
"@type": "xsd:string"
}
}
},
"Alignment": {
"@id": "https://schema.org/Alignment",
"@context": {
"targetCode": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#targetCode",
"@type": "xsd:string"
},
"targetDescription": {
"@id": "https://schema.org/targetDescription",
"@type": "xsd:string"
},
"targetFramework": {
"@id": "https://schema.org/targetFramework",
"@type": "xsd:string"
},
"targetName": {
"@id": "https://schema.org/targetName",
"@type": "xsd:string"
},
"targetType": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#targetType",
"@type": "xsd:string"
},
"targetUrl": {
"@id": "https://schema.org/targetUrl",
"@type": "xsd:anyURI"
}
}
},
"Criteria": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#Criteria"
},
"EndorsementCredential": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#EndorsementCredential"
},
"EndorsementSubject": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#EndorsementSubject",
"@context": {
"endorsementComment": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#endorsementComment",
"@type": "xsd:string"
}
}
},
"Evidence": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#Evidence",
"@context": {
"audience": {
"@id": "https://schema.org/audience",
"@type": "xsd:string"
},
"genre": {
"@id": "https://schema.org/genre",
"@type": "xsd:string"
}
}
},
"GeoCoordinates": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#GeoCoordinates",
"@context": {
"latitude": {
"@id": "https://schema.org/latitude",
"@type": "xsd:string"
},
"longitude": {
"@id": "https://schema.org/longitude",
"@type": "xsd:string"
}
}
},
"IdentifierEntry": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#IdentifierEntry",
"@context": {
"identifier": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#identifier",
"@type": "xsd:string"
},
"identifierType": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#identifierType",
"@type": "xsd:string"
}
}
},
"IdentityObject": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#IdentityObject",
"@context": {
"hashed": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#hashed",
"@type": "xsd:boolean"
},
"identityHash": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#identityHash",
"@type": "xsd:string"
},
"identityType": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#identityType",
"@type": "xsd:string"
},
"salt": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#salt",
"@type": "xsd:string"
}
}
},
"Image": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#Image",
"@context": {
"caption": {
"@id": "https://schema.org/caption",
"@type": "xsd:string"
}
}
},
"Profile": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#Profile",
"@context": {
"additionalName": {
"@id": "https://schema.org/additionalName",
"@type": "xsd:string"
},
"address": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#Address"
},
"dateOfBirth": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#dateOfBirth",
"@type": "xsd:date"
},
"email": {
"@id": "https://schema.org/email",
"@type": "xsd:string"
},
"familyName": {
"@id": "https://schema.org/familyName",
"@type": "xsd:string"
},
"familyNamePrefix": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#familyNamePrefix",
"@type": "xsd:string"
},
"givenName": {
"@id": "https://schema.org/givenName",
"@type": "xsd:string"
},
"honorificPrefix": {
"@id": "https://schema.org/honorificPrefix",
"@type": "xsd:string"
},
"honorificSuffix": {
"@id": "https://schema.org/honorificSuffix",
"@type": "xsd:string"
},
"otherIdentifier": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#otherIdentifier",
"@type": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#IdentifierEntry",
"@container": "@set"
},
"parentOrg": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#parentOrg",
"@type": "xsd:string"
},
"patronymicName": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#patronymicName",
"@type": "xsd:string"
},
"phone": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#PhoneNumber",
"@type": "xsd:string"
},
"official": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#official",
"@type": "xsd:string"
}
}
},
"Related": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#Related",
"@context": {
"version": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#version",
"@type": "xsd:string"
}
}
},
"Result": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#Result",
"@context": {
"achievedLevel": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#achievedLevel",
"@type": "xsd:anyURI"
},
"resultDescription": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#resultDescription",
"@type": "xsd:anyURI"
},
"status": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#status",
"@type": "xsd:string"
},
"value": {
"@id": "https://schema.org/value",
"@type": "xsd:string"
}
}
},
"ResultDescription": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#ResultDescription",
"@context": {
"allowedValue": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#allowedValue",
"@type": "xsd:string",
"@container": "@set"
},
"requiredLevel": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#requiredLevel",
"@type": "xsd:anyURI"
},
"requiredValue": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#requiredValue",
"@type": "xsd:string"
},
"resultType": {
"@id":"https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#resultType",
"@type": "xsd:string"
},
"rubricCriterionLevel": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#rubricCriterionLevel",
"@type": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#RubricCriterionLevel",
"@container": "@set"
},
"valueMax": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#valueMax",
"@type": "xsd:string"
},
"valueMin": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#valueMin",
"@type": "xsd:string"
}
}
},
"RubricCriterionLevel": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#RubricCriterionLevel",
"@context": {
"level": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#level",
"@type": "xsd:string"
},
"points": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#points",
"@type": "xsd:string"
}
}
},
"alignment": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#alignment",
"@type": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#Alignment",
"@container": "@set"
},
"description": {
"@id": "https://schema.org/description",
"@type": "xsd:string"
},
"endorsement": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#endorsement",
"@type": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#EndorsementCredential",
"@container": "@set"
},
"image": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#image",
"@type": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#Image"
},
"name": {
"@id": "https://schema.org/name",
"@type": "xsd:string"
},
"narrative": {
"@id": "https://purl.imsglobal.org/spec/ob/v3p0/vocab.html#narrative",
"@type": "xsd:string"
},
"url": {
"@id": "https://schema.org/url",
"@type": "xsd:anyURI"
}
}
}