Skip to content

Commit

Permalink
feat(shared dimensions): i14y properties
Browse files Browse the repository at this point in the history
  • Loading branch information
tpluscode committed Nov 27, 2024
1 parent dd7b1c1 commit 841f83d
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/itchy-coats-hide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cube-creator/shared-dimensions-api": minor
---

Added I14Y properties to Shared Dimensions (re https://gitlab.ldbar.ch/zazuko/misc/-/issues/195)
44 changes: 43 additions & 1 deletion apis/shared-dimensions/lib/shapes/shared-dimension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ import { editor, iso6391, md, meta, sh1 } from '@cube-creator/core/namespace'
import { fromPointer as nodeShape } from '@rdfine/shacl/lib/NodeShape'
import { fromPointer as propertyGroup } from '@rdfine/shacl/lib/PropertyGroup'
import { fromPointer as resource } from '@rdfine/rdfs/lib/Resource'
import { dcat } from '@tpluscode/rdf-ns-builders'

const defaultGroup = $rdf.namedNode('#default-group')
const i14yGroup = $rdf.namedNode('#i14y-group')
const datatypeUri = [xsd.anyURI, ['URI']]

const commonProperties = [
Expand All @@ -20,6 +22,46 @@ const commonProperties = [
schema.multipleValues,
]

const i14yProperties = [{
name: 'Identifier',
path: schema.identifier,
order: 10,
datatype: xsd.string,
maxCount: 1,
group: propertyGroup(i14yGroup, {
label: 'I14Y',
}),
}, {
name: 'Version',
path: schema.version,
order: 20,
datatype: xsd.string,
maxCount: 1,
pattern: '^\\d+(\\.\\d+(\\.\\d+)?)?$',
group: i14yGroup,
message: 'Version must be one of the formats: x, x.y, x.y.z',
}, {
name: 'Themes',
path: dcat.theme,
order: 30,
nodeKind: sh.IRI,
editor: dash.URIEditor,
group: i14yGroup,
}, {
name: 'Keywords',
path: dcat.keyword,
order: 40,
nodeKind: sh.Literal,
group: i14yGroup,
}, {
name: 'Conforms to',
path: dcterms.conformsTo,
order: 50,
nodeKind: sh.IRI,
editor: dash.URIEditor,
group: i14yGroup,
}]

const properties: Initializer<PropertyShape>[] = [{
name: 'Name',
path: schema.name,
Expand Down Expand Up @@ -319,7 +361,7 @@ const properties: Initializer<PropertyShape>[] = [{
maxCount: 1,
}],
},
}]
}, ...i14yProperties]

export const create = (): Initializer<NodeShape> => ({
[sh1.xoneDiscriminator.value]: md.createAs,
Expand Down
16 changes: 16 additions & 0 deletions apis/shared-dimensions/lib/store/shapes.ttl
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
PREFIX dcat: <http://www.w3.org/ns/dcat#>
PREFIX dcterm: <http://purl.org/dc/terms/>
PREFIX time: <http://www.w3.org/2006/time#>
PREFIX qudt: <http://qudt.org/schema/qudt/>
Expand Down Expand Up @@ -27,6 +28,21 @@ PREFIX sh: <http://www.w3.org/ns/shacl#>
[
sh:path schema:alternateName ;
],
[
sh:path schema:identifier ;
],
[
sh:path schema:version ;
],
[
sh:path dcat:theme ;
],
[
sh:path dcat:keyword ;
],
[
sh:path dcterm:conformsTo ;
],
[
sh:path sh:property ;
sh:node
Expand Down
2 changes: 1 addition & 1 deletion ui/src/forms/editors/TagsWithLanguageEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<script lang="ts">
import { defineComponent, PropType } from 'vue'
import { PropertyState } from '@hydrofoil/shaperone-core/models/forms'
import $rdf from '@rdfjs/data-model'
import $rdf from '@rdf-esm/data-model'
import type { Literal, Term } from '@rdfjs/types'
export default defineComponent({
Expand Down
2 changes: 1 addition & 1 deletion ui/src/views/ResourcePreview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import { defineComponent, ref, Ref } from 'vue'
import { mapState } from 'vuex'
import { useRoute } from 'vue-router'
import $rdf from '@rdfjs/data-model'
import $rdf from '@rdf-esm/data-model'
import type { NamedNode, Term } from '@rdfjs/types'
import TermSet from '@rdf-esm/term-set'
import RdfResource from '@tpluscode/rdfine/RdfResource'
Expand Down

0 comments on commit 841f83d

Please sign in to comment.