From 694112eba823123f989b7598f9cd0dbbd58eb72f Mon Sep 17 00:00:00 2001 From: Aleksei Ivanov Date: Mon, 30 Sep 2024 04:27:54 +0300 Subject: [PATCH] [add] DASH vocabulary --- src/ObjectProvider.ts | 10 +- src/ObjectProviderImpl.ts | 14 +- src/models/Model.ts | 6 + src/schema/ArtifactShapeSchema.ts | 46 +++++ test-data/shapes/rm-shapes.ttl | 278 ++++++++++++++---------------- test/SparqlClient.spec.ts | 5 +- test/SparqlGen.spec.ts | 18 ++ test/configTests.ts | 7 +- 8 files changed, 221 insertions(+), 163 deletions(-) diff --git a/src/ObjectProvider.ts b/src/ObjectProvider.ts index 52cb128..8b4a94e 100644 --- a/src/ObjectProvider.ts +++ b/src/ObjectProvider.ts @@ -39,7 +39,15 @@ export interface JSONSchema7LDProperty extends JSONSchema7 { */ '@id'?: string | undefined; '@type'?: string | undefined; - order?: number | undefined; // SHACL Shapes + + // SHACL Shapes properties + order?: number | undefined; + + // DASH properties + propertyRole?: string | undefined; + editor?: string | undefined; + viewer?: string | undefined; + singleLine?: boolean; // permissions extension valueModifiability?: string | undefined; // user or non -- system diff --git a/src/ObjectProviderImpl.ts b/src/ObjectProviderImpl.ts index dcdcc34..3fbe19c 100644 --- a/src/ObjectProviderImpl.ts +++ b/src/ObjectProviderImpl.ts @@ -79,13 +79,13 @@ function propertyShapeToJsonSchemaProperty( const shapePropKey = propertyNameShapeToSchema(shapePropUri); schemaProps[shapePropKey] = {}; let schemaProp: JSONSchema7LDPropertyDefinition = schemaProps[shapePropKey]; - //labels + //label conversion if (shapeProp.name) schemaProp.title = shapeProp.name; - if (shapeProp.description) schemaProp.description = shapeProp.description; - if (shapeProp.order) schemaProp.order = shapeProp.order; - //modifiability - if (shapeProp.shapeModifiability) schemaProp.shapeModifiability = shapeProp.shapeModifiability; - //if (shapeProp.valueModifiability) schemaProp.valueModifiability = shapeProp.valueModifiability; + Object.keys(shapeProp) + .filter( + (k) => !['@id', '@type', 'name', 'path', 'datatype', 'class', 'nodeKind', 'minCount', 'maxCount'].includes(k), + ) + .forEach((fk: any) => ((schemaProp as JsObject)[fk] = shapeProp[fk])); //cardinality if (shapeProp.maxCount === undefined || shapeProp.maxCount > 1) { schemaProp.type = 'array'; @@ -97,6 +97,8 @@ function propertyShapeToJsonSchemaProperty( schemaReqs.push(shapePropKey); } } + //element default value + if (shapeProp.defaultValue) schemaProp.default = shapeProp.defaultValue; //element type if (shapeProp.datatype) { if (shapeProp.datatype === 'xsd:dateTime') { diff --git a/src/models/Model.ts b/src/models/Model.ts index 85b0eea..2477d52 100644 --- a/src/models/Model.ts +++ b/src/models/Model.ts @@ -27,8 +27,14 @@ export const rootModelInitialState: TMstRepositorySnapshotIn = { rdf: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#', rdfs: 'http://www.w3.org/2000/01/rdf-schema#', xsd: 'http://www.w3.org/2001/XMLSchema#', + owl: 'http://www.w3.org/2002/07/owl#', + // shapes + sh: 'http://www.w3.org/ns/shacl#', + dash: 'http://datashapes.org/dash#', + // rdf4j-specific sesame: 'http://www.openrdf.org/schema/sesame#', //rdf4j DirectType Inferencer sesame:directSubClassOf rdf4j: 'http://rdf4j.org/schema/rdf4j#', //rdf4j Default Graph rdf4j:nil, rdf4j:SHACLShapeGraph + // library constant IRIs aldkg: 'https://agentlab.eu/ns/ldkg#', }, }, diff --git a/src/schema/ArtifactShapeSchema.ts b/src/schema/ArtifactShapeSchema.ts index fd9fb03..f0b63c0 100644 --- a/src/schema/ArtifactShapeSchema.ts +++ b/src/schema/ArtifactShapeSchema.ts @@ -59,9 +59,12 @@ export const ArtifactShapeSchema: JSONSchema7LD = { }, title: { type: 'string', + propertyRole: 'dash:LabelRole', + singleLine: true, }, description: { type: 'string', + propertyRole: 'dash:DescriptionRole', }, property: { type: 'array', @@ -82,6 +85,7 @@ export const ArtifactShapeSchema: JSONSchema7LD = { }, iconReference: { type: 'object', + propertyRole: 'dash:IconRole', }, }, required: ['@id', 'targetClass' /*, 'property'*/], // arrays should be required @@ -132,6 +136,24 @@ export const PropertyShapeSchema: JSONSchema7LD = { '@id': 'sh:maxCount', '@type': 'xsd:integer', }, + // DASH properties + propertyRole: { + '@id': 'dash:propertyRole', + '@type': '@id', + }, + editor: { + '@id': 'dash:editor', + '@type': '@id', + }, + viewer: { + '@id': 'dash:viewer', + '@type': '@id', + }, + singleLine: { + '@id': 'dash:singleLine', + '@type': 'xsd:boolean', + }, + //permissions extension shapeModifiability: 'rm:shapeModifiability', valueModifiability: 'rm:valueModifiability', }, @@ -148,10 +170,13 @@ export const PropertyShapeSchema: JSONSchema7LD = { name: { title: 'Name', type: 'string', + propertyRole: 'dash:LabelRole', + singleLine: true, }, description: { title: 'Description', type: 'string', + propertyRole: 'dash:DescriptionRole', }, path: { title: 'path', @@ -183,6 +208,27 @@ export const PropertyShapeSchema: JSONSchema7LD = { title: 'Max Count', type: 'integer', }, + // DASH properties + propertyRole: { + type: 'string', + format: 'iri', + title: 'Property Role', + }, + editor: { + type: 'string', + format: 'iri', + title: 'Editor', + }, + viewer: { + type: 'string', + format: 'iri', + title: 'Viewer', + }, + singleLine: { + type: 'boolean', + title: 'Single Line', + }, + //permissions extension shapeModifiability: { type: 'string', }, diff --git a/test-data/shapes/rm-shapes.ttl b/test-data/shapes/rm-shapes.ttl index e0a984d..10938c3 100644 --- a/test-data/shapes/rm-shapes.ttl +++ b/test-data/shapes/rm-shapes.ttl @@ -7,7 +7,9 @@ @prefix vann: . @prefix vs: . @prefix xsd: . + @prefix sh: . +@prefix dash: . @prefix rm: . @prefix nav: . @@ -17,8 +19,7 @@ # in context https://agentlab.eu/ns/rm/rdf# -rm:ArtifactClassesShape - a sh:NodeShape ; +rm:ArtifactClassesShape a sh:NodeShape ; sh:targetClass rm:ArtifactClasses ; dcterms:title "Artifact Types"^^xsd:string ; dcterms:description "Artifact Class of Classes."^^xsd:string ; @@ -27,8 +28,7 @@ rm:ArtifactClassesShape rm:descriptionShape , rm:inCreationMenuShape . -rm:LinkClassesShape - a sh:NodeShape ; +rm:LinkClassesShape a sh:NodeShape ; sh:targetClass rm:LinkClasses ; dcterms:title "Link Types"^^xsd:string ; dcterms:description "Link Class of Classes."^^xsd:string ; @@ -39,8 +39,7 @@ rm:LinkClassesShape rm:objectToSubjectLabelShape . -rm:ArtifactShape - a sh:NodeShape ; +rm:ArtifactShape a sh:NodeShape ; sh:targetClass rm:Artifact ; dcterms:title "Artifact"^^xsd:string ; dcterms:description "Artifact"^^xsd:string ; @@ -57,8 +56,7 @@ rm:ArtifactShape rm:assetFolderShape , rm:formatShape . -nav:folderShape - a sh:NodeShape ; +nav:folderShape a sh:NodeShape ; sh:targetClass nav:folder ; dcterms:title "Folder"^^xsd:string ; dcterms:description "Abstraction of a directory containing Requirements and RequirementCollections."^^xsd:string ; @@ -73,8 +71,7 @@ nav:folderShape rm:modifiedShape ; rm:defaultIndividNs "https://agentlab.eu/ns/rm/folders#"^^xsd:anyURI . -rm:ProjectAreaShape - a sh:NodeShape ; +rm:ProjectAreaShape a sh:NodeShape ; sh:targetClass nav:ProjectArea ; dcterms:title "Project Area"^^xsd:string ; dcterms:description "Project Area"^^xsd:string ; @@ -87,8 +84,7 @@ rm:ProjectAreaShape rm:defaultIndividNs "https://agentlab.eu/ns/rm/projects#"^^xsd:anyURI . # Link Shapes -rm:LinkShape - a sh:NodeShape ; +rm:LinkShape a sh:NodeShape ; sh:targetClass rm:Link ; dcterms:title "Link"^^xsd:string ; dcterms:description "Link."^^xsd:string ; @@ -101,14 +97,12 @@ rm:LinkShape rm:modifiedByShape , rm:modifiedShape . -rmUserTypes:UsedInShape - a sh:NodeShape ; +rmUserTypes:UsedInShape a sh:NodeShape ; sh:targetClass rmUserTypes:UsedIn ; dcterms:title "UsedIn Link"^^xsd:string ; dcterms:description "Connects Artifacts in Collection."^^xsd:string . -rmUserTypes:UsedInModuleShape - a sh:NodeShape ; +rmUserTypes:UsedInModuleShape a sh:NodeShape ; sh:targetClass rmUserTypes:UsedInModule ; dcterms:title "UsedInModule Link"^^xsd:string ; dcterms:description "Connects Artifacts in Module."^^xsd:string ; @@ -120,8 +114,7 @@ rmUserTypes:UsedInModuleShape rmUserTypes:isHeadingShape . # Enumeration Shapes -rmUserTypes:_YwcOsRmREemK5LEaKhoOowShape - a sh:NodeShape ; +rmUserTypes:_YwcOsRmREemK5LEaKhoOowShape a sh:NodeShape ; sh:targetClass rmUserTypes:_YwcOsRmREemK5LEaKhoOow ; dcterms:title "Format"^^xsd:string ; dcterms:description "Artifact Format"^^xsd:string ; @@ -130,8 +123,7 @@ rmUserTypes:_YwcOsRmREemK5LEaKhoOowShape rm:descriptionShape , rm:valueShape . -rmUserTypes:_YwrbNRmREemK5LEaKhoOowShape - a sh:NodeShape ; +rmUserTypes:_YwrbNRmREemK5LEaKhoOowShape a sh:NodeShape ; sh:targetClass rmUserTypes:_YwrbNRmREemK5LEaKhoOow ; dcterms:title "Status"^^xsd:string ; dcterms:description "Artifact Status"^^xsd:string ; @@ -142,296 +134,284 @@ rmUserTypes:_YwrbNRmREemK5LEaKhoOowShape # ******** Properties ******** -rm:inCreationMenuShape - a sh:PropertyShape ; +rm:inCreationMenuShape a sh:PropertyShape ; sh:name "Show in menu Create"^^xsd:string ; sh:description "Show in menu Create"^^xsd:string ; sh:path rm:inCreationMenu ; + sh:datatype xsd:boolean ; + #sh:minCount 0 ; + sh:maxCount 1 ; # who could modify shape data rm:shapeModifiability "system" ; # who could modify value data - rm:valueModifiability "system" ; - #sh:minCount 0 ; - sh:maxCount 1 ; - sh:datatype xsd:boolean . + rm:valueModifiability "system" . -rm:subjectToObjectLabelShape - a sh:PropertyShape ; +rm:subjectToObjectLabelShape a sh:PropertyShape ; sh:name "Object Label"^^xsd:string ; sh:description "Label of an Object of a Link"^^xsd:string ; sh:path rm:subjectToObjectLabel ; + sh:datatype xsd:string ; + #sh:minCount 1 ; + sh:maxCount 1 ; sh:order 2 ; # who could modify shape data rm:shapeModifiability "system" ; # who could modify value data - rm:valueModifiability "user" ; - #sh:minCount 1 ; - sh:maxCount 1 ; - sh:datatype xsd:string . + rm:valueModifiability "user". rm:objectToSubjectLabelShape a sh:PropertyShape ; sh:name "Subject Label"^^xsd:string ; sh:description "Label of a Subject of a Link"^^xsd:string ; sh:path rm:objectToSubjectLabel ; + sh:datatype xsd:string ; + #sh:minCount 1 ; + sh:maxCount 1 ; sh:order 2 ; # who could modify shape data rm:shapeModifiability "system" ; # who could modify value data - rm:valueModifiability "user" ; - #sh:minCount 1 ; - sh:maxCount 1 ; - sh:datatype xsd:string . + rm:valueModifiability "user" . -rm:identifierShape - a sh:PropertyShape ; +rm:identifierShape a sh:PropertyShape ; sh:name "Identifier"^^xsd:string ; sh:description "Numeric identifier, unique within a system"^^xsd:string ; sh:path dcterms:identifier ; + sh:datatype xsd:integer ; + #sh:minCount 1 ; + sh:maxCount 1 ; sh:order 2 ; + dash:propertyRole dash:IDRole ; # who could modify shape data rm:shapeModifiability "system" ; # who could modify value data - rm:valueModifiability "system" ; - #sh:minCount 1 ; - sh:maxCount 1 ; - sh:datatype xsd:integer . + rm:valueModifiability "system" . -rm:titleShape - a sh:PropertyShape ; +rm:titleShape a sh:PropertyShape ; sh:name "Title"^^xsd:string ; sh:description "Title"^^xsd:string ; sh:path dcterms:title ; - sh:order 3 ; - rm:shapeModifiability "system" ; - rm:valueModifiability "user" ; + sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ; - sh:datatype xsd:string . + sh:order 3 ; + dash:propertyRole dash:LabelRole ; + dash:singleLine true ; + rm:shapeModifiability "system" ; + rm:valueModifiability "user" . -rm:descriptionShape - a sh:PropertyShape ; +rm:descriptionShape a sh:PropertyShape ; sh:name "Description"^^xsd:string ; sh:description "Description"^^xsd:string ; sh:path dcterms:description ; + sh:datatype xsd:string ; + sh:maxCount 1 ; sh:order 4 ; + dash:propertyRole dash:DescriptionRole ; rm:shapeModifiability "system" ; - rm:valueModifiability "user" ; - sh:maxCount 1 ; - sh:datatype xsd:string . + rm:valueModifiability "user" . -rm:xhtmlTextShape - a sh:PropertyShape ; +rm:xhtmlTextShape a sh:PropertyShape ; sh:name "Text"^^xsd:string ; sh:description "Formatted text"^^xsd:string ; sh:path rm:xhtmlText ; + sh:datatype rdf:HTML ; + sh:maxCount 1 ; sh:order 4 ; rm:shapeModifiability "system" ; - rm:valueModifiability "user" ; - sh:maxCount 1 ; - sh:datatype rdf:HTML . + rm:valueModifiability "user" . -rm:creatorShape - a sh:PropertyShape ; +rm:creatorShape a sh:PropertyShape ; sh:name "Creator"^^xsd:string ; sh:description "An Agent, created a Resource"^^xsd:string ; sh:path dcterms:creator ; - sh:order 5 ; - rm:shapeModifiability "system" ; - rm:valueModifiability "system" ; + sh:class pporoles:User ; + sh:nodeKind sh:BlankNodeOrIRI ; #sh:minCount 1; sh:maxCount 1; - sh:class pporoles:User ; - sh:nodeKind sh:BlankNodeOrIRI . + sh:order 5 ; + rm:shapeModifiability "system" ; + rm:valueModifiability "system" . -rm:createdShape - a sh:PropertyShape ; +rm:createdShape a sh:PropertyShape ; sh:name "Created"^^xsd:string ; sh:description "When a Resource was created"^^xsd:string ; sh:path dcterms:created ; - sh:order 6 ; - rm:shapeModifiability "system" ; - rm:valueModifiability "system" ; + sh:datatype xsd:dateTime ; #sh:minCount 1; sh:maxCount 1; - sh:datatype xsd:dateTime . + sh:order 6 ; + rm:shapeModifiability "system" ; + rm:valueModifiability "system" . -rm:modifiedByShape - a sh:PropertyShape ; +rm:modifiedByShape a sh:PropertyShape ; sh:name "Modified By"^^xsd:string ; sh:description "An Agent, modified a Resource"^^xsd:string ; sh:path oslc:modifiedBy ; - sh:order 7 ; - rm:shapeModifiability "system" ; - rm:valueModifiability "system" ; + sh:class pporoles:User ; + sh:nodeKind sh:BlankNodeOrIRI ; #sh:minCount 1; sh:maxCount 1; - sh:class pporoles:User ; - sh:nodeKind sh:BlankNodeOrIRI . + sh:order 7 ; + rm:shapeModifiability "system" ; + rm:valueModifiability "system" . -rm:modifiedShape - a sh:PropertyShape ; +rm:modifiedShape a sh:PropertyShape ; sh:name "Modified"^^xsd:string ; sh:description "When a Resource was modified"^^xsd:string ; sh:path dcterms:modified ; - sh:order 8 ; - rm:shapeModifiability "system" ; - rm:valueModifiability "system" ; + sh:datatype xsd:dateTime ; #sh:minCount 1; sh:maxCount 1; - sh:datatype xsd:dateTime . + sh:order 8 ; + rm:shapeModifiability "system" ; + rm:valueModifiability "system" . -nav:processAreaShape - a sh:PropertyShape ; +nav:processAreaShape a sh:PropertyShape ; sh:name "Process Area"^^xsd:string ; sh:description "Process Area"^^xsd:string ; sh:path nav:processArea ; - sh:order 9 ; - rm:shapeModifiability "system" ; - rm:valueModifiability "system" ; + sh:nodeKind sh:IRI ; + sh:class nav:ProjectArea ; sh:minCount 0 ; sh:maxCount 1 ; - sh:nodeKind sh:IRI ; - sh:class nav:ProjectArea . + sh:order 9 ; + rm:shapeModifiability "system" ; + rm:valueModifiability "system" . -rm:assetFolderShape - a sh:PropertyShape ; +rm:assetFolderShape a sh:PropertyShape ; sh:name "Folder"^^xsd:string ; sh:description "Asset folder"^^xsd:string ; sh:path rm:assetFolder ; - sh:order 10 ; - rm:shapeModifiability "system" ; - rm:valueModifiability "user" ; + sh:nodeKind sh:IRI ; + sh:class nav:folder ; #sh:minCount 1 ; sh:maxCount 1 ; - sh:nodeKind sh:IRI ; - sh:class nav:folder . + sh:order 10 ; + rm:shapeModifiability "system" ; + rm:valueModifiability "user" . -rm:formatShape - a sh:PropertyShape ; +rm:formatShape a sh:PropertyShape ; sh:name "Format"^^xsd:string ; sh:description "Artifact Format"^^xsd:string ; sh:path rm:artifactFormat ; - sh:order 11 ; - rm:shapeModifiability "system" ; - rm:valueModifiability "user" ; + sh:nodeKind sh:IRI ; + sh:class rmUserTypes:_YwcOsRmREemK5LEaKhoOow ; #sh:minCount 1 ; sh:maxCount 1 ; - sh:nodeKind sh:IRI ; - sh:class rmUserTypes:_YwcOsRmREemK5LEaKhoOow . + sh:order 11 ; + rm:shapeModifiability "system" ; + rm:valueModifiability "user" . -nav:parentShape - a sh:PropertyShape ; +nav:parentShape a sh:PropertyShape ; sh:name "Parent"^^xsd:string ; sh:description "Expresses a containment relationship between folders."^^xsd:string ; sh:path nav:parent ; - rm:shapeModifiability "system" ; - rm:valueModifiability "user" ; + sh:nodeKind sh:IRI ; + sh:class nav:folder ; sh:minCount 0 ; sh:maxCount 1 ; - sh:nodeKind sh:IRI ; - sh:class nav:folder . + rm:shapeModifiability "system" ; + rm:valueModifiability "user" . -rm:valueShape - a sh:PropertyShape ; +rm:valueShape a sh:PropertyShape ; sh:name "Value"^^xsd:string ; sh:description "Value"^^xsd:string ; sh:path rdf:value ; - rm:shapeModifiability "system" ; - rm:valueModifiability "user" ; + sh:datatype xsd:string ; #sh:minCount 1 ; sh:maxCount 1 ; - sh:datatype xsd:string . + rm:shapeModifiability "system" ; + rm:valueModifiability "user" . -rm:nameShape - a sh:PropertyShape ; +rm:nameShape a sh:PropertyShape ; sh:name "Name"^^xsd:string ; sh:description "Name"^^xsd:string ; sh:path foaf:name ; - rm:shapeModifiability "system" ; - rm:valueModifiability "system" ; + sh:datatype xsd:string ; #sh:minCount 1 ; sh:maxCount 1 ; - sh:datatype xsd:string . + dash:propertyRole dash:LabelRole ; + dash:singleLine true ; + rm:shapeModifiability "system" ; + rm:valueModifiability "system" . # Property of Links -rdf:objectShape - a sh:PropertyShape ; +rdf:objectShape a sh:PropertyShape ; sh:name "Object"^^xsd:string ; sh:description "The object of the subject RDF statement."^^xsd:string ; sh:path rdf:object ; - rm:shapeModifiability "system" ; - rm:valueModifiability "user" ; + sh:nodeKind sh:IRI ; + sh:class rm:Artifact ; sh:minCount 1 ; sh:maxCount 1 ; - sh:nodeKind sh:IRI ; - sh:class rm:Artifact . + rm:shapeModifiability "system" ; + rm:valueModifiability "user" . rdf:subjectShape a sh:PropertyShape ; sh:name "Subject"^^xsd:string ; sh:description "The subject of the subject RDF statement."^^xsd:string ; sh:path rdf:subject ; - rm:shapeModifiability "system" ; - rm:valueModifiability "user" ; + sh:nodeKind sh:IRI ; + sh:class rm:Artifact ; sh:minCount 1 ; sh:maxCount 1 ; - sh:nodeKind sh:IRI ; - sh:class rm:Artifact . + rm:shapeModifiability "system" ; + rm:valueModifiability "user" . rmUserTypes:parentBindingShape a sh:PropertyShape ; sh:name "Parent Binding"^^xsd:string ; sh:description "Parent Binding."^^xsd:string ; sh:path rmUserTypes:parentBinding ; - rm:shapeModifiability "system" ; - rm:valueModifiability "user" ; + sh:nodeKind sh:IRI ; + sh:class rm:Artifact ; sh:minCount 1 ; sh:maxCount 1 ; - sh:nodeKind sh:IRI ; - sh:class rm:Artifact . + rm:shapeModifiability "system" ; + rm:valueModifiability "user" . rmUserTypes:depthShape a sh:PropertyShape ; sh:name "Depth"^^xsd:string ; sh:description "Depth"^^xsd:string ; sh:path rmUserTypes:depth ; - rm:shapeModifiability "system" ; - rm:valueModifiability "user" ; + sh:datatype xsd:integer ; sh:minCount 1 ; sh:maxCount 1 ; - sh:datatype xsd:integer . + rm:shapeModifiability "system" ; + rm:valueModifiability "user" . rmUserTypes:bookOrderShape a sh:PropertyShape ; sh:name "Book Order"^^xsd:string ; sh:description "Book Order"^^xsd:string ; sh:path rmUserTypes:bookOrder ; - rm:shapeModifiability "system" ; - rm:valueModifiability "user" ; + sh:datatype xsd:integer ; sh:minCount 1 ; sh:maxCount 1 ; - sh:datatype xsd:integer . + rm:shapeModifiability "system" ; + rm:valueModifiability "user" . rmUserTypes:sectionNumberShape a sh:PropertyShape ; sh:name "Section Number"^^xsd:string ; sh:description "Section Number"^^xsd:string ; sh:path rmUserTypes:sectionNumber ; - rm:shapeModifiability "system" ; - rm:valueModifiability "user" ; + sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ; - sh:datatype xsd:string . + rm:shapeModifiability "system" ; + rm:valueModifiability "user" . -rmUserTypes:isHeadingShape - a sh:PropertyShape ; +rmUserTypes:isHeadingShape a sh:PropertyShape ; sh:name "Is Heading"^^xsd:string ; sh:description "Is Heading"^^xsd:string ; sh:path rmUserTypes:isHeading ; - rm:shapeModifiability "system" ; - rm:valueModifiability "user" ; + sh:datatype xsd:boolean ; #sh:minCount 1 ; sh:maxCount 1 ; - sh:datatype xsd:boolean . + rm:shapeModifiability "system" ; + rm:valueModifiability "user" . diff --git a/test/SparqlClient.spec.ts b/test/SparqlClient.spec.ts index 68b1fea..7f6ec55 100644 --- a/test/SparqlClient.spec.ts +++ b/test/SparqlClient.spec.ts @@ -83,10 +83,11 @@ afterAll(async () => { describe('SparqlClient', () => { it('SparqlClient should select namespaces', async () => { - expect(repository.ns.current.size).toBe(6); + const initNsSize = Object.keys(rootModelInitialState.ns.current ?? {}).length; + expect(repository.ns.current.size).toBe(initNsSize); await repository.ns.reloadNs(); //console.log(getSnapshot(repository.ns.current)); - expect(repository.ns.current.size).toBeGreaterThan(6); + expect(repository.ns.current.size).toBeGreaterThan(initNsSize); const ns = repository.ns.currentJs; expect(ns.rdf).toBe('http://www.w3.org/1999/02/22-rdf-syntax-ns#'); diff --git a/test/SparqlGen.spec.ts b/test/SparqlGen.spec.ts index 5146df6..f673da2 100644 --- a/test/SparqlGen.spec.ts +++ b/test/SparqlGen.spec.ts @@ -464,6 +464,7 @@ describe('constructObjectsQuery', () => { orderBy: [{ expression: factory.variable('order1'), descending: false }], }, `PREFIX rdf: + PREFIX dash: PREFIX dcterms: PREFIX sh: PREFIX rm: @@ -488,6 +489,10 @@ describe('constructObjectsQuery', () => { ?eIri1 sh:nodeKind ?nodeKind1. ?eIri1 sh:minCount ?minCount1. ?eIri1 sh:maxCount ?maxCount1. + ?eIri1 dash:propertyRole ?propertyRole1. + ?eIri1 dash:editor ?editor1. + ?eIri1 dash:viewer ?viewer1. + ?eIri1 dash:singleLine ?singleLine1. ?eIri1 rm:shapeModifiability ?shapeModifiability1. ?eIri1 rm:valueModifiability ?valueModifiability1. } @@ -513,6 +518,10 @@ describe('constructObjectsQuery', () => { OPTIONAL { ?eIri1 sh:nodeKind ?nodeKind1. } OPTIONAL { ?eIri1 sh:minCount ?minCount1. } OPTIONAL { ?eIri1 sh:maxCount ?maxCount1. } + OPTIONAL { ?eIri1 dash:propertyRole ?propertyRole1. } + OPTIONAL { ?eIri1 dash:editor ?editor1. } + OPTIONAL { ?eIri1 dash:viewer ?viewer1. } + OPTIONAL { ?eIri1 dash:singleLine ?singleLine1. } OPTIONAL { ?eIri1 rm:shapeModifiability ?shapeModifiability1. } OPTIONAL { ?eIri1 rm:valueModifiability ?valueModifiability1. } } @@ -541,6 +550,7 @@ describe('constructObjectsQuery', () => { orderBy: [{ expression: factory.variable('order1'), descending: false }], }, `PREFIX rdf: + PREFIX dash: PREFIX dcterms: PREFIX sh: PREFIX rm: @@ -566,6 +576,10 @@ describe('constructObjectsQuery', () => { ?eIri1 sh:nodeKind ?nodeKind1. ?eIri1 sh:minCount ?minCount1. ?eIri1 sh:maxCount ?maxCount1. + ?eIri1 dash:propertyRole ?propertyRole1. + ?eIri1 dash:editor ?editor1. + ?eIri1 dash:viewer ?viewer1. + ?eIri1 dash:singleLine ?singleLine1. ?eIri1 rm:shapeModifiability ?shapeModifiability1. ?eIri1 rm:valueModifiability ?valueModifiability1. } @@ -591,6 +605,10 @@ describe('constructObjectsQuery', () => { OPTIONAL { ?eIri1 sh:nodeKind ?nodeKind1. } OPTIONAL { ?eIri1 sh:minCount ?minCount1. } OPTIONAL { ?eIri1 sh:maxCount ?maxCount1. } + OPTIONAL { ?eIri1 dash:propertyRole ?propertyRole1. } + OPTIONAL { ?eIri1 dash:editor ?editor1. } + OPTIONAL { ?eIri1 dash:viewer ?viewer1. } + OPTIONAL { ?eIri1 dash:singleLine ?singleLine1. } OPTIONAL { ?eIri1 rm:shapeModifiability ?shapeModifiability1. } OPTIONAL { ?eIri1 rm:valueModifiability ?valueModifiability1. } } diff --git a/test/configTests.ts b/test/configTests.ts index aace3e7..806917a 100644 --- a/test/configTests.ts +++ b/test/configTests.ts @@ -7,14 +7,12 @@ * * SPDX-License-Identifier: GPL-3.0-only ********************************************************************************/ +import { rootModelInitialState } from '../src'; import { JsStrObj } from '../src/ObjectProvider'; import { FileUploadConfig } from '../src/SparqlClient'; export const testNs: JsStrObj = { - rdfs: 'http://www.w3.org/2000/01/rdf-schema#', - rdf: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#', - xsd: 'http://www.w3.org/2001/XMLSchema#', - sesame: 'http://www.openrdf.org/schema/sesame#', + ...rootModelInitialState.ns.current, dcterms: 'http://purl.org/dc/terms/', //dc: 'http://purl.org/dc/elements/1.1/', @@ -23,7 +21,6 @@ export const testNs: JsStrObj = { oslc: 'http://open-services.net/ns/core#', //oslc_rm: 'http://open-services.net/ns/rm#', oslc_asset: 'http://open-services.net/ns/asset#', - sh: 'http://www.w3.org/ns/shacl#', //acl: 'http://www.w3.org/ns/auth/acl#', ppo: 'http://vocab.deri.ie/ppo#',