Skip to content

Commit 96444f1

Browse files
committed
2 parents f352f7d + 384e7a4 commit 96444f1

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

src/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export const PREFIX_RDF = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'
77
export const PREFIX_RDFS = 'http://www.w3.org/2000/01/rdf-schema#'
88
export const PREFIX_SKOS = 'http://www.w3.org/2004/02/skos/core#'
99
export const PREFIX_OWL = 'http://www.w3.org/2002/07/owl#'
10+
export const PREFIX_OA = 'http://www.w3.org/ns/oa#'
1011

1112
export const SHAPES_GRAPH = DataFactory.namedNode('shapes')
1213
export const OWL_IMPORTS = DataFactory.namedNode(PREFIX_OWL + 'imports')

src/property-template.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Literal, NamedNode, BlankNode, Quad, DataFactory } from 'n3'
22
import { Term } from '@rdfjs/types'
3-
import { PREFIX_DASH, PREFIX_RDF, PREFIX_SHACL, SHACL_PREDICATE_CLASS, SHACL_PREDICATE_TARGET_CLASS, SHAPES_GRAPH } from './constants'
3+
import { PREFIX_DASH, PREFIX_OA, PREFIX_RDF, PREFIX_SHACL, SHACL_PREDICATE_CLASS, SHACL_PREDICATE_TARGET_CLASS, SHAPES_GRAPH } from './constants'
44
import { Config } from './config'
55
import { findLabel, removePrefixes } from './util'
66

@@ -22,6 +22,7 @@ const mappers: Record<string, (template: ShaclPropertyTemplate, term: Term) => v
2222
[`${PREFIX_SHACL}pattern`]: (template, term) => { template.pattern = term.value },
2323
[`${PREFIX_SHACL}order`]: (template, term) => { template.order = parseInt(term.value) },
2424
[`${PREFIX_DASH}singleLine`]: (template, term) => { template.singleLine = term.value === 'true' },
25+
[`${PREFIX_OA}styleClass`]: (template, term) => { template.cssClass = term.value },
2526
[`${PREFIX_SHACL}and`]: (template, term) => { template.shaclAnd = term.value },
2627
[`${PREFIX_SHACL}in`]: (template, term) => { template.shaclIn = term.value },
2728
// sh:datatype might be undefined, but sh:languageIn defined. this is undesired. the spec says, that strings without a lang tag are not valid if sh:languageIn is set. but the shacl validator accepts these as valid. to prevent this, we just set the datatype here to 'langString'.
@@ -63,6 +64,7 @@ export class ShaclPropertyTemplate {
6364
minExclusive: number | undefined
6465
maxExclusive: number | undefined
6566
singleLine: boolean | undefined
67+
cssClass: string | undefined
6668
defaultValue: Term | undefined
6769
pattern: string | undefined
6870
order: number | undefined

src/property.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ export class ShaclProperty extends HTMLElement {
2222
if (this.template.order !== undefined) {
2323
this.style.order = `${this.template.order}`
2424
}
25+
if (this.template.cssClass) {
26+
this.classList.add(this.template.cssClass)
27+
}
2528

2629
if (config.editMode) {
2730
this.addButton = document.createElement('a')

0 commit comments

Comments
 (0)