Skip to content
Snippets Groups Projects
Select Git revision
  • NCSA-v2
  • develop default protected
  • tuda
  • v0.23.1
  • v0.22.4
  • develop-2025-02-16
  • develop-2025-02-09
  • develop-2025-02-02
  • develop-2025-01-26
  • develop-2025-01-19
  • v1.0.0-alpha.3
  • develop-2025-01-12
  • develop-2025-01-05
  • develop-2024-12-29
  • develop-2024-12-22
  • develop-2024-12-15
  • v1.0.0-alpha.2
  • develop-2024-12-08
  • develop-2024-12-01
  • develop-2024-11-24
  • v1.0.0-alpha.1
  • v0.22.3
  • releases/latest
23 results

spack

Blame
  • ContextDefinitions.ts 2.38 KiB
    import ComponentInformation from "../entity/ComponentInformation";
    
    const component = {
        "id": { "@id": "https://schema.org/url", "@type": "@id"},
        "dateCreated": "https://schema.org/dateCreated",
        "license": "http://www.w3.org/1999/xhtml/vocab#license"
    };
    
    const componentRelation = {
        "id": { "@id": "https://schema.org/url", "@type": "@id"},
        "from": "https://schema.org/DateTime",
        "to": "https://schema.org/DateTime",
        "license": "http://www.w3.org/1999/xhtml/vocab#license"
    };
    
    const information = function(metadataContext: unknown, previousVersion: ComponentInformation | undefined, nextVersion: ComponentInformation | undefined): Record<string, unknown> {
        const result: Record<string, unknown> = {
            "id": { "@id": "https://schema.org/url", "@type": "@id"},
            "component": { "@id": "https://schema.org/url", "@type": "@id"},
            "dateCreated": "https://schema.org/dateCreated",
            "name": "https://schema.org/name",
            "comment": "http://schema.org/comment",
            "informationLicense": "http://www.w3.org/1999/xhtml/vocab#license",
            "measurementLicense": "http://www.w3.org/1999/xhtml/vocab#license",
            "topic": "https://schema.org/text",
            "metadata": metadataContext
        };
    
        if(previousVersion) {
            result.previousVersion = { "@id": "https://schema.org/url", "@type": "@id"};
        }
    
        if(nextVersion) {
            result.nextVersion = { "@id": "https://schema.org/url", "@type": "@id"};
        }
    
        return result;
    };
    
    const measurement = function(valueContext: unknown, metadataContext: unknown | undefined): Record<string, unknown> {
        const result: Record<string, unknown> = {
            "id": { "@id": "https://schema.org/url", "@type": "@id"},
            "dateCreated": "https://schema.org/dateCreated",
            "license": "http://www.w3.org/1999/xhtml/vocab#license",
            "value": valueContext
        };
    
        if(metadataContext) {
            result.metadata = metadataContext;
        }
    
        return result;
    };
    
    const typeDefinition = {
        "name": { "@id": "https://schema.org/url", "@type": "@id"},
        "dateCreated": "https://schema.org/dateCreated",
        "comment": "http://schema.org/comment",
        "schema": "https://json-schema.org/draft/2020-12/json-schema-core.html",
        "license": "http://www.w3.org/1999/xhtml/vocab#license",
    };
    
    export default {
        component, 
        componentRelation, 
        information, 
        measurement,
        typeDefinition
    };