Search is not available for this dataset
id
stringlengths
1
8
text
stringlengths
72
9.81M
addition_count
int64
0
10k
commit_subject
stringlengths
0
3.7k
deletion_count
int64
0
8.43k
file_extension
stringlengths
0
32
lang
stringlengths
1
94
license
stringclasses
10 values
repo_name
stringlengths
9
59
300
<NME> SH.java <BEF> /* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * See the NOTICE file distributed with this work for additional * information regarding copyright ownership. */ package org.topbraid.shacl.vocabulary; import org.apache.jena.rdf.model.Property; import org.apache.jena.rdf.model.Resource; import org.apache.jena.rdf.model.ResourceFactory; import org.apache.jena.sparql.core.Var; /** public final static Resource AbstractResult = ResourceFactory.createResource(NS + "AbstractResult"); public final static Resource BlankNode = ResourceFactory.createResource(NS + "BlankNode"); public final static Resource Constraint = ResourceFactory.createResource(NS + "Constraint"); public final static String NS = BASE_URI; public final static String PREFIX = "sh"; public final static Resource AbstractResult = ResourceFactory.createResource(NS + "AbstractResult"); public final static Resource IRI = ResourceFactory.createResource(NS + "IRI"); public final static Resource Literal = ResourceFactory.createResource(NS + "Literal"); public final static Resource MaxCountConstraintComponent = ResourceFactory.createResource(NS + "MaxCountConstraintComponent"); public final static Resource ClassConstraintComponent = ResourceFactory.createResource(NS + "ClassConstraintComponent"); public final static Resource ClosedConstraintComponent = ResourceFactory.createResource(NS + "ClosedConstraintComponent"); public final static Resource Constraint = ResourceFactory.createResource(NS + "Constraint"); public final static Resource ConstraintComponent = ResourceFactory.createResource(NS + "ConstraintComponent"); public final static Resource DatatypeConstraintComponent = ResourceFactory.createResource(NS + "DatatypeConstraintComponent"); public final static Resource DisjointConstraintComponent = ResourceFactory.createResource(NS + "DisjointConstraintComponent"); public final static Resource EqualsConstraintComponent = ResourceFactory.createResource(NS + "EqualsConstraintComponent"); public final static Resource HasValueConstraintComponent = ResourceFactory.createResource(NS + "HasValueConstraintComponent"); public final static Resource InConstraintComponent = ResourceFactory.createResource(NS + "InConstraintComponent"); public final static Resource Info = ResourceFactory.createResource(NS + "Info"); public final static Resource IRI = ResourceFactory.createResource(NS + "IRI"); public final static Resource IRIOrLiteral = ResourceFactory.createResource(NS + "IRIOrLiteral"); public final static Resource LanguageInConstraintComponent = ResourceFactory.createResource(NS + "LanguageInConstraintComponent"); public final static Resource LessThanConstraintComponent = ResourceFactory.createResource(NS + "LessThanConstraintComponent"); public final static Resource LessThanOrEqualsConstraintComponent = ResourceFactory.createResource(NS + "LessThanOrEqualsConstraintComponent"); public final static Resource Literal = ResourceFactory.createResource(NS + "Literal"); public final static Resource MaxCountConstraintComponent = ResourceFactory.createResource(NS + "MaxCountConstraintComponent"); public final static Resource MaxExclusiveConstraintComponent = ResourceFactory.createResource(NS + "MaxExclusiveConstraintComponent"); public final static Resource MaxInclusiveConstraintComponent = ResourceFactory.createResource(NS + "MaxInclusiveConstraintComponent"); public final static Resource MaxLengthConstraintComponent = ResourceFactory.createResource(NS + "MaxLengthConstraintComponent"); public final static Resource MinCountConstraintComponent = ResourceFactory.createResource(NS + "MinCountConstraintComponent"); public final static Resource MinExclusiveConstraintComponent = ResourceFactory.createResource(NS + "MinExclusiveConstraintComponent"); public final static Resource MinInclusiveConstraintComponent = ResourceFactory.createResource(NS + "MinInclusiveConstraintComponent"); public final static Resource MinLengthConstraintComponent = ResourceFactory.createResource(NS + "MinLengthConstraintComponent"); public final static Resource NodeConstraintComponent = ResourceFactory.createResource(NS + "NodeConstraintComponent"); public final static Resource NodeKindConstraintComponent = ResourceFactory.createResource(NS + "NodeKindConstraintComponent"); public final static Resource NodeShape = ResourceFactory.createResource(NS + "NodeShape"); public final static Resource NotConstraintComponent = ResourceFactory.createResource(NS + "NotConstraintComponent"); public final static Resource OrConstraintComponent = ResourceFactory.createResource(NS + "OrConstraintComponent"); public final static Resource Parameter = ResourceFactory.createResource(NS + "Parameter"); public final static Resource Parameterizable = ResourceFactory.createResource(NS + "Parameterizable"); public final static Resource PatternConstraintComponent = ResourceFactory.createResource(NS + "PatternConstraintComponent"); public final static Resource PrefixDeclaration = ResourceFactory.createResource(NS + "PrefixDeclaration"); public final static Resource PropertyGroup = ResourceFactory.createResource(NS + "PropertyGroup"); public final static Resource PropertyShape = ResourceFactory.createResource(NS + "PropertyShape"); public final static Resource PropertyConstraintComponent = ResourceFactory.createResource(NS + "PropertyConstraintComponent"); public final static Resource QualifiedMaxCountConstraintComponent = ResourceFactory.createResource(NS + "QualifiedMaxCountConstraintComponent"); public final static Resource QualifiedMinCountConstraintComponent = ResourceFactory.createResource(NS + "QualifiedMinCountConstraintComponent"); public final static Resource ResultAnnotation = ResourceFactory.createResource(NS + "ResultAnnotation"); public final static Resource Shape = ResourceFactory.createResource(NS + "Shape"); public final static Resource SPARQLAskValidator = ResourceFactory.createResource(NS + "SPARQLAskValidator"); public final static Resource SPARQLConstraint = ResourceFactory.createResource(NS + "SPARQLConstraint"); public final static Resource SPARQLConstraintComponent = ResourceFactory.createResource(NS + "SPARQLConstraintComponent"); public final static Resource SPARQLConstructRule = ResourceFactory.createResource(NS + "SPARQLConstructRule"); public final static Resource SPARQLExecutable = ResourceFactory.createResource(NS + "SPARQLExecutable"); public final static Resource SPARQLFunction = ResourceFactory.createResource(NS + "SPARQLFunction"); public final static Resource SPARQLSelectValidator = ResourceFactory.createResource(NS + "SPARQLSelectValidator"); public final static Resource SPARQLTarget = ResourceFactory.createResource(NS + "SPARQLTarget"); public final static Resource SPARQLValuesDeriver = ResourceFactory.createResource(NS + "SPARQLValuesDeriver"); public final static Resource UniqueLangConstraintComponent = ResourceFactory.createResource(NS + "UniqueLangConstraintComponent"); public final static Resource ValidationReport = ResourceFactory.createResource(NS + "ValidationReport"); public final static Resource ValidationResult = ResourceFactory.createResource(NS + "ValidationResult"); public final static Resource Validator = ResourceFactory.createResource(NS + "Validator"); public final static Resource Violation = ResourceFactory.createResource(NS + "Violation"); public final static Resource Warning = ResourceFactory.createResource(NS + "Warning"); public final static Resource XoneConstraintComponent = ResourceFactory.createResource(NS + "XoneConstraintComponent"); public final static Property alternativePath = ResourceFactory.createProperty(NS + "alternativePath"); public final static Property and = ResourceFactory.createProperty(NS + "and"); public final static Property ask = ResourceFactory.createProperty(NS + "ask"); public final static Property class_ = ResourceFactory.createProperty(NS + "class"); public final static Property closed = ResourceFactory.createProperty(NS + "closed"); public final static Property condition = ResourceFactory.createProperty(NS + "condition"); public final static Property conforms = ResourceFactory.createProperty(NS + "conforms"); public final static Property construct = ResourceFactory.createProperty(NS + "construct"); public final static Property datatype = ResourceFactory.createProperty(NS + "datatype"); public final static Property deactivated = ResourceFactory.createProperty(NS + "deactivated"); public final static Property declare = ResourceFactory.createProperty(NS + "declare"); public final static Property defaultValue = ResourceFactory.createProperty(NS + "defaultValue"); public final static Property detail = ResourceFactory.createProperty(NS + "detail"); public final static Property description = ResourceFactory.createProperty(NS + "description"); public final static Property disjoint = ResourceFactory.createProperty(NS + "disjoint"); public final static Property entailment = ResourceFactory.createProperty(NS + "entailment"); public final static Property equals = ResourceFactory.createProperty(NS + "equals"); public final static Property flags = ResourceFactory.createProperty(NS + "flags"); public final static Property focusNode = ResourceFactory.createProperty(NS + "focusNode"); public final static Property group = ResourceFactory.createProperty(NS + "group"); public final static Property hasValue = ResourceFactory.createProperty(NS + "hasValue"); public final static Property ignoredProperties = ResourceFactory.createProperty(NS + "ignoredProperties"); public final static Property in = ResourceFactory.createProperty(NS + "in"); public final static Property inversePath = ResourceFactory.createProperty(NS + "inversePath"); public final static Property labelTemplate = ResourceFactory.createProperty(NS + "labelTemplate"); public final static Property languageIn = ResourceFactory.createProperty(NS + "languageIn"); public final static Property lessThan = ResourceFactory.createProperty(NS + "lessThan"); public final static Property lessThanOrEquals = ResourceFactory.createProperty(NS + "lessThanOrEquals"); public final static Property maxCount = ResourceFactory.createProperty(NS + "maxCount"); public final static Property maxExclusive = ResourceFactory.createProperty(NS + "maxExclusive"); public final static Property maxInclusive = ResourceFactory.createProperty(NS + "maxInclusive"); public final static Property maxLength = ResourceFactory.createProperty(NS + "maxLength"); public final static Property message = ResourceFactory.createProperty(NS + "message"); public final static Property minCount = ResourceFactory.createProperty(NS + "minCount"); public final static Property minExclusive = ResourceFactory.createProperty(NS + "minExclusive"); public final static Property minInclusive = ResourceFactory.createProperty(NS + "minInclusive"); public final static Property minLength = ResourceFactory.createProperty(NS + "minLength"); public final static Property name = ResourceFactory.createProperty(NS + "name"); public final static Property namespace = ResourceFactory.createProperty(NS + "namespace"); public final static Property node = ResourceFactory.createProperty(NS + "node"); public final static Property nodeKind = ResourceFactory.createProperty(NS + "nodeKind"); public final static Property nodeValidator = ResourceFactory.createProperty(NS + "nodeValidator"); public final static Property not = ResourceFactory.createProperty(NS + "not"); public final static Property oneOrMorePath = ResourceFactory.createProperty(NS + "oneOrMorePath"); public final static Property optional = ResourceFactory.createProperty(NS + "optional"); public final static Property or = ResourceFactory.createProperty(NS + "or"); public final static Property order = ResourceFactory.createProperty(NS + "order"); public final static Property parameter = ResourceFactory.createProperty(NS + "parameter"); public final static Property path = ResourceFactory.createProperty(NS + "path"); public final static Property pattern = ResourceFactory.createProperty(NS + "pattern"); public final static Property prefix = ResourceFactory.createProperty(NS + "prefix"); public final static Property prefixes = ResourceFactory.createProperty(NS + "prefixes"); public final static Property property = ResourceFactory.createProperty(NS + "property"); public final static Property propertyValidator = ResourceFactory.createProperty(NS + "propertyValidator"); public final static Property qualifiedMaxCount = ResourceFactory.createProperty(NS + "qualifiedMaxCount"); public final static Property qualifiedMinCount = ResourceFactory.createProperty(NS + "qualifiedMinCount"); public final static Property qualifiedValueShape = ResourceFactory.createProperty(NS + "qualifiedValueShape"); public final static Property qualifiedValueShapesDisjoint = ResourceFactory.createProperty(NS + "qualifiedValueShapesDisjoint"); public final static Property result = ResourceFactory.createProperty(NS + "result"); public final static Property resultMessage = ResourceFactory.createProperty(NS + "resultMessage"); public final static Property resultPath = ResourceFactory.createProperty(NS + "resultPath"); public final static Property resultSeverity = ResourceFactory.createProperty(NS + "resultSeverity"); public final static Property select = ResourceFactory.createProperty(NS + "select"); public final static Property severity = ResourceFactory.createProperty(NS + "severity"); public final static Property shapesGraph = ResourceFactory.createProperty(NS + "shapesGraph"); public final static Property sourceConstraint = ResourceFactory.createProperty(NS + "sourceConstraint"); public final static Property sourceConstraintComponent = ResourceFactory.createProperty(NS + "sourceConstraintComponent"); public final static Property sourceShape = ResourceFactory.createProperty(NS + "sourceShape"); public final static Property sparql = ResourceFactory.createProperty(NS + "sparql"); public final static Property targetClass = ResourceFactory.createProperty(NS + "targetClass"); public final static Property targetNode = ResourceFactory.createProperty(NS + "targetNode"); public final static Property targetObjectsOf = ResourceFactory.createProperty(NS + "targetObjectsOf"); public final static Property targetSubjectsOf = ResourceFactory.createProperty(NS + "targetSubjectsOf"); public final static Property uniqueLang = ResourceFactory.createProperty(NS + "uniqueLang"); public final static Property update = ResourceFactory.createProperty(NS + "update"); public final static Property validator = ResourceFactory.createProperty(NS + "validator"); public final static Property value = ResourceFactory.createProperty(NS + "value"); public final static Property zeroOrMorePath = ResourceFactory.createProperty(NS + "zeroOrMorePath"); public final static Property zeroOrOnePath = ResourceFactory.createProperty(NS + "zeroOrOnePath"); // Advanced features public final static Resource ExpressionConstraintComponent = ResourceFactory.createResource(NS + "ExpressionConstraintComponent"); public final static Resource Function = ResourceFactory.createResource(NS + "Function"); public final static Resource JSConstraint = ResourceFactory.createResource(NS + "JSConstraint"); public final static Resource JSConstraintComponent = ResourceFactory.createResource(NS + "JSConstraintComponent"); public final static Resource JSExecutable = ResourceFactory.createResource(NS + "JSExecutable"); public final static Resource JSFunction = ResourceFactory.createResource(NS + "JSFunction"); public final static Resource JSLibrary = ResourceFactory.createResource(NS + "JSLibrary"); public final static Resource JSRule = ResourceFactory.createResource(NS + "JSRule"); public final static Resource JSTarget = ResourceFactory.createResource(NS + "JSTarget"); public final static Resource JSTargetType = ResourceFactory.createResource(NS + "JSTargetType"); public final static Resource JSValidator = ResourceFactory.createResource(NS + "JSValidator"); public final static Resource Rule = ResourceFactory.createResource(NS + "Rule"); public final static Resource Rules = ResourceFactory.createResource(NS + "Rules"); public final static Resource SPARQLRule = ResourceFactory.createResource(NS + "SPARQLRule"); public final static Resource Target = ResourceFactory.createResource(NS + "Target"); public final static Resource this_ = ResourceFactory.createResource(NS + "this"); public final static Resource TripleRule = ResourceFactory.createResource(NS + "TripleRule"); public final static Property expression = ResourceFactory.createProperty(NS + "expression"); public final static Property filterShape = ResourceFactory.createProperty(NS + "filterShape"); public final static Property intersection = ResourceFactory.createProperty(NS + "intersection"); public final static Property js = ResourceFactory.createProperty(NS + "js"); public final static Property jsFunctionName = ResourceFactory.createProperty(NS + "jsFunctionName"); public final static Property jsLibrary = ResourceFactory.createProperty(NS + "jsLibrary"); public final static Property jsLibraryURL = ResourceFactory.createProperty(NS + "jsLibraryURL"); public final static Property member = ResourceFactory.createProperty(NS + "member"); public final static Property nodes = ResourceFactory.createProperty(NS + "nodes"); public final static Property object = ResourceFactory.createProperty(NS + "object"); public final static Property predicate = ResourceFactory.createProperty(NS + "predicate"); public final static Property returnType = ResourceFactory.createProperty(NS + "returnType"); public final static Property rule = ResourceFactory.createProperty(NS + "rule"); public final static Property subject = ResourceFactory.createProperty(NS + "subject"); public final static Property target = ResourceFactory.createProperty(NS + "target"); public final static Property union = ResourceFactory.createProperty(NS + "union"); // Features not in SHACL 1.0 but candidates for next release public final static Property count = ResourceFactory.createProperty(NS + "count"); public final static Property desc = ResourceFactory.createProperty(NS + "desc"); public final static Property distinct = ResourceFactory.createProperty(NS + "distinct"); public final static Property else_ = ResourceFactory.createProperty(NS + "else"); public final static Property exists = ResourceFactory.createProperty(NS + "exists"); public final static Property groupConcat = ResourceFactory.createProperty(NS + "groupConcat"); public final static Property if_ = ResourceFactory.createProperty(NS + "if"); public final static Property limit = ResourceFactory.createProperty(NS + "limit"); public final static Property max = ResourceFactory.createProperty(NS + "max"); public final static Property min = ResourceFactory.createProperty(NS + "min"); public final static Property minus = ResourceFactory.createProperty(NS + "minus"); public final static Property offset = ResourceFactory.createProperty(NS + "offset"); public final static Property orderBy = ResourceFactory.createProperty(NS + "orderBy"); public final static Property separator = ResourceFactory.createProperty(NS + "separator"); public final static Property sum = ResourceFactory.createProperty(NS + "sum"); public final static Property then = ResourceFactory.createProperty(NS + "then"); public final static Property values = ResourceFactory.createProperty(NS + "values"); public static final Var currentShapeVar = Var.alloc("currentShape"); public static final Var failureVar = Var.alloc("failure"); public static final Var PATHVar = Var.alloc("PATH"); public static final Var pathVar = Var.alloc(path.getLocalName()); public static final Var shapesGraphVar = Var.alloc("shapesGraph"); public static final Var thisVar = Var.alloc("this"); public static final Var valueVar = Var.alloc("value"); public final static String JS_DATA_VAR = "$data"; public final static String JS_SHAPES_VAR = "$shapes"; public static String getURI() { return NS; } } <MSG> Updated SHACL API to align with upcoming TopBraid 5.2 beta release <DFF> @@ -25,6 +25,10 @@ public class SH { public final static Resource AbstractResult = ResourceFactory.createResource(NS + "AbstractResult"); public final static Resource BlankNode = ResourceFactory.createResource(NS + "BlankNode"); + + public final static Resource BlankNodeOrIRI = ResourceFactory.createResource(NS + "BlankNodeOrIRI"); + + public final static Resource BlankNodeOrLiteral = ResourceFactory.createResource(NS + "BlankNodeOrLiteral"); public final static Resource Constraint = ResourceFactory.createResource(NS + "Constraint"); @@ -38,6 +42,8 @@ public class SH { public final static Resource IRI = ResourceFactory.createResource(NS + "IRI"); + public final static Resource IRIOrLiteral = ResourceFactory.createResource(NS + "IRIOrLiteral"); + public final static Resource Literal = ResourceFactory.createResource(NS + "Literal"); public final static Resource MaxCountConstraintComponent = ResourceFactory.createResource(NS + "MaxCountConstraintComponent");
6
Updated SHACL API to align with upcoming TopBraid 5.2 beta release
0
.java
java
apache-2.0
TopQuadrant/shacl
301
<NME> SH.java <BEF> /* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * See the NOTICE file distributed with this work for additional * information regarding copyright ownership. */ package org.topbraid.shacl.vocabulary; import org.apache.jena.rdf.model.Property; import org.apache.jena.rdf.model.Resource; import org.apache.jena.rdf.model.ResourceFactory; import org.apache.jena.sparql.core.Var; /** public final static Resource AbstractResult = ResourceFactory.createResource(NS + "AbstractResult"); public final static Resource BlankNode = ResourceFactory.createResource(NS + "BlankNode"); public final static Resource Constraint = ResourceFactory.createResource(NS + "Constraint"); public final static String NS = BASE_URI; public final static String PREFIX = "sh"; public final static Resource AbstractResult = ResourceFactory.createResource(NS + "AbstractResult"); public final static Resource IRI = ResourceFactory.createResource(NS + "IRI"); public final static Resource Literal = ResourceFactory.createResource(NS + "Literal"); public final static Resource MaxCountConstraintComponent = ResourceFactory.createResource(NS + "MaxCountConstraintComponent"); public final static Resource ClassConstraintComponent = ResourceFactory.createResource(NS + "ClassConstraintComponent"); public final static Resource ClosedConstraintComponent = ResourceFactory.createResource(NS + "ClosedConstraintComponent"); public final static Resource Constraint = ResourceFactory.createResource(NS + "Constraint"); public final static Resource ConstraintComponent = ResourceFactory.createResource(NS + "ConstraintComponent"); public final static Resource DatatypeConstraintComponent = ResourceFactory.createResource(NS + "DatatypeConstraintComponent"); public final static Resource DisjointConstraintComponent = ResourceFactory.createResource(NS + "DisjointConstraintComponent"); public final static Resource EqualsConstraintComponent = ResourceFactory.createResource(NS + "EqualsConstraintComponent"); public final static Resource HasValueConstraintComponent = ResourceFactory.createResource(NS + "HasValueConstraintComponent"); public final static Resource InConstraintComponent = ResourceFactory.createResource(NS + "InConstraintComponent"); public final static Resource Info = ResourceFactory.createResource(NS + "Info"); public final static Resource IRI = ResourceFactory.createResource(NS + "IRI"); public final static Resource IRIOrLiteral = ResourceFactory.createResource(NS + "IRIOrLiteral"); public final static Resource LanguageInConstraintComponent = ResourceFactory.createResource(NS + "LanguageInConstraintComponent"); public final static Resource LessThanConstraintComponent = ResourceFactory.createResource(NS + "LessThanConstraintComponent"); public final static Resource LessThanOrEqualsConstraintComponent = ResourceFactory.createResource(NS + "LessThanOrEqualsConstraintComponent"); public final static Resource Literal = ResourceFactory.createResource(NS + "Literal"); public final static Resource MaxCountConstraintComponent = ResourceFactory.createResource(NS + "MaxCountConstraintComponent"); public final static Resource MaxExclusiveConstraintComponent = ResourceFactory.createResource(NS + "MaxExclusiveConstraintComponent"); public final static Resource MaxInclusiveConstraintComponent = ResourceFactory.createResource(NS + "MaxInclusiveConstraintComponent"); public final static Resource MaxLengthConstraintComponent = ResourceFactory.createResource(NS + "MaxLengthConstraintComponent"); public final static Resource MinCountConstraintComponent = ResourceFactory.createResource(NS + "MinCountConstraintComponent"); public final static Resource MinExclusiveConstraintComponent = ResourceFactory.createResource(NS + "MinExclusiveConstraintComponent"); public final static Resource MinInclusiveConstraintComponent = ResourceFactory.createResource(NS + "MinInclusiveConstraintComponent"); public final static Resource MinLengthConstraintComponent = ResourceFactory.createResource(NS + "MinLengthConstraintComponent"); public final static Resource NodeConstraintComponent = ResourceFactory.createResource(NS + "NodeConstraintComponent"); public final static Resource NodeKindConstraintComponent = ResourceFactory.createResource(NS + "NodeKindConstraintComponent"); public final static Resource NodeShape = ResourceFactory.createResource(NS + "NodeShape"); public final static Resource NotConstraintComponent = ResourceFactory.createResource(NS + "NotConstraintComponent"); public final static Resource OrConstraintComponent = ResourceFactory.createResource(NS + "OrConstraintComponent"); public final static Resource Parameter = ResourceFactory.createResource(NS + "Parameter"); public final static Resource Parameterizable = ResourceFactory.createResource(NS + "Parameterizable"); public final static Resource PatternConstraintComponent = ResourceFactory.createResource(NS + "PatternConstraintComponent"); public final static Resource PrefixDeclaration = ResourceFactory.createResource(NS + "PrefixDeclaration"); public final static Resource PropertyGroup = ResourceFactory.createResource(NS + "PropertyGroup"); public final static Resource PropertyShape = ResourceFactory.createResource(NS + "PropertyShape"); public final static Resource PropertyConstraintComponent = ResourceFactory.createResource(NS + "PropertyConstraintComponent"); public final static Resource QualifiedMaxCountConstraintComponent = ResourceFactory.createResource(NS + "QualifiedMaxCountConstraintComponent"); public final static Resource QualifiedMinCountConstraintComponent = ResourceFactory.createResource(NS + "QualifiedMinCountConstraintComponent"); public final static Resource ResultAnnotation = ResourceFactory.createResource(NS + "ResultAnnotation"); public final static Resource Shape = ResourceFactory.createResource(NS + "Shape"); public final static Resource SPARQLAskValidator = ResourceFactory.createResource(NS + "SPARQLAskValidator"); public final static Resource SPARQLConstraint = ResourceFactory.createResource(NS + "SPARQLConstraint"); public final static Resource SPARQLConstraintComponent = ResourceFactory.createResource(NS + "SPARQLConstraintComponent"); public final static Resource SPARQLConstructRule = ResourceFactory.createResource(NS + "SPARQLConstructRule"); public final static Resource SPARQLExecutable = ResourceFactory.createResource(NS + "SPARQLExecutable"); public final static Resource SPARQLFunction = ResourceFactory.createResource(NS + "SPARQLFunction"); public final static Resource SPARQLSelectValidator = ResourceFactory.createResource(NS + "SPARQLSelectValidator"); public final static Resource SPARQLTarget = ResourceFactory.createResource(NS + "SPARQLTarget"); public final static Resource SPARQLValuesDeriver = ResourceFactory.createResource(NS + "SPARQLValuesDeriver"); public final static Resource UniqueLangConstraintComponent = ResourceFactory.createResource(NS + "UniqueLangConstraintComponent"); public final static Resource ValidationReport = ResourceFactory.createResource(NS + "ValidationReport"); public final static Resource ValidationResult = ResourceFactory.createResource(NS + "ValidationResult"); public final static Resource Validator = ResourceFactory.createResource(NS + "Validator"); public final static Resource Violation = ResourceFactory.createResource(NS + "Violation"); public final static Resource Warning = ResourceFactory.createResource(NS + "Warning"); public final static Resource XoneConstraintComponent = ResourceFactory.createResource(NS + "XoneConstraintComponent"); public final static Property alternativePath = ResourceFactory.createProperty(NS + "alternativePath"); public final static Property and = ResourceFactory.createProperty(NS + "and"); public final static Property ask = ResourceFactory.createProperty(NS + "ask"); public final static Property class_ = ResourceFactory.createProperty(NS + "class"); public final static Property closed = ResourceFactory.createProperty(NS + "closed"); public final static Property condition = ResourceFactory.createProperty(NS + "condition"); public final static Property conforms = ResourceFactory.createProperty(NS + "conforms"); public final static Property construct = ResourceFactory.createProperty(NS + "construct"); public final static Property datatype = ResourceFactory.createProperty(NS + "datatype"); public final static Property deactivated = ResourceFactory.createProperty(NS + "deactivated"); public final static Property declare = ResourceFactory.createProperty(NS + "declare"); public final static Property defaultValue = ResourceFactory.createProperty(NS + "defaultValue"); public final static Property detail = ResourceFactory.createProperty(NS + "detail"); public final static Property description = ResourceFactory.createProperty(NS + "description"); public final static Property disjoint = ResourceFactory.createProperty(NS + "disjoint"); public final static Property entailment = ResourceFactory.createProperty(NS + "entailment"); public final static Property equals = ResourceFactory.createProperty(NS + "equals"); public final static Property flags = ResourceFactory.createProperty(NS + "flags"); public final static Property focusNode = ResourceFactory.createProperty(NS + "focusNode"); public final static Property group = ResourceFactory.createProperty(NS + "group"); public final static Property hasValue = ResourceFactory.createProperty(NS + "hasValue"); public final static Property ignoredProperties = ResourceFactory.createProperty(NS + "ignoredProperties"); public final static Property in = ResourceFactory.createProperty(NS + "in"); public final static Property inversePath = ResourceFactory.createProperty(NS + "inversePath"); public final static Property labelTemplate = ResourceFactory.createProperty(NS + "labelTemplate"); public final static Property languageIn = ResourceFactory.createProperty(NS + "languageIn"); public final static Property lessThan = ResourceFactory.createProperty(NS + "lessThan"); public final static Property lessThanOrEquals = ResourceFactory.createProperty(NS + "lessThanOrEquals"); public final static Property maxCount = ResourceFactory.createProperty(NS + "maxCount"); public final static Property maxExclusive = ResourceFactory.createProperty(NS + "maxExclusive"); public final static Property maxInclusive = ResourceFactory.createProperty(NS + "maxInclusive"); public final static Property maxLength = ResourceFactory.createProperty(NS + "maxLength"); public final static Property message = ResourceFactory.createProperty(NS + "message"); public final static Property minCount = ResourceFactory.createProperty(NS + "minCount"); public final static Property minExclusive = ResourceFactory.createProperty(NS + "minExclusive"); public final static Property minInclusive = ResourceFactory.createProperty(NS + "minInclusive"); public final static Property minLength = ResourceFactory.createProperty(NS + "minLength"); public final static Property name = ResourceFactory.createProperty(NS + "name"); public final static Property namespace = ResourceFactory.createProperty(NS + "namespace"); public final static Property node = ResourceFactory.createProperty(NS + "node"); public final static Property nodeKind = ResourceFactory.createProperty(NS + "nodeKind"); public final static Property nodeValidator = ResourceFactory.createProperty(NS + "nodeValidator"); public final static Property not = ResourceFactory.createProperty(NS + "not"); public final static Property oneOrMorePath = ResourceFactory.createProperty(NS + "oneOrMorePath"); public final static Property optional = ResourceFactory.createProperty(NS + "optional"); public final static Property or = ResourceFactory.createProperty(NS + "or"); public final static Property order = ResourceFactory.createProperty(NS + "order"); public final static Property parameter = ResourceFactory.createProperty(NS + "parameter"); public final static Property path = ResourceFactory.createProperty(NS + "path"); public final static Property pattern = ResourceFactory.createProperty(NS + "pattern"); public final static Property prefix = ResourceFactory.createProperty(NS + "prefix"); public final static Property prefixes = ResourceFactory.createProperty(NS + "prefixes"); public final static Property property = ResourceFactory.createProperty(NS + "property"); public final static Property propertyValidator = ResourceFactory.createProperty(NS + "propertyValidator"); public final static Property qualifiedMaxCount = ResourceFactory.createProperty(NS + "qualifiedMaxCount"); public final static Property qualifiedMinCount = ResourceFactory.createProperty(NS + "qualifiedMinCount"); public final static Property qualifiedValueShape = ResourceFactory.createProperty(NS + "qualifiedValueShape"); public final static Property qualifiedValueShapesDisjoint = ResourceFactory.createProperty(NS + "qualifiedValueShapesDisjoint"); public final static Property result = ResourceFactory.createProperty(NS + "result"); public final static Property resultMessage = ResourceFactory.createProperty(NS + "resultMessage"); public final static Property resultPath = ResourceFactory.createProperty(NS + "resultPath"); public final static Property resultSeverity = ResourceFactory.createProperty(NS + "resultSeverity"); public final static Property select = ResourceFactory.createProperty(NS + "select"); public final static Property severity = ResourceFactory.createProperty(NS + "severity"); public final static Property shapesGraph = ResourceFactory.createProperty(NS + "shapesGraph"); public final static Property sourceConstraint = ResourceFactory.createProperty(NS + "sourceConstraint"); public final static Property sourceConstraintComponent = ResourceFactory.createProperty(NS + "sourceConstraintComponent"); public final static Property sourceShape = ResourceFactory.createProperty(NS + "sourceShape"); public final static Property sparql = ResourceFactory.createProperty(NS + "sparql"); public final static Property targetClass = ResourceFactory.createProperty(NS + "targetClass"); public final static Property targetNode = ResourceFactory.createProperty(NS + "targetNode"); public final static Property targetObjectsOf = ResourceFactory.createProperty(NS + "targetObjectsOf"); public final static Property targetSubjectsOf = ResourceFactory.createProperty(NS + "targetSubjectsOf"); public final static Property uniqueLang = ResourceFactory.createProperty(NS + "uniqueLang"); public final static Property update = ResourceFactory.createProperty(NS + "update"); public final static Property validator = ResourceFactory.createProperty(NS + "validator"); public final static Property value = ResourceFactory.createProperty(NS + "value"); public final static Property zeroOrMorePath = ResourceFactory.createProperty(NS + "zeroOrMorePath"); public final static Property zeroOrOnePath = ResourceFactory.createProperty(NS + "zeroOrOnePath"); // Advanced features public final static Resource ExpressionConstraintComponent = ResourceFactory.createResource(NS + "ExpressionConstraintComponent"); public final static Resource Function = ResourceFactory.createResource(NS + "Function"); public final static Resource JSConstraint = ResourceFactory.createResource(NS + "JSConstraint"); public final static Resource JSConstraintComponent = ResourceFactory.createResource(NS + "JSConstraintComponent"); public final static Resource JSExecutable = ResourceFactory.createResource(NS + "JSExecutable"); public final static Resource JSFunction = ResourceFactory.createResource(NS + "JSFunction"); public final static Resource JSLibrary = ResourceFactory.createResource(NS + "JSLibrary"); public final static Resource JSRule = ResourceFactory.createResource(NS + "JSRule"); public final static Resource JSTarget = ResourceFactory.createResource(NS + "JSTarget"); public final static Resource JSTargetType = ResourceFactory.createResource(NS + "JSTargetType"); public final static Resource JSValidator = ResourceFactory.createResource(NS + "JSValidator"); public final static Resource Rule = ResourceFactory.createResource(NS + "Rule"); public final static Resource Rules = ResourceFactory.createResource(NS + "Rules"); public final static Resource SPARQLRule = ResourceFactory.createResource(NS + "SPARQLRule"); public final static Resource Target = ResourceFactory.createResource(NS + "Target"); public final static Resource this_ = ResourceFactory.createResource(NS + "this"); public final static Resource TripleRule = ResourceFactory.createResource(NS + "TripleRule"); public final static Property expression = ResourceFactory.createProperty(NS + "expression"); public final static Property filterShape = ResourceFactory.createProperty(NS + "filterShape"); public final static Property intersection = ResourceFactory.createProperty(NS + "intersection"); public final static Property js = ResourceFactory.createProperty(NS + "js"); public final static Property jsFunctionName = ResourceFactory.createProperty(NS + "jsFunctionName"); public final static Property jsLibrary = ResourceFactory.createProperty(NS + "jsLibrary"); public final static Property jsLibraryURL = ResourceFactory.createProperty(NS + "jsLibraryURL"); public final static Property member = ResourceFactory.createProperty(NS + "member"); public final static Property nodes = ResourceFactory.createProperty(NS + "nodes"); public final static Property object = ResourceFactory.createProperty(NS + "object"); public final static Property predicate = ResourceFactory.createProperty(NS + "predicate"); public final static Property returnType = ResourceFactory.createProperty(NS + "returnType"); public final static Property rule = ResourceFactory.createProperty(NS + "rule"); public final static Property subject = ResourceFactory.createProperty(NS + "subject"); public final static Property target = ResourceFactory.createProperty(NS + "target"); public final static Property union = ResourceFactory.createProperty(NS + "union"); // Features not in SHACL 1.0 but candidates for next release public final static Property count = ResourceFactory.createProperty(NS + "count"); public final static Property desc = ResourceFactory.createProperty(NS + "desc"); public final static Property distinct = ResourceFactory.createProperty(NS + "distinct"); public final static Property else_ = ResourceFactory.createProperty(NS + "else"); public final static Property exists = ResourceFactory.createProperty(NS + "exists"); public final static Property groupConcat = ResourceFactory.createProperty(NS + "groupConcat"); public final static Property if_ = ResourceFactory.createProperty(NS + "if"); public final static Property limit = ResourceFactory.createProperty(NS + "limit"); public final static Property max = ResourceFactory.createProperty(NS + "max"); public final static Property min = ResourceFactory.createProperty(NS + "min"); public final static Property minus = ResourceFactory.createProperty(NS + "minus"); public final static Property offset = ResourceFactory.createProperty(NS + "offset"); public final static Property orderBy = ResourceFactory.createProperty(NS + "orderBy"); public final static Property separator = ResourceFactory.createProperty(NS + "separator"); public final static Property sum = ResourceFactory.createProperty(NS + "sum"); public final static Property then = ResourceFactory.createProperty(NS + "then"); public final static Property values = ResourceFactory.createProperty(NS + "values"); public static final Var currentShapeVar = Var.alloc("currentShape"); public static final Var failureVar = Var.alloc("failure"); public static final Var PATHVar = Var.alloc("PATH"); public static final Var pathVar = Var.alloc(path.getLocalName()); public static final Var shapesGraphVar = Var.alloc("shapesGraph"); public static final Var thisVar = Var.alloc("this"); public static final Var valueVar = Var.alloc("value"); public final static String JS_DATA_VAR = "$data"; public final static String JS_SHAPES_VAR = "$shapes"; public static String getURI() { return NS; } } <MSG> Updated SHACL API to align with upcoming TopBraid 5.2 beta release <DFF> @@ -25,6 +25,10 @@ public class SH { public final static Resource AbstractResult = ResourceFactory.createResource(NS + "AbstractResult"); public final static Resource BlankNode = ResourceFactory.createResource(NS + "BlankNode"); + + public final static Resource BlankNodeOrIRI = ResourceFactory.createResource(NS + "BlankNodeOrIRI"); + + public final static Resource BlankNodeOrLiteral = ResourceFactory.createResource(NS + "BlankNodeOrLiteral"); public final static Resource Constraint = ResourceFactory.createResource(NS + "Constraint"); @@ -38,6 +42,8 @@ public class SH { public final static Resource IRI = ResourceFactory.createResource(NS + "IRI"); + public final static Resource IRIOrLiteral = ResourceFactory.createResource(NS + "IRIOrLiteral"); + public final static Resource Literal = ResourceFactory.createResource(NS + "Literal"); public final static Resource MaxCountConstraintComponent = ResourceFactory.createResource(NS + "MaxCountConstraintComponent");
6
Updated SHACL API to align with upcoming TopBraid 5.2 beta release
0
.java
java
apache-2.0
TopQuadrant/shacl
302
<NME> xone-001.test.ttl <BEF> ADDFILE <MSG> Fixed bug in native validator of sh:xone, added test case <DFF> @@ -0,0 +1,60 @@ +# baseURI: http://datashapes.org/sh/tests/core/property/xone-001.test +# imports: http://datashapes.org/dash +# prefix: ex + +@prefix dash: <http://datashapes.org/dash#> . +@prefix ex: <http://datashapes.org/sh/tests/core/property/xone-001.test#> . +@prefix owl: <http://www.w3.org/2002/07/owl#> . +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix sh: <http://www.w3.org/ns/shacl#> . +@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . + +<http://datashapes.org/sh/tests/core/property/xone-001.test> + a owl:Ontology ; + rdfs:label "Test of sh:xone at property shape 001" ; + owl:imports <http://datashapes.org/dash> ; +. +ex:Bob + a ex:Person ; + ex:value "Robert" ; +. +ex:Dory + a ex:Person ; + ex:value "165"^^xsd:int ; +. +ex:GraphValidationTestCase + a dash:GraphValidationTestCase ; + dash:expectedResult [ + a sh:ValidationReport ; + sh:conforms false ; + sh:result [ + a sh:ValidationResult ; + sh:focusNode ex:Dory ; + sh:resultPath ex:value ; + sh:resultSeverity sh:Violation ; + sh:sourceConstraintComponent sh:XoneConstraintComponent ; + sh:sourceShape ex:TestPropertyShape ; + sh:value "165"^^xsd:int ; + ] ; + ] ; +. +ex:TestPropertyShape + sh:path ex:value ; + sh:xone ( + [ + sh:datatype xsd:string ; + ] + [ + sh:datatype xsd:double ; + ] + [ + sh:datatype xsd:long ; + ] + ) ; +. +ex:XoneConstraintExampleShape + a sh:NodeShape ; + sh:property ex:TestPropertyShape ; + sh:targetClass ex:Person ; +.
60
Fixed bug in native validator of sh:xone, added test case
0
.ttl
test
apache-2.0
TopQuadrant/shacl
303
<NME> xone-001.test.ttl <BEF> ADDFILE <MSG> Fixed bug in native validator of sh:xone, added test case <DFF> @@ -0,0 +1,60 @@ +# baseURI: http://datashapes.org/sh/tests/core/property/xone-001.test +# imports: http://datashapes.org/dash +# prefix: ex + +@prefix dash: <http://datashapes.org/dash#> . +@prefix ex: <http://datashapes.org/sh/tests/core/property/xone-001.test#> . +@prefix owl: <http://www.w3.org/2002/07/owl#> . +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix sh: <http://www.w3.org/ns/shacl#> . +@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . + +<http://datashapes.org/sh/tests/core/property/xone-001.test> + a owl:Ontology ; + rdfs:label "Test of sh:xone at property shape 001" ; + owl:imports <http://datashapes.org/dash> ; +. +ex:Bob + a ex:Person ; + ex:value "Robert" ; +. +ex:Dory + a ex:Person ; + ex:value "165"^^xsd:int ; +. +ex:GraphValidationTestCase + a dash:GraphValidationTestCase ; + dash:expectedResult [ + a sh:ValidationReport ; + sh:conforms false ; + sh:result [ + a sh:ValidationResult ; + sh:focusNode ex:Dory ; + sh:resultPath ex:value ; + sh:resultSeverity sh:Violation ; + sh:sourceConstraintComponent sh:XoneConstraintComponent ; + sh:sourceShape ex:TestPropertyShape ; + sh:value "165"^^xsd:int ; + ] ; + ] ; +. +ex:TestPropertyShape + sh:path ex:value ; + sh:xone ( + [ + sh:datatype xsd:string ; + ] + [ + sh:datatype xsd:double ; + ] + [ + sh:datatype xsd:long ; + ] + ) ; +. +ex:XoneConstraintExampleShape + a sh:NodeShape ; + sh:property ex:TestPropertyShape ; + sh:targetClass ex:Person ; +.
60
Fixed bug in native validator of sh:xone, added test case
0
.ttl
test
apache-2.0
TopQuadrant/shacl
304
<NME> README.md <BEF> # TopBraid SHACL API **An open source implementation of the W3C Shapes Constraint Language (SHACL) based on Apache Jena.** Contact: Holger Knublauch ([email protected]) Can be used to perform SHACL constraint checking and rule inferencing in any Jena-based Java application. This API also serves as a reference implementation developed in parallel to the SHACL spec. **The code is totally not optimized for performance, just for correctness.** Coverage: * SHACL Core and SHACL-SPARQL validation Former Coverage until version 1.4.0 * [SHACL Compact Syntax](https://w3c.github.io/shacl/shacl-compact-syntax/) Former Coverage until version 1.3.2 * [SHACL JavaScript Extensions](https://www.w3.org/TR/shacl-js/) The TopBraid SHACL API is internally used by the European Commission's generic [SHACL-based RDF validator](https://www.itb.ec.europa.eu/shacl/any/upload) (used to validate RDF content against SHACL shapes) and [SHACL shape validator](https://www.itb.ec.europa.eu/shacl/shacl/upload) (used to validate SHACL shapes themselves). The same code is used in the TopBraid products (currently aligned with the TopBraid 7.1 release). Feedback and questions should become GitHub issues or sent to TopBraid Users mailing list: https://groups.google.com/forum/#!forum/topbraid-users Please prefix your messages with [SHACL API] To get started, look at the class ValidationUtil in the package org.topbraid.shacl.validation. There is also an [Example Test Case](../master/src/test/java/org/topbraid/shacl/ValidationExample.java) ## Application dependency Releases are available in the central maven repository: ``` <dependency> <groupId>org.topbraid</groupId> <artifactId>shacl</artifactId> <version>*VER*</version> </dependency> ``` ## Command Line Usage Download the latest release from: `https://repo1.maven.org/maven2/org/topbraid/shacl/` Currently only Turtle (.ttl) files are supported. The tools print the validation report or the inferences graph to the output screen. The output of the command line utilities is not limited by the license of the SHACL API. `https://repo1.maven.org/maven2/org/topbraid/shacl/*VER*/shacl-*VER*-bin.zip`. Two command line utilities are included: shaclvalidate (performs constraint validation) and shaclinfer (performs SHACL rule inferencing). To use them, set up your environment similar to https://jena.apache.org/documentation/tools/ (note that the SHACL download includes Jena). For example, on Windows: ``` SET SHACLROOT=C:\Users\Holger\Desktop\shacl-1.4.1-bin SET PATH=%PATH%;%SHACLROOT%\bin ``` As another example, for Linux, add to .bashrc these lines: ``` # for shacl export SHACLROOT=/home/holger/shacl/shacl-1.4.1-bin/shacl-1.4.1/bin export PATH=$SHACLROOT:$PATH ``` Both tools take the following parameters, for example: `shaclvalidate.bat -datafile myfile.ttl -shapesfile myshapes.ttl` where `-shapesfile` is optional and falls back to using the data graph as shapes graph. Add -validateShapes in case you want to include the metashapes (from the tosh namespace in particular). Currently only Turtle (.ttl) files are supported. The tools print the validation report or the inferences graph to the output screen. <MSG> Switched to Apache license <DFF> @@ -6,7 +6,7 @@ Contact: Holger Knublauch ([email protected]) Can be used to perform SHACL constraint checking and rule inferencing in any Jena-based Java application. This API also serves as a reference implementation developed in parallel to the SHACL spec. -**The code is totally not optimized for performance, just for correctness.** +**The code is not really optimized for performance, just for correctness.** Coverage: * SHACL Core and SHACL-SPARQL validation @@ -49,4 +49,3 @@ whereby -shapesfile is optional and falls back to using the data graph as shapes Currently only Turtle (.ttl) files are supported. The tools print the validation report or the inferences graph to the output screen. -The output of the command line utilities is not limited by the license of the SHACL API.
1
Switched to Apache license
2
.md
md
apache-2.0
TopQuadrant/shacl
305
<NME> README.md <BEF> # TopBraid SHACL API **An open source implementation of the W3C Shapes Constraint Language (SHACL) based on Apache Jena.** Contact: Holger Knublauch ([email protected]) Can be used to perform SHACL constraint checking and rule inferencing in any Jena-based Java application. This API also serves as a reference implementation developed in parallel to the SHACL spec. **The code is totally not optimized for performance, just for correctness.** Coverage: * SHACL Core and SHACL-SPARQL validation Former Coverage until version 1.4.0 * [SHACL Compact Syntax](https://w3c.github.io/shacl/shacl-compact-syntax/) Former Coverage until version 1.3.2 * [SHACL JavaScript Extensions](https://www.w3.org/TR/shacl-js/) The TopBraid SHACL API is internally used by the European Commission's generic [SHACL-based RDF validator](https://www.itb.ec.europa.eu/shacl/any/upload) (used to validate RDF content against SHACL shapes) and [SHACL shape validator](https://www.itb.ec.europa.eu/shacl/shacl/upload) (used to validate SHACL shapes themselves). The same code is used in the TopBraid products (currently aligned with the TopBraid 7.1 release). Feedback and questions should become GitHub issues or sent to TopBraid Users mailing list: https://groups.google.com/forum/#!forum/topbraid-users Please prefix your messages with [SHACL API] To get started, look at the class ValidationUtil in the package org.topbraid.shacl.validation. There is also an [Example Test Case](../master/src/test/java/org/topbraid/shacl/ValidationExample.java) ## Application dependency Releases are available in the central maven repository: ``` <dependency> <groupId>org.topbraid</groupId> <artifactId>shacl</artifactId> <version>*VER*</version> </dependency> ``` ## Command Line Usage Download the latest release from: `https://repo1.maven.org/maven2/org/topbraid/shacl/` Currently only Turtle (.ttl) files are supported. The tools print the validation report or the inferences graph to the output screen. The output of the command line utilities is not limited by the license of the SHACL API. `https://repo1.maven.org/maven2/org/topbraid/shacl/*VER*/shacl-*VER*-bin.zip`. Two command line utilities are included: shaclvalidate (performs constraint validation) and shaclinfer (performs SHACL rule inferencing). To use them, set up your environment similar to https://jena.apache.org/documentation/tools/ (note that the SHACL download includes Jena). For example, on Windows: ``` SET SHACLROOT=C:\Users\Holger\Desktop\shacl-1.4.1-bin SET PATH=%PATH%;%SHACLROOT%\bin ``` As another example, for Linux, add to .bashrc these lines: ``` # for shacl export SHACLROOT=/home/holger/shacl/shacl-1.4.1-bin/shacl-1.4.1/bin export PATH=$SHACLROOT:$PATH ``` Both tools take the following parameters, for example: `shaclvalidate.bat -datafile myfile.ttl -shapesfile myshapes.ttl` where `-shapesfile` is optional and falls back to using the data graph as shapes graph. Add -validateShapes in case you want to include the metashapes (from the tosh namespace in particular). Currently only Turtle (.ttl) files are supported. The tools print the validation report or the inferences graph to the output screen. <MSG> Switched to Apache license <DFF> @@ -6,7 +6,7 @@ Contact: Holger Knublauch ([email protected]) Can be used to perform SHACL constraint checking and rule inferencing in any Jena-based Java application. This API also serves as a reference implementation developed in parallel to the SHACL spec. -**The code is totally not optimized for performance, just for correctness.** +**The code is not really optimized for performance, just for correctness.** Coverage: * SHACL Core and SHACL-SPARQL validation @@ -49,4 +49,3 @@ whereby -shapesfile is optional and falls back to using the data graph as shapes Currently only Turtle (.ttl) files are supported. The tools print the validation report or the inferences graph to the output screen. -The output of the command line utilities is not limited by the license of the SHACL API.
1
Switched to Apache license
2
.md
md
apache-2.0
TopQuadrant/shacl
306
<NME> tosh.ttl <BEF> # baseURI: http://topbraid.org/tosh # imports: http://datashapes.org/dash # prefix: tosh @prefix dash: <http://datashapes.org/dash#> . @prefix graphql: <http://datashapes.org/graphql#> . @prefix owl: <http://www.w3.org/2002/07/owl#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix sh: <http://www.w3.org/ns/shacl#> . @prefix swa: <http://topbraid.org/swa#> . @prefix tosh: <http://topbraid.org/tosh#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . dash: tosh:systemNamespace true ; . dash:Action sh:property tosh:Action-actionGroup ; sh:property tosh:Action-actionIconClass ; sh:property tosh:Action-deactivated ; . dash:ActionGroup sh:property tosh:ActionGroup-order ; sh:property tosh:Resource-comment ; sh:property tosh:Resource-label ; . dash:ActionTestCase sh:property tosh:ActionTestCase-action ; sh:property tosh:ActionTestCase-expectedResult ; sh:property tosh:ActionTestCase-focusNode ; sh:property tosh:ActionTestCase-variables ; . dash:ChangeScript sh:property tosh:ChangeScript-deactivated ; sh:property tosh:ChangeScript-order ; dash:StemConstraintComponent-stem sh:group tosh:StringBasedConstraintPropertyGroup ; . <http://spinrdf.org/sp#> tosh:systemNamespace "true"^^xsd:boolean ; . dash:IndexedConstraintComponent-indexed sh:group tosh:ReificationPropertyGroup ; sh:order "1"^^xsd:decimal ; . dash:InferencingTestCase sh:property tosh:InferencingTestCase-expectedResult ; . dash:JSTestCase sh:property tosh:JSTestCase-expectedResult ; . dash:MultiFunction sh:property tosh:Function-apiStatus ; sh:property tosh:MultiFunction-resultVariable ; . dash:NonRecursiveConstraintComponent dash:propertySuggestionGenerator tosh:DeleteTripleSuggestionGenerator ; . dash:NonRecursiveConstraintComponent-nonRecursive sh:group tosh:ValueConstraintsPropertyGroup ; sh:order "5"^^xsd:decimal ; . dash:PrimaryKeyConstraintComponent-uriStart sh:group tosh:StringConstraintsPropertyGroup ; sh:order "40"^^xsd:decimal ; . dash:PropertyRole sh:property tosh:Resource-comment ; sh:property tosh:Resource-label ; . dash:QueryTestCase sh:property tosh:QueryTestCase-expectedResult ; . dash:ReifiableByConstraintComponent-reifiableBy sh:group tosh:ReificationPropertyGroup ; sh:order "0"^^xsd:decimal ; . dash:ResourceAction sh:property tosh:ResourceAction-jsCondition ; . dash:RootClassConstraintComponent dash:propertySuggestionGenerator tosh:DeleteTripleSuggestionGenerator ; . tosh:CardinalityConstraintPropertyGroup rdf:type sh:PropertyGroup ; rdfs:label "Cardinality" ; sh:order 2 ; . tosh:ComplexConstraintPropertyGroup rdf:type sh:PropertyGroup ; tosh:editGroupDescription "Most edit fields in this section currently require Turtle source code, esp to enter blank node expressions. To reference existing shapes via their URI, enter them as <URI>." ; tosh:openable "true"^^xsd:boolean ; rdfs:label "Complex Constraints" ; sh:order 9 ; . tosh:ConstraintMetadataPropertyGroup sh:property tosh:Resource-comment ; sh:property tosh:Resource-label ; sh:property tosh:Script-js ; . dash:ScriptConstraint sh:property tosh:Script-onAllValues ; sh:property tosh:ScriptConstraint-deactivated ; sh:property tosh:ScriptConstraint-message ; . dash:ScriptConstraintComponent-scriptConstraint sh:group tosh:AdvancedPropertyGroup ; sh:order "20"^^xsd:decimal ; . dash:ScriptFunction sh:property tosh:ScriptFunction-canWrite ; . tosh:DisplayPropertyGroup rdf:type sh:PropertyGroup ; rdfs:comment "A group for properties that are primarily for display purposes (names, ordering etc)." ; rdfs:label "Display" ; sh:order 1 ; . tosh:MemberShapeConstraintComponent dash:Service sh:property tosh:Service-canWrite ; sh:property tosh:Service-deactivated ; sh:property tosh:Service-responseContentType ; . dash:StemConstraintComponent-stem sh:group tosh:StringConstraintsPropertyGroup ; sh:order "45"^^xsd:decimal ; . dash:SubSetOfConstraintComponent-subSetOf sh:group tosh:PropertyPairConstraintsPropertyGroup ; sh:order "20"^^xsd:decimal ; . dash:SymmetricConstraintComponent dash:propertySuggestionGenerator tosh:DeleteTripleSuggestionGenerator ; dash:propertySuggestionGenerator [ a dash:SPARQLUpdateSuggestionGenerator ; sh:message "Add symmetric value." ; sh:order "0"^^xsd:decimal ; sh:prefixes <http://topbraid.org/tosh> ; sh:update """INSERT { $value $predicate $focusNode . } WHERE { }""" ; ] ; . dash:SymmetricConstraintComponent-symmetric sh:group tosh:ValueConstraintsPropertyGroup ; sh:order "10"^^xsd:decimal ; . dash:TestCase sh:property tosh:TestCase-deactivated ; . dash:TestCaseResult sh:property [ a sh:PropertyShape ; sh:path dash:testCase ; sh:class dash:TestCase ; sh:description "The dash:TestCase that was executed." ; sh:maxCount 1 ; sh:minCount 1 ; sh:name "test case" ; tosh:PropertyPairConstraintPropertyGroup rdf:type sh:PropertyGroup ; tosh:openable "true"^^xsd:boolean ; rdfs:label "Property Pairs" ; sh:order 6 ; . tosh:PropertyShapeShape sh:minCount 1 ; sh:name "test graph" ; sh:nodeKind sh:IRI ; ] ; . dash:UniqueValueForClassConstraintComponent-uniqueValueForClass sh:group tosh:ValueConstraintsPropertyGroup ; sh:order "20"^^xsd:decimal ; . dash:ValidationTestCase sh:property tosh:ValidationTestCase-expectedResult ; sh:property tosh:ValidationTestCase-includeSuggestions ; sh:property tosh:ValidationTestCase-validateShapes ; . dash:Widget sh:property tosh:Resource-comment ; sh:property tosh:Resource-label ; . dash:Widget-hidden sh:group tosh:DisplayPropertyGroup ; . <http://spinrdf.org/sp#> tosh:systemNamespace true ; . <http://spinrdf.org/spin#> tosh:systemNamespace true ; . <http://spinrdf.org/spl#> tosh:systemNamespace true ; . <http://topbraid.org/tosh> a owl:Ontology ; dash:generateClass dash:ConstraintReificationShape ; dash:generateClass rdf:Property ; dash:generateClass rdfs:Class ; dash:generateClass rdfs:Datatype ; dash:generateClass owl:Class ; dash:generateClass owl:Ontology ; dash:generateClass sh:ConstraintComponent ; dash:generateClass sh:PropertyGroup ; dash:generateClass sh:Rule ; dash:generateClass sh:Shape ; dash:generatePrefixConstants "dash" ; dash:generatePrefixConstants "owl" ; dash:generatePrefixConstants "rdf" ; dash:generatePrefixConstants "rdfs" ; dash:generatePrefixConstants "sh" ; dash:generatePrefixConstants "xsd" ; rdfs:comment """A collection of SHACL features that are available whenever SHACL graphs are used within TopBraid Suite products. In particular this includes shape definitions for the \"system\" classes such as rdfs:Class, sh:PropertyShape etc. These shapes are used by TopBraid products to validate ontology definitions and to drive user interface forms. The TOSH namespace also includes things like suggestions, Active Data Shapes scripts and a couple of SPARQL functions. Some of these may be of general use outside of TopBraid too.""" ; rdfs:label "TopBraid Data Shapes Library" ; owl:imports <http://datashapes.org/dash> ; sh:declare [ a sh:PrefixDeclaration ; sh:namespace "http://jena.hpl.hp.com/ARQ/function#"^^xsd:anyURI ; sh:prefix "afn" ; ] ; sh:declare [ a sh:PrefixDeclaration ; sh:namespace "http://spinrdf.org/spif#"^^xsd:anyURI ; sh:prefix "spif" ; ] ; sh:declare [ a sh:PrefixDeclaration ; sh:namespace "http://topbraid.org/sparqlmotionfunctions#"^^xsd:anyURI ; sh:prefix "smf" ; ] ; sh:declare [ a sh:PrefixDeclaration ; sh:namespace "http://topbraid.org/tosh#"^^xsd:anyURI ; sh:prefix "tosh" ; ] ; . tosh: tosh:systemNamespace true ; . tosh:Action-actionGroup a sh:PropertyShape ; sh:path dash:actionGroup ; sh:class dash:ActionGroup ; sh:description "The Action Group that the action should appear in (in menus etc)." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:order "5"^^xsd:decimal ; . tosh:Action-actionIconClass a sh:PropertyShape ; sh:path dash:actionIconClass ; sh:datatype xsd:string ; sh:description "The CSS class for the action for display purposes. For example, pick one of https://fontawesome.com/icons?d=gallery&m=free or https://getbootstrap.com/docs/3.3/components/#glyphicons-glyphs" ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:order "7"^^xsd:decimal ; . tosh:Action-deactivated a sh:PropertyShape ; sh:path sh:deactivated ; sh:datatype xsd:boolean ; sh:description "True to deactivate this action (from user interfaces)." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "deactivated" ; sh:order "8"^^xsd:decimal ; . tosh:ActionGroup-order a sh:PropertyShape ; sh:path sh:order ; sh:description "The relative order of this group compared to other groups, e.g. to display in drop down menus." ; sh:group tosh:DisplayPropertyGroup ; sh:maxCount 1 ; sh:name "order" ; sh:or ( [ sh:datatype xsd:decimal ; ] [ sh:datatype xsd:integer ; ] ) ; . tosh:ActionTestCase-action a sh:PropertyShape ; sh:path dash:action ; sh:class dash:Action ; sh:description "The dash:Action to execute." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:minCount 1 ; sh:name "action" ; sh:nodeKind sh:IRI ; sh:order "0"^^xsd:decimal ; . tosh:ActionTestCase-expectedResult a sh:PropertyShape ; sh:path dash:expectedResult ; sh:description "The expected result of the evaluation, as JSON object as produced by the servlet, or true or false." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:name "expected result" ; sh:order "10"^^xsd:decimal ; . tosh:ActionTestCase-focusNode a sh:PropertyShape ; sh:path dash:focusNode ; sh:description "The selected resource, which will become value of focusNode for the script, with its \"most suitable\" JavaScript class as type. Defaults to the test case itself." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:name "focus node" ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order "5"^^xsd:decimal ; . tosh:ActionTestCase-variables a sh:PropertyShape ; sh:path dash:variables ; sh:datatype xsd:string ; sh:description """A JSON object (string) with name-value pairs for the variable bindings. This must be in the same format as expected by the script servlet. For parameters that declare dash:mimeTypes (i.e. file upload parameters), the value needs to be the path to a file relative to the workspace root. This file will be temporarily uploaded for the duration of the test case execution.""" ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:name "variables" ; sh:order "2"^^xsd:decimal ; . tosh:AdvancedPropertyGroup a sh:PropertyGroup ; rdfs:label "Advanced" ; sh:order "95"^^xsd:decimal ; . tosh:ChangeScript-deactivated a sh:PropertyShape ; sh:path sh:deactivated ; sh:datatype xsd:boolean ; sh:description "True to deactivate this script, for example for testing purposes, without having to delete it." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "deactivated" ; sh:order "10"^^xsd:decimal ; . tosh:ChangeScript-order a sh:PropertyShape ; sh:path sh:order ; sh:description "The relative order of this script compared to other change scripts. The default value is 0. Scripts with lower numbers are executed first." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "order" ; tosh:StringBasedConstraintPropertyGroup rdf:type sh:PropertyGroup ; tosh:openable "true"^^xsd:boolean ; rdfs:label "String Constraints" ; sh:order 7 ; . tosh:SystemNamespaceShape ) ; sh:order "40"^^xsd:decimal ; . tosh:Class-ShapeScript a dash:ShapeScript ; dash:js """ /** * Returns this class as an instance of sh:NodeShape. * @returns {sh_NodeShape} */ asNodeShape() { return sh.asNodeShape(this); } }""" ; ] ; . tosh:UseDeclaredDatatypeConstraintComponent rdf:type sh:ConstraintComponent ; dash:propertySuggestionGenerator [ reached = new Set(); } if(!reached.has(this.uri)) { reached.add(this.uri); let result = callback(this); if(result !== undefined && result !== null) { return result; } let supers = this.superclasses; for(let i = 0; i < supers.length; i++) { result = supers[i].walkSuperclasses(callback, reached); if(result !== undefined && result !== null) { return result; } } } } """ ; . tosh:Class-abstract a sh:PropertyShape ; sh:path dash:abstract ; sh:datatype xsd:boolean ; sh:description "States whether this class is abstract, i.e. cannot have direct instances. Abstract classes are typically used to defined shared properties of its subclasses." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "abstract" ; sh:order "30"^^xsd:decimal ; . tosh:Class-classIcon a sh:PropertyShape ; sh:path tosh:classIcon ; dash:hidden true ; dash:propertyRole dash:IconRole ; sh:datatype xsd:string ; sh:defaultValue "http://datashapes.org/icons/class.svg" ; sh:description "Used to return the default icon for all classes." ; sh:group tosh:DisplayPropertyGroup ; sh:maxCount 1 ; tosh:ValueRangeConstraintPropertyGroup rdf:type sh:PropertyGroup ; tosh:openable "true"^^xsd:boolean ; rdfs:label "Value Range" ; sh:order 5 ; . tosh:ValueTypeConstraintPropertyGroup rdf:type sh:PropertyGroup ; tosh:editGroupDescription "Hint: Use \"or\" under Complex Constraints to represent choices between multiple value types." ; rdfs:comment "A property group for constraint parameters that restrict the value types of values." ; rdfs:label "Value Type" ; sh:order 3 ; . tosh:countShapesWithMatchResult tosh:Class-disjointWith a sh:PropertyShape ; sh:path owl:disjointWith ; sh:class owl:Class ; sh:group tosh:OWLAxiomsPropertyGroup ; sh:name "disjoint with" ; sh:order "1"^^xsd:decimal ; . tosh:Class-domain-inverse a sh:PropertyShape ; sh:path [ sh:inversePath rdfs:domain ; ] ; dash:editor dash:PropertyAutoCompleteEditor ; sh:class rdf:Property ; sh:description "The properties that declare to have this class in their domain." ; sh:group tosh:RDFSPropertyAxiomsPropertyGroup ; sh:name "domain of" ; sh:nodeKind sh:IRI ; sh:order "0"^^xsd:decimal ; . tosh:Class-equivalentClass a sh:PropertyShape ; sh:path owl:equivalentClass ; sh:class owl:Class ; sh:group tosh:OWLAxiomsPropertyGroup ; sh:name "equivalent classes" ; sh:order "0"^^xsd:decimal ; . tosh:Class-hidden a sh:PropertyShape ; sh:path dash:hidden ; sh:datatype xsd:boolean ; sh:description "True if this class shall be hidden from the class hierarchies." ; sh:group tosh:DisplayPropertyGroup ; sh:maxCount 1 ; sh:name "hidden" ; sh:order "0"^^xsd:decimal ; . tosh:Class-range-inverse a sh:PropertyShape ; sh:path [ sh:inversePath rdfs:range ; ] ; dash:editor dash:PropertyAutoCompleteEditor ; sh:class rdf:Property ; sh:description "The properties that have this class in their rdfs:range." ; sh:group tosh:RDFSPropertyAxiomsPropertyGroup ; sh:name "range of" ; sh:nodeKind sh:IRI ; sh:order "1"^^xsd:decimal ; . tosh:Class-resourceAction a sh:PropertyShape ; sh:path dash:resourceAction ; graphql:name "resourceActions" ; sh:class dash:ResourceAction ; sh:description "The Resource Actions that can be applied to instances of this class." ; sh:group tosh:ScriptsPropertyGroup ; sh:name "resource actions" ; sh:order "0"^^xsd:decimal ; . tosh:Class-resourceService a sh:PropertyShape ; sh:path dash:resourceService ; graphql:name "resourceServices" ; sh:class dash:ResourceService ; sh:description "The Services that can be applied to instances of this class (as focusNode)." ; sh:group tosh:ScriptsPropertyGroup ; sh:name "resource services" ; sh:order "10"^^xsd:decimal ; . tosh:Class-subClassOf a sh:PropertyShape ; sh:path rdfs:subClassOf ; graphql:name "superclasses" ; sh:class rdfs:Class ; sh:description "The (direct) parent classes of this class." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "superclasses" ; sh:order "20"^^xsd:decimal ; . tosh:Class-subClassOf-inverse a sh:PropertyShape ; sh:path [ sh:inversePath rdfs:subClassOf ; ] ; dash:hidden true ; graphql:name "subclasses" ; sh:class rdfs:Class ; sh:description "The (direct) subclasses of this class." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "subclasses" ; sh:order "21"^^xsd:decimal ; . tosh:ConstraintComponent-localConstraint a sh:PropertyShape ; sh:path dash:localConstraint ; sh:datatype xsd:boolean ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "local constraint" ; sh:order "10"^^xsd:decimal ; . tosh:ConstraintComponent-message a sh:PropertyShape ; sh:path sh:message ; sh:description "The message to generate on violations." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "messages" ; sh:or dash:StringOrLangString ; sh:order "26"^^xsd:decimal ; . tosh:ConstraintComponent-nodeValidator a sh:PropertyShape ; sh:path sh:nodeValidator ; sh:class sh:Validator ; sh:description "The validator(s) used to evaluate a constraint in the context of a node shape." ; sh:group tosh:ImplementationPropertyGroup ; sh:name "node validators" ; sh:order "2"^^xsd:decimal ; . tosh:ConstraintComponent-propertySuggestionGenerator a sh:PropertyShape ; sh:path dash:propertySuggestionGenerator ; sh:class dash:SuggestionGenerator ; sh:group tosh:ImplementationPropertyGroup ; sh:name "property suggestion generators" ; sh:order "20"^^xsd:decimal ; . tosh:ConstraintComponent-propertyValidator a sh:PropertyShape ; sh:path sh:propertyValidator ; sh:class sh:Validator ; sh:description "The validator(s) used to evaluate a constraint in the context of a property shape." ; sh:group tosh:ImplementationPropertyGroup ; sh:name "property validators" ; sh:order "1"^^xsd:decimal ; . tosh:ConstraintComponent-staticConstraint a sh:PropertyShape ; sh:path dash:staticConstraint ; sh:datatype xsd:boolean ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "static constraint" ; sh:order "11"^^xsd:decimal ; . tosh:ConstraintComponent-validator a sh:PropertyShape ; sh:path sh:validator ; sh:class sh:Validator ; sh:description "The validator(s) used to evaluate constraints of either node or property shapes, unless more specific validators are available." ; sh:group tosh:ImplementationPropertyGroup ; sh:name "validators" ; sh:order "0"^^xsd:decimal ; . tosh:DatatypePropertyShapeView a sh:NodeShape ; rdfs:comment "The default view shape for property shapes on datatype values." ; rdfs:label "Attribute view" ; sh:node tosh:PropertyShapeView ; sh:property dash:PrimaryKeyConstraintComponent-uriStart ; sh:property dash:SingleLineConstraintComponent-singleLine ; sh:property tosh:Shape-datatypes ; sh:property sh:LanguageInConstraintComponent-languageIn ; sh:property sh:LessThanConstraintComponent-lessThan ; sh:property sh:LessThanOrEqualsConstraintComponent-lessThanOrEquals ; sh:property sh:MaxExclusiveConstraintComponent-maxExclusive ; sh:property sh:MaxInclusiveConstraintComponent-maxInclusive ; sh:property sh:MaxLengthConstraintComponent-maxLength ; sh:property sh:MinExclusiveConstraintComponent-minExclusive ; sh:property sh:MinInclusiveConstraintComponent-minInclusive ; sh:property sh:MinLengthConstraintComponent-minLength ; sh:property sh:PatternConstraintComponent-flags ; sh:property sh:PatternConstraintComponent-pattern ; sh:property sh:UniqueLangConstraintComponent-uniqueLang ; . tosh:DatatypesViewer a dash:MultiViewer ; dash:hidden true ; rdfs:label "Datatypes viewer" ; . tosh:DefinitionPropertyGroup a sh:PropertyGroup ; rdfs:label "Definition" ; sh:order "0"^^xsd:decimal ; . tosh:DeleteTripleSuggestionGenerator a dash:SPARQLUpdateSuggestionGenerator ; rdfs:comment "Produces a suggestion that would delete the offending value in the validation result from the focus node." ; rdfs:label "Delete triple suggestion generator" ; sh:message "Delete the invalid statement" ; sh:order 100.0 ; sh:update """DELETE { $focusNode $predicate $value . } WHERE { $focusNode $predicate $value . }""" ; . tosh:DependentEnumSelectEditor a dash:SingleEditor ; rdfs:comment """A drop-down editor for enumerated values that are dynamically determined via a node shape that has sh:target dash:HasValueTarget. Example: states:USAddressShape rdf:type sh:NodeShape ; rdfs:label \"US Address shape\" ; sh:property [ rdf:type sh:PropertyShape ; sh:path states:state ; sh:in ( \"AZ\" \"CA\" \"FL\" ) ; ] ; sh:target [ rdf:type dash:HasValueTarget ; dash:object \"USA\" ; dash:predicate states:country ; ] . """ ; rdfs:label "Dependent enum select editor" ; . tosh:DisplayPropertyGroup a sh:PropertyGroup ; rdfs:label "Display" ; sh:order "30"^^xsd:decimal ; . tosh:Function-apiStatus a sh:PropertyShape ; sh:path dash:apiStatus ; sh:class dash:APIStatus ; sh:description "Declares the status of this function within the TopBraid API. The usual life cycle is to start with no value (meaning: not part of the API at all), then experimental from which it later either moves to stable or deprecated. Stable functions may also get deprecated and have no api status after at least one release cycle." ; sh:group tosh:DefinitionPropertyGroup ; sh:in ( dash:Experimental dash:Stable dash:Deprecated ) ; sh:maxCount 1 ; sh:name "API status" ; sh:order "15"^^xsd:decimal ; . tosh:Function-cachable a sh:PropertyShape ; sh:path dash:cachable ; sh:datatype xsd:boolean ; sh:description "True to indicate that this function will always return the same values for the same combination of arguments, regardless of the query graphs. Engines can use this information to cache and reuse previous function calls." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "cachable" ; sh:order "10"^^xsd:decimal ; . tosh:Function-returnType a sh:PropertyShape ; sh:path sh:returnType ; sh:class rdfs:Class ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "return type" ; sh:order "5"^^xsd:decimal ; . tosh:FunctionTestCase-expectedResult a sh:PropertyShape ; sh:path dash:expectedResult ; sh:description "The expected result of a function call." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:name "expected result" ; sh:order "10"^^xsd:decimal ; . tosh:FunctionTestCase-expression a sh:PropertyShape ; sh:path dash:expression ; sh:description "A valid SPARQL expression calling the function to test." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:minCount 1 ; sh:name "expression" ; sh:order "0"^^xsd:decimal ; sh:ClassConstraintComponent dash:propertySuggestionGenerator tosh:DeleteTripleSuggestionGenerator ; dash:propertySuggestionGenerator tosh:ReplaceWithDefaultValueSuggestionGenerator ; . sh:ClassConstraintComponent-class sh:group tosh:ValueTypeConstraintPropertyGroup ; a sh:PropertyGroup ; rdfs:label "Implementation" ; sh:order "10"^^xsd:decimal ; . tosh:IncludedScript-exports a sh:PropertyShape ; sh:path dash:exports ; sh:datatype xsd:string ; sh:description "Declares the symbols that shall be exported from the surrounding module, e.g. for use in Node.js applications." ; sh:group tosh:ImplementationPropertyGroup ; sh:name "exports" ; sh:order "30"^^xsd:decimal ; . tosh:InferenceRulesShape a sh:NodeShape ; rdfs:comment "A node shape for classes and node shapes, declaring the sh:rule property." ; rdfs:label "Inference rules" ; sh:property tosh:InferenceRulesShape-rule ; sh:targetClass sh:NodeShape ; . tosh:InferenceRulesShape-rule a sh:PropertyShape ; sh:path sh:rule ; sh:class sh:Rule ; sh:description "The inference rules associated with this node shape or class." ; sh:group tosh:InferencesPropertyGroup ; sh:name "rule" ; . tosh:InferencesPropertyGroup a sh:PropertyGroup ; rdfs:label "Inferences" ; sh:order "80"^^xsd:decimal ; . tosh:InferencingTestCase-expectedResult a sh:PropertyShape ; sh:path dash:expectedResult ; sh:description "The expected inferred triples, represented by instances of rdfs:Statement." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:name "expected result" ; sh:order "10"^^xsd:decimal ; . tosh:InstancesInGraphSelectEditor a dash:SingleEditor ; rdfs:comment "A drop-down editor for all instances of a class (based on tosh:shapeInGraph/sh:class of the property) in a graph specified using tosh:graph." ; rdfs:label "Instances in graph select editor" ; . tosh:JSTestCase-expectedResult a sh:PropertyShape ; sh:path dash:expectedResult ; sh:description "The expected result of the JavaScript function call, as an RDF node." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:name "expected result" ; . tosh:MemberShapeConstraintComponent a sh:ConstraintComponent ; rdfs:comment "Can be used to specify constraints on the members of a given list, assuming that the given sh:property has rdf:Lists as values. A violation is reported for each member of the list that does not comply with the constraints specified by the given shape." ; rdfs:label "Member shape constraint component" ; sh:parameter tosh:MemberShapeConstraintComponent-memberShape ; sh:propertyValidator [ a sh:SPARQLSelectValidator ; sh:message "List member does not have the shape {$memberShape}" ; sh:prefixes <http://topbraid.org/tosh> ; sh:select """ SELECT DISTINCT $this ?value ?failure ?member WHERE { $this $PATH ?value . ?value rdf:rest*/rdf:first ?member . BIND (tosh:hasShape(?member, $memberShape) AS ?hasShape) . BIND (!bound(?hasShape) AS ?failure) . FILTER (?failure || !?hasShape) . } """ ; ] ; sh:targetClass sh:PropertyShape ; . tosh:MemberShapeConstraintComponent-memberShape a sh:Parameter ; sh:path tosh:memberShape ; sh:class sh:Shape ; sh:description "The shape that the list members must have." ; sh:name "member shape" ; . tosh:ModifyAction-skipPreview a sh:PropertyShape ; sh:path dash:skipPreview ; sh:datatype xsd:boolean ; sh:description "For actions that take no parameters, this can be set to true to skip any means for the user to preview the action. It will instead directly execute the modification." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "skip preview" ; sh:order "11"^^xsd:decimal ; . tosh:MultiFunction-resultVariable a sh:PropertyShape ; sh:path dash:resultVariable ; sh:class sh:Parameter ; sh:description "The result variables." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "result variables" ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order "30"^^xsd:decimal ; . tosh:NodeShape-ShapeScript a dash:ShapeScript ; dash:js """ /** * Returns this class as an instance of rdfs_Class, assuming this node shape is also a class. * @returns {rdfs_Class} */ asClass() { return rdfs.asClass(this); } /** * Gets the \"nearest\" constraint of a given type and a given path property. Deactivated shapes are skipped. * For example, call it with (ex.myProperty, sh.datatype) to find the closest sh:datatype constraint for ex:myProperty. * @param {NamedNode} path the property that is the sh:path of matching property shapes * @param {NamedNode} predicate the property to fetch the nearest value of */ nearestPropertyShapeValue(path, predicate) { return this.walkSupershapes(s => { if(!s.deactivated) { let ps = s.properties; for(let i = 0; i < ps.length; i++) { if(!ps[i].deactivated && graph.contains(ps[i], sh.path, path)) { let value = ps[i].value(predicate); if(value !== null && value !== undefined) { return value; } } } } }) } /** * @callback sh_NodeShape_callback * @param {sh_NodeShape} nodeShape the visited node shape */ /** * Performs a depth-first traversal of this and its superclasses (via rdfs:subClassOf) and supershapes (via sh:node), * visiting each (super) shape once until the callback function returns a non-null/undefined result. This becomes the result of this function. * The order in which sibling parents are traversed is undefined. * @param {sh_NodeShape_callback} callback the callback for each shape * @param {Set} [reached] the Set of reached URI strings, used internally but may also be used to terminate at certain supers * @returns the return value of the first callback that returned any value */ walkSupershapes(callback, reached) { if(!reached) { reached = new Set(); } if(!reached.has(this.uri)) { reached.add(this.uri); let result = callback(this); if(result !== undefined && result !== null) { return result; } let superClasses = this.asClass().superclasses; for(let i = 0; i < superClasses.length; i++) { result = superClasses[i].asNodeShape().walkSupershapes(callback, reached); if(result !== undefined && result !== null) { return result; } } let superShapes = this.supershapes; for(let i = 0; i < superShapes.length; i++) { result = superShapes[i].walkSupershapes(callback, reached); if(result !== undefined && result !== null) { return result; } } } } """ ; . tosh:NodeShape-applicableToClass a sh:PropertyShape ; sh:path dash:applicableToClass ; sh:class rdfs:Class ; sh:description "Links a node shape with the classes that it can be applied to." ; sh:group tosh:TargetsPropertyGroup ; sh:name "applicable to classes" ; sh:nodeKind sh:IRI ; sh:order "10"^^xsd:decimal ; . tosh:NodeShape-defaultViewForRole a sh:PropertyShape ; sh:path dash:defaultViewForRole ; dash:editor tosh:GovernanceRoleSelectEditor ; dash:viewer tosh:GovernanceRoleViewer ; sh:description "The user roles that this shape shall be used as default view for." ; sh:group tosh:TargetsPropertyGroup ; sh:name "default view for roles" ; sh:nodeKind sh:IRI ; sh:order "20"^^xsd:decimal ; . tosh:NodeShape-inheritedProperty a sh:PropertyShape ; sh:path tosh:inheritedProperty ; dash:neverMaterialize true ; dash:viewer tosh:PropertyTableViewer ; sh:description "Returns all property shapes that have been declared at \"super-shapes\" (via sh:node) or \"superclasses\" (via rdfs:subClassOf), including the indirect supers, recursively." ; sh:group tosh:PropertiesPropertyGroup ; sh:name "inherited properties" ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order "1"^^xsd:decimal ; sh:values [ sh:path sh:property ; sh:nodes [ sh:minus sh:this ; sh:nodes [ sh:distinct [ sh:path [ sh:oneOrMorePath [ sh:alternativePath ( rdfs:subClassOf sh:node ) ; ] ; ] ; ] ; ] ; ] ; ] ; . tosh:NodeShape-node a sh:PropertyShape ; sh:path sh:node ; graphql:name "supershapes" ; sh:description "The node shapes that this must also conform to, forming a kind of inheritance between shapes similar to a subclass-of relationship." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "node (super shapes)" ; sh:node sh:NodeShape ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order "20"^^xsd:decimal ; . tosh:NodeShape-targetClass a sh:PropertyShape ; sh:path sh:targetClass ; graphql:name "targetClasses" ; sh:class rdfs:Class ; sh:description "The types of instances that this shape is targeted at." ; sh:group tosh:TargetsPropertyGroup ; sh:name "target classes" ; sh:nodeKind sh:IRI ; sh:order "0"^^xsd:decimal ; . tosh:NodeShape-targetObjectsOf a sh:PropertyShape ; sh:path sh:targetObjectsOf ; sh:group tosh:TargetsPropertyGroup ; sh:name "target objects of" ; sh:node rdf:Property ; sh:nodeKind sh:IRI ; sh:order "1"^^xsd:decimal ; . tosh:NodeShape-targetSubjectsOf a sh:PropertyShape ; sh:path sh:targetSubjectsOf ; sh:group tosh:TargetsPropertyGroup ; sh:name "target subjects of" ; sh:node rdf:Property ; sh:nodeKind sh:IRI ; sh:order "2"^^xsd:decimal ; . tosh:NodeShapeConstraintsShape a sh:NodeShape ; rdfs:comment "A shape that can be used to validate the syntax of node shapes, and to enter constraints for node shapes on forms." ; rdfs:label "Node shape constraints" ; sh:property dash:ClosedByTypesConstraintComponent-closedByTypes ; sh:property dash:ScriptConstraintComponent-scriptConstraint ; sh:property dash:SingleLineConstraintComponent-singleLine ; sh:property dash:StemConstraintComponent-stem ; sh:property tosh:Shape-datatypes ; sh:property sh:ClassConstraintComponent-class ; sh:property sh:ClosedConstraintComponent-closed ; sh:property sh:ClosedConstraintComponent-ignoredProperties ; sh:property sh:DatatypeConstraintComponent-datatype ; sh:property sh:HasValueConstraintComponent-hasValue ; sh:property sh:InConstraintComponent-in ; sh:property sh:LanguageInConstraintComponent-languageIn ; sh:property sh:MaxExclusiveConstraintComponent-maxExclusive ; sh:property sh:MaxInclusiveConstraintComponent-maxInclusive ; sh:property sh:MaxLengthConstraintComponent-maxLength ; sh:property sh:MinExclusiveConstraintComponent-minExclusive ; sh:property sh:MinInclusiveConstraintComponent-minInclusive ; sh:property sh:MinLengthConstraintComponent-minLength ; sh:property sh:NodeKindConstraintComponent-nodeKind ; sh:property sh:PatternConstraintComponent-flags ; sh:property sh:PatternConstraintComponent-pattern ; sh:property sh:SPARQLConstraintComponent-sparql ; sh:targetClass sh:NodeShape ; . tosh:NumberOfValuesPropertyGroup a sh:PropertyGroup ; rdfs:label "Number of Values" ; sh:order "40"^^xsd:decimal ; . tosh:OWLAxiomsPropertyGroup a sh:PropertyGroup ; rdfs:label "OWL Axioms" ; sh:order "17"^^xsd:decimal ; . tosh:ObjectPropertyShapeView a sh:NodeShape ; rdfs:comment "The default view shape for property shapes on object values." ; rdfs:label "Relationship view" ; sh:node tosh:PropertyShapeView ; sh:property dash:NonRecursiveConstraintComponent-nonRecursive ; sh:property dash:RootClassConstraintComponent-rootClass ; sh:property dash:StemConstraintComponent-stem ; sh:property dash:SymmetricConstraintComponent-symmetric ; sh:property tosh:ObjectPropertyShapeView-node ; sh:property sh:ClassConstraintComponent-class ; sh:property sh:NodeKindConstraintComponent-nodeKind ; . tosh:ObjectPropertyShapeView-node a sh:PropertyShape ; sh:path sh:node ; dash:reifiableBy dash:ConstraintReificationShape ; sh:class sh:NodeShape ; sh:description "The node shape(s) that all values of the property must conform to." ; sh:group tosh:ValueConstraintsPropertyGroup ; sh:name "node" ; sh:order "0"^^xsd:decimal ; . tosh:Ontology-imports a sh:PropertyShape ; sh:path owl:imports ; sh:description "The (directly) imported graphs." ; sh:name "imports" ; sh:nodeKind sh:IRI ; . tosh:Parameterizable-labelTemplate a sh:PropertyShape ; sh:path sh:labelTemplate ; sh:description "Outlines how human-readable labels of instances of the associated Parameterizable shall be produced. The values can contain {?paramName} as placeholders for the actual values of the given parameter." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "label template" ; sh:or dash:StringOrLangString ; sh:order "25"^^xsd:decimal ; . tosh:Parameterizable-parameter a sh:PropertyShape ; sh:path sh:parameter ; sh:class sh:Parameter ; sh:description "The input parameters." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "parameters" ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order "20"^^xsd:decimal ; . tosh:PathStringViewer a dash:MultiViewer ; dash:hidden true ; rdfs:label "Path string viewer" ; . tosh:PropertiesPropertyGroup a sh:PropertyGroup ; rdfs:comment "The declared and inferred properties of a shape or class." ; rdfs:label "Properties" ; sh:order "10"^^xsd:decimal ; . tosh:Property-domain a sh:PropertyShape ; sh:path rdfs:domain ; graphql:name "domains" ; sh:description "The domain(s) of this property." ; sh:group tosh:PropertyAxiomsPropertyGroup ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order "0"^^xsd:decimal ; . tosh:Property-range a sh:PropertyShape ; sh:path rdfs:range ; graphql:name "ranges" ; sh:description "The range(s) of this property." ; sh:group tosh:PropertyAxiomsPropertyGroup ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order "1"^^xsd:decimal ; . tosh:Property-subPropertyOf a sh:PropertyShape ; sh:path rdfs:subPropertyOf ; graphql:name "superproperties" ; sh:class rdf:Property ; sh:description "The (direct) superproperties of this." ; sh:group tosh:PropertyAxiomsPropertyGroup ; sh:name "superproperties" ; sh:nodeKind sh:IRI ; sh:order "2"^^xsd:decimal ; . tosh:Property-subPropertyOf-inverse a sh:PropertyShape ; sh:path [ sh:inversePath rdfs:subPropertyOf ; ] ; graphql:name "subproperties" ; sh:class rdf:Property ; sh:description "The (direct) subproperties of this." ; sh:group tosh:PropertyAxiomsPropertyGroup ; sh:name "subproperties" ; sh:nodeKind sh:IRI ; sh:order "3"^^xsd:decimal ; . tosh:PropertyAxiomsPropertyGroup a sh:PropertyGroup ; rdfs:label "Property Axioms" ; sh:order "1"^^xsd:decimal ; . tosh:PropertyGroup-order a sh:PropertyShape ; sh:path sh:order ; sh:description "The relative order of this group compared to others." ; sh:group tosh:DisplayPropertyGroup ; sh:maxCount 1 ; sh:name "order" ; sh:or ( [ sh:datatype xsd:decimal ; ] [ sh:datatype xsd:integer ; ] ) ; sh:order "0"^^xsd:decimal ; . tosh:PropertyPairConstraintsPropertyGroup a sh:PropertyGroup ; rdfs:label "Property Pair Constraints" ; sh:order "75"^^xsd:decimal ; . tosh:PropertyShape-defaultValue a sh:PropertyShape ; sh:path sh:defaultValue ; dash:readOnly true ; dash:viewer dash:NodeExpressionViewer ; tosh:useDeclaredDatatype true ; sh:description "The default value to be used for this property if no other value has been asserted. This may be a constant value or a SHACL node expression, in which case the values can be derived from other values. Default values are typically inferred and not stored as RDF statements." ; sh:group tosh:InferencesPropertyGroup ; sh:name "default value" ; sh:order "0"^^xsd:decimal ; . tosh:PropertyShape-description a sh:PropertyShape ; sh:path sh:description ; dash:singleLine false ; graphql:name "descriptions" ; sh:description "The description(s) of the property, possibly in multiple languages." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "descriptions" ; sh:nodeKind sh:Literal ; sh:or dash:StringOrLangStringOrHTML ; sh:order "1"^^xsd:decimal ; sh:sparql [ sh:message "Property shapes cannot have both class and datatype constraints." ; sh:prefixes <http://topbraid.org/tosh> ; sh:select """SELECT $this WHERE { FILTER EXISTS { $this sh:class ?class . $this sh:datatype ?datatype . } }""" ; ] ; . tosh:PropertyShape-detailsEndpoint a sh:PropertyShape ; sh:path dash:detailsEndpoint ; sh:datatype xsd:string ; sh:maxCount 1 ; sh:name "details endpoint" ; . tosh:PropertyShape-editor a sh:PropertyShape ; sh:path dash:editor ; dash:editor dash:InstancesSelectEditor ; sh:class dash:Editor ; sh:description "The editor component that should be used to edit values of this property." ; sh:group tosh:DisplayPropertyGroup ; sh:maxCount 1 ; sh:nodeKind sh:IRI ; sh:order "11"^^xsd:decimal ; . tosh:PropertyShape-group a sh:PropertyShape ; sh:path sh:group ; sh:class sh:PropertyGroup ; sh:description "The group that this property belongs to." ; sh:group tosh:DisplayPropertyGroup ; sh:maxCount 1 ; sh:name "group" ; sh:order "0"^^xsd:decimal ; . tosh:PropertyShape-hidden a sh:PropertyShape ; sh:path dash:hidden ; dash:editor dash:BooleanSelectEditor ; sh:datatype xsd:boolean ; sh:description "True to mark this property as hidden in user interface, yet still used in data tasks." ; sh:group tosh:DisplayPropertyGroup ; sh:maxCount 1 ; sh:order "30"^^xsd:decimal ; . tosh:PropertyShape-indexed a sh:PropertyShape ; sh:path dash:indexed ; sh:datatype xsd:boolean ; sh:description "True to indicate that the values of this shall be indexed, forming ordered arrays." ; sh:maxCount 1 ; sh:name "indexed" ; . tosh:PropertyShape-name a sh:PropertyShape ; sh:path sh:name ; dash:singleLine true ; graphql:name "names" ; sh:description "The display names of the property, possibly in multiple languages." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "names" ; sh:nodeKind sh:Literal ; sh:or dash:StringOrLangString ; sh:order "0"^^xsd:decimal ; . tosh:PropertyShape-neverMaterialize a sh:PropertyShape ; sh:path dash:neverMaterialize ; sh:datatype xsd:boolean ; sh:group tosh:InferencesPropertyGroup ; sh:maxCount 1 ; sh:name "never materialize" ; sh:order "11"^^xsd:decimal ; . tosh:PropertyShape-order a sh:PropertyShape ; sh:path sh:order ; sh:description "The relative order of this property shape compared to others." ; sh:group tosh:DisplayPropertyGroup ; sh:maxCount 1 ; sh:name "order" ; sh:or ( [ sh:datatype xsd:decimal ; ] [ sh:datatype xsd:integer ; ] ) ; sh:order "1"^^xsd:decimal ; . tosh:PropertyShape-path a sh:PropertyShape ; sh:path sh:path ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:minCount 1 ; sh:name "path" ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order "31"^^xsd:decimal ; . tosh:PropertyShape-propertyRole a sh:PropertyShape ; sh:path dash:propertyRole ; sh:class dash:PropertyRole ; sh:group tosh:DisplayPropertyGroup ; sh:maxCount 1 ; sh:name "role" ; sh:order "40"^^xsd:decimal ; . tosh:PropertyShape-readOnly a sh:PropertyShape ; sh:path dash:readOnly ; dash:editor dash:BooleanSelectEditor ; dash:viewer dash:NodeExpressionViewer ; sh:datatype xsd:boolean ; sh:description """If set to true then the values of this property should not be editable in the user interface. Note that low-level access such as source code editors may still allow editing, but form-based editors would not. More generally, the values of this property are SHACL node expressions, e.g. function calls, in which case the property counts as read-only if the expression evaluates to true.""" ; sh:group tosh:DisplayPropertyGroup ; sh:maxCount 1 ; sh:order "20"^^xsd:decimal ; . tosh:PropertyShape-values a sh:PropertyShape ; sh:path sh:values ; dash:viewer dash:NodeExpressionViewer ; sh:group tosh:InferencesPropertyGroup ; sh:name "values" ; sh:order "10"^^xsd:decimal ; sh:sparql [ sh:message "sh:values must be accompanied by a sh:path that is an IRI." ; sh:prefixes <http://topbraid.org/tosh> ; sh:select """SELECT $this ?value WHERE { $this $PATH ?value . FILTER NOT EXISTS { $this sh:path ?path . FILTER isIRI(?path) } }""" ; ] ; . tosh:PropertyShape-viewer a sh:PropertyShape ; sh:path dash:viewer ; dash:editor dash:InstancesSelectEditor ; sh:class dash:Viewer ; sh:description "The viewer component that should be used to render values of this property." ; sh:group tosh:DisplayPropertyGroup ; sh:maxCount 1 ; sh:nodeKind sh:IRI ; sh:order "10"^^xsd:decimal ; . tosh:PropertyShapeView a sh:NodeShape ; rdfs:comment "Base view shape for either datatype or object property shapes." ; rdfs:label "Property shape view" ; sh:property dash:CoExistsWithConstraintComponent-coExistsWith ; sh:property dash:IndexedConstraintComponent-indexed ; sh:property dash:ReifiableByConstraintComponent-reifiableBy ; sh:property dash:ScriptConstraintComponent-scriptConstraint ; sh:property dash:SubSetOfConstraintComponent-subSetOf ; sh:property tosh:PropertyShape-defaultValue ; sh:property tosh:PropertyShape-description ; sh:property tosh:PropertyShape-editor ; sh:property tosh:PropertyShape-group ; sh:property tosh:PropertyShape-hidden ; sh:property tosh:PropertyShape-name ; sh:property tosh:PropertyShape-neverMaterialize ; sh:property tosh:PropertyShape-order ; sh:property tosh:PropertyShape-propertyRole ; sh:property tosh:PropertyShape-readOnly ; sh:property tosh:PropertyShape-values ; sh:property tosh:PropertyShape-viewer ; sh:property tosh:PropertyShapeView-message ; sh:property tosh:PropertyShapeView-pathSystemLabel ; sh:property tosh:PropertyShapeView-qualifiedMaxCount ; sh:property tosh:PropertyShapeView-qualifiedMinCount ; sh:property tosh:PropertyShapeView-qualifiedValueShape ; sh:property tosh:PropertyShapeView-qualifiedValueShapesDisjoint ; sh:property tosh:Shape-deactivated ; sh:property tosh:Shape-severity ; sh:property sh:DisjointConstraintComponent-disjoint ; sh:property sh:EqualsConstraintComponent-equals ; sh:property sh:MaxCountConstraintComponent-maxCount ; sh:property sh:MinCountConstraintComponent-minCount ; sh:property sh:SPARQLConstraintComponent-sparql ; . tosh:PropertyShapeView-indexed a sh:PropertyShape ; sh:path dash:indexed ; sh:datatype xsd:boolean ; sh:description "Indicates whether the values are sorted by an index. The user interface will display them in-order." ; sh:group tosh:ReificationPropertyGroup ; sh:maxCount 1 ; sh:name "indexed" ; sh:order "1"^^xsd:decimal ; . tosh:PropertyShapeView-message a sh:PropertyShape ; sh:path sh:message ; sh:description "The message that shall be generated for all constraint violations produced by this property shape." ; sh:group tosh:ValidationPropertyGroup ; sh:name "messages" ; sh:or dash:StringOrLangString ; sh:order "5"^^xsd:decimal ; . tosh:PropertyShapeView-pathSystemLabel a sh:PropertyShape ; sh:path tosh:pathSystemLabel ; dash:neverMaterialize true ; dash:viewer tosh:PathStringViewer ; sh:datatype xsd:string ; sh:description "A display label of the sh:path based on qnames." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "property path" ; sh:order "2"^^xsd:decimal ; sh:values [ sh:else [ <http://uispin.org/ui#label> ( [ sh:path sh:path ; ] ) ; ] ; sh:if [ <http://datashapes.org/sparql#isIRI> ( [ sh:path sh:path ; ] ) ; ] ; sh:then [ <http://topbraid.org/sparqlmotionfunctions#qname> ( [ sh:path sh:path ; ] ) ; ] ; ] ; . tosh:PropertyShapeView-qualifiedMaxCount a sh:PropertyShape ; sh:path sh:qualifiedMaxCount ; sh:datatype xsd:integer ; sh:description "The maximum number of values that may conform to the qualified value shape." ; sh:group tosh:QualifiedCardinalityConstraintsPropertyGroup ; sh:maxCount 1 ; sh:name "qualified max count" ; sh:order "1"^^xsd:decimal ; . tosh:PropertyShapeView-qualifiedMinCount a sh:PropertyShape ; sh:path sh:qualifiedMinCount ; sh:datatype xsd:integer ; sh:description "The minimum number of values that must conform to the qualified value shape." ; sh:group tosh:QualifiedCardinalityConstraintsPropertyGroup ; sh:maxCount 1 ; sh:name "qualified min count" ; sh:order "0"^^xsd:decimal ; . tosh:PropertyShapeView-qualifiedValueShape a sh:PropertyShape ; sh:path sh:qualifiedValueShape ; sh:class sh:NodeShape ; sh:description "The shape that the specified number of values must conform to." ; sh:group tosh:QualifiedCardinalityConstraintsPropertyGroup ; sh:name "qualified value shape" ; sh:order "2"^^xsd:decimal ; . tosh:PropertyShapeView-qualifiedValueShapesDisjoint a sh:PropertyShape ; sh:path sh:qualifiedValueShapesDisjoint ; sh:datatype xsd:boolean ; sh:description "True to treat all qualified values as disjoint." ; sh:group tosh:QualifiedCardinalityConstraintsPropertyGroup ; sh:maxCount 1 ; sh:name "qualified value shapes disjoint" ; sh:order "3"^^xsd:decimal ; . tosh:PropertyTableViewer a dash:MultiViewer ; dash:hidden true ; rdfs:label "Property table viewer" ; . tosh:QualifiedCardinalityConstraintsPropertyGroup a sh:PropertyGroup ; rdfs:comment "The properties in this group are used together to express that a certain number of values must conform to a given shape." ; rdfs:label "Qualified Cardinality Constraints" ; sh:order "77"^^xsd:decimal ; . tosh:QueryTestCase-expectedResult a sh:PropertyShape ; sh:path dash:expectedResult ; dash:singleLine false ; sh:description "The expected result set, as a JSON string." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:name "expected result" ; sh:or ( [ sh:datatype rdf:JSON ; ] [ sh:datatype xsd:string ; ] ) ; . tosh:RDFSOWLClassView a sh:NodeShape ; dash:applicableToClass rdfs:Class ; rdfs:comment "A node shape collecting RDFS and OWL axioms for classes." ; rdfs:label "RDFS/OWL class view" ; sh:property tosh:Class-disjointWith ; sh:property tosh:Class-domain-inverse ; sh:property tosh:Class-equivalentClass ; sh:property tosh:Class-range-inverse ; sh:property tosh:Class-subClassOf ; sh:property tosh:Class-subClassOf-inverse ; sh:property tosh:Resource-comment ; sh:property tosh:Resource-label ; sh:property tosh:Resource-type ; . tosh:RDFSPropertyAxiomsPropertyGroup a sh:PropertyGroup ; rdfs:label "RDFS Property Axioms" ; sh:order "15"^^xsd:decimal ; . tosh:ReferencesPropertyGroup a sh:PropertyGroup ; rdfs:comment "A property group typically used for incoming references or usages."^^rdf:HTML ; rdfs:label "References" ; sh:order "100"^^xsd:decimal ; . tosh:ReificationPropertyGroup a sh:PropertyGroup ; rdfs:label "Reification (Statements about Statements)" ; sh:order "90"^^xsd:decimal ; . tosh:ReplaceWithDefaultValueSuggestionGenerator a dash:SPARQLUpdateSuggestionGenerator ; rdfs:comment "Produces a suggestion to replace all values of the given predicate (which must exist) at the focus node to the default value declared at the shape that has caused the violation. Does nothing if the shape does not declare a sh:defaultValue. Deletes any old value of the property." ; rdfs:label "Replace with default value suggestion generator" ; sh:message "Replace with default value" ; sh:prefixes <http://topbraid.org/tosh> ; sh:select """SELECT ?defaultValue WHERE { GRAPH $shapesGraph { $sourceShape sh:defaultValue ?defaultValue . } }""" ; sh:update """DELETE { $focusNode $predicate ?oldValue . } INSERT { $focusNode $predicate ?defaultValue . } WHERE { $focusNode $predicate ?oldValue . }""" ; . tosh:Resource-comment a sh:PropertyShape ; sh:path rdfs:comment ; dash:propertyRole dash:DescriptionRole ; dash:singleLine false ; graphql:name "comments" ; sh:description "The comments of this, possibly in multiple languages." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "comments" ; sh:or dash:StringOrLangStringOrHTML ; sh:order "1"^^xsd:decimal ; . tosh:Resource-label a sh:PropertyShape ; sh:path rdfs:label ; dash:propertyRole dash:LabelRole ; graphql:name "labels" ; sh:description "The display name(s) of this, possibly in multiple languages." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "labels" ; sh:or dash:StringOrLangString ; sh:order "0"^^xsd:decimal ; . tosh:Resource-type a sh:PropertyShape ; sh:path rdf:type ; graphql:name "types" ; sh:class rdfs:Class ; sh:description "The type(s) of this." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "types" ; sh:order "10"^^xsd:decimal ; . tosh:ResourceAction-jsCondition a sh:PropertyShape ; sh:path dash:jsCondition ; sh:datatype xsd:string ; sh:description "An (ADS) JavaScript expression that will be executed to determine whether the action is applicable to the selected resource in the current context. The variable focusNode can be queried here. The expression needs to return true for the action to be deemed suitable." ; sh:group tosh:ImplementationPropertyGroup ; sh:name "action pre-condition" ; sh:order "25"^^xsd:decimal ; . tosh:ResourceView a sh:NodeShape ; rdfs:comment "A generic view shape that can be used as fallback to display typical resources that have an rdfs:label and an rdfs:comment." ; rdfs:label "Resource view" ; sh:property tosh:Resource-comment ; sh:property tosh:Resource-label ; . tosh:Rule-condition a sh:PropertyShape ; sh:path sh:condition ; sh:description "The pre-conditions that must apply before a rule gets executed. The focus node must conform to all conditions, which must be shapes." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "conditions" ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order "40"^^xsd:decimal ; . tosh:Rule-deactivated a sh:PropertyShape ; sh:path sh:deactivated ; sh:datatype xsd:boolean ; sh:description "True to deactivate the rule so that it will not get executed." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "deactivated" ; sh:order "30"^^xsd:decimal ; . tosh:Rule-order a sh:PropertyShape ; sh:path sh:order ; sh:description "The order of this rule relative to other rules at the same shape. Rules with lower order are executed first. Default value is 0. Rules with the same order cannot \"see\" each other's inferences." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "order" ; sh:or ( [ sh:datatype xsd:decimal ; ] [ sh:datatype xsd:integer ; ] ) ; sh:order "35"^^xsd:decimal ; . tosh:Rule-rule-inverse a sh:PropertyShape ; sh:path [ sh:inversePath sh:rule ; ] ; sh:class sh:Shape ; sh:description "The shapes or classes that the rule is attached to." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "rule of" ; sh:order "20"^^xsd:decimal ; . tosh:SHMinMaxEditor a dash:SingleEditor ; dash:hidden true ; rdfs:comment "An internally used editor for min/max range values of property shapes."^^rdf:HTML ; rdfs:label "SHACL Min Max Editor" ; . tosh:SPARQLAskExecutable-ask a sh:PropertyShape ; sh:path sh:ask ; dash:singleLine false ; sh:datatype xsd:string ; sh:description "The SPARQL ASK query string." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "ask" ; sh:order "1"^^xsd:decimal ; . tosh:SPARQLConstraint-deactivated a sh:PropertyShape ; sh:path sh:deactivated ; sh:datatype xsd:boolean ; sh:description "True to deactive this constraint." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "deactivated" ; sh:order "30"^^xsd:decimal ; . tosh:SPARQLConstraint-message a sh:PropertyShape ; sh:path sh:message ; sh:description "The message(s) that should be produced for constraint violations. The messages may contain placeholders such as {$value} for any variable returned in the SELECT clause of the SPARQL query." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "messages" ; sh:or dash:StringOrLangString ; sh:order "20"^^xsd:decimal ; . tosh:SPARQLConstructExecutable-construct a sh:PropertyShape ; sh:path sh:construct ; dash:singleLine false ; sh:datatype xsd:string ; sh:description "The SPARQL CONSTRUCT query string." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "construct" ; sh:order "1"^^xsd:decimal ; . tosh:SPARQLExecutable-prefixes a sh:PropertyShape ; sh:path sh:prefixes ; sh:class owl:Ontology ; sh:description "The Ontology declaring the SHACL prefix declarations to use for the SPARQL query." ; sh:group tosh:ImplementationPropertyGroup ; sh:name "prefixes" ; sh:order "0"^^xsd:decimal ; . tosh:SPARQLSelectExecutable-select a sh:PropertyShape ; sh:path sh:select ; dash:singleLine false ; sh:datatype xsd:string ; sh:description "The SPARQL SELECT query string." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "select" ; sh:order "1"^^xsd:decimal ; . tosh:SPARQLUpdateExecutable-update a sh:PropertyShape ; sh:path sh:update ; dash:singleLine false ; sh:datatype xsd:string ; sh:description "The SPARQL UPDATE request string." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "update" ; sh:order "1"^^xsd:decimal ; . tosh:Script-js a sh:PropertyShape ; sh:path dash:js ; sh:datatype xsd:string ; sh:description "The implementation as JavaScript." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "JavaScript code" ; sh:order "20"^^xsd:decimal ; . tosh:Script-onAllValues a sh:PropertyShape ; sh:path dash:onAllValues ; sh:datatype xsd:boolean ; sh:description "If true then all value nodes will be available to the script at once, through the variable \"values\"." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "on all values" ; sh:order "0"^^xsd:decimal ; . tosh:ScriptConstraint-deactivated a sh:PropertyShape ; sh:path sh:deactivated ; sh:datatype xsd:boolean ; sh:description "True to deactivate this constraint." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "deactivated" ; sh:order "30"^^xsd:decimal ; . tosh:ScriptConstraint-message a sh:PropertyShape ; sh:path sh:message ; sh:description "The message(s) to use for violations produced by this script." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "messages" ; sh:or dash:StringOrLangString ; sh:order "20"^^xsd:decimal ; . tosh:ScriptFunction-canWrite a sh:PropertyShape ; sh:path dash:canWrite ; sh:datatype xsd:boolean ; sh:description "True to allow this function to have side effects. By default, functions are not permitted to modify the graph as this would violate SPARQL contracts. However, if canWrite is true then the function will not be available as a SPARQL function and only be injected into the generated API in read/write mode." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "can write" ; sh:order "15"^^xsd:decimal ; . tosh:ScriptTestCase-expectedResult a sh:PropertyShape ; sh:path dash:expectedResult ; sh:description "The expected result of the evaluation, as JSON object as produced by the servlet, or true or false." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:name "expected result" ; sh:or ( [ sh:datatype rdf:JSON ; ] [ sh:datatype xsd:boolean ; ] ) ; sh:order "0"^^xsd:decimal ; . tosh:ScriptTestCase-focusNode a sh:PropertyShape ; sh:path dash:focusNode ; sh:description "The selected resource, which will become value of focusNode for the script, with its \"most suitable\" JavaScript class as type. Defaults to the test case itself." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:name "focus node" ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order "10"^^xsd:decimal ; . tosh:ScriptsPropertyGroup a sh:PropertyGroup ; rdfs:comment "Scripts based on Active Data Shapes." ; rdfs:label "Scripts" ; sh:order "30"^^xsd:decimal ; . tosh:Service-canWrite a sh:PropertyShape ; sh:path dash:canWrite ; sh:datatype xsd:boolean ; sh:description "True if this service can modify the data, i.e. it will execute in read/write mode. By default, all services are read-only." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "can write" ; . tosh:Service-deactivated a sh:PropertyShape ; sh:path sh:deactivated ; sh:datatype xsd:boolean ; sh:description "True to deactivate this service." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "deactivated" ; sh:order "30"^^xsd:decimal ; . tosh:Service-responseContentType a sh:PropertyShape ; sh:path dash:responseContentType ; sh:datatype xsd:string ; sh:description "The content type (mime type) of the service response, defaulting to \"application/json\". Use \"void\" to return nothing." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "response content type" ; sh:order "10"^^xsd:decimal ; . tosh:SetToDefaultValueSuggestionGenerator a dash:SPARQLUpdateSuggestionGenerator ; rdfs:comment "Produces a suggestion to set the given predicate at the focus node to the default value declared at the shape that has caused the violation. Does nothing if the shape does not declare a sh:defaultValue. Deletes any old value of the property." ; rdfs:label "Set to default value suggestion generator" ; sh:message "Set to default value" ; sh:prefixes <http://topbraid.org/tosh> ; sh:select """SELECT ?defaultValue WHERE { GRAPH $shapesGraph { $sourceShape sh:defaultValue ?defaultValue . } }""" ; sh:update """DELETE { $focusNode $predicate ?oldValue . } INSERT { $focusNode $predicate ?defaultValue . } WHERE { OPTIONAL { $focusNode $predicate ?oldValue . } }""" ; . tosh:Shape-datatypes a sh:PropertyShape ; sh:path tosh:datatypes ; dash:neverMaterialize true ; dash:viewer tosh:DatatypesViewer ; sh:description "Zero of more datatypes that value nodes can take. In SHACL, the typical pattern is to either use a single sh:datatype or a sh:or of multiple sh:datatype constraints. This inferred property here provides a unified way to access these two design patterns." ; sh:group tosh:TypeOfValuesPropertyGroup ; sh:name "datatypes" ; sh:nodeKind sh:IRI ; sh:order "0"^^xsd:decimal ; sh:values [ sh:union ( [ sh:path sh:datatype ; ] [ sh:path ( sh:or [ sh:zeroOrMorePath rdf:rest ; ] rdf:first sh:datatype ) ; ] ) ; ] ; . tosh:Shape-deactivated a sh:PropertyShape ; sh:path sh:deactivated ; sh:datatype xsd:boolean ; sh:description "True to deactivate this shape, making it literally invisible and without any effect." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "deactivated" ; sh:order "30"^^xsd:decimal ; . tosh:Shape-severity a sh:PropertyShape ; sh:path sh:severity ; dash:editor dash:InstancesSelectEditor ; sh:class sh:Severity ; sh:description "The severity to be used for validation results produced by the constraints." ; sh:group tosh:ValidationPropertyGroup ; sh:maxCount 1 ; sh:name "severity" ; sh:order "0"^^xsd:decimal ; . tosh:ShapeInGraphConstraintComponent a sh:ConstraintComponent ; dash:propertySuggestionGenerator tosh:DeleteTripleSuggestionGenerator ; rdfs:comment """A constraint component that can be used to verify that the value nodes have a given shape, where the shape validation is executed in a given graph. This can, for example, be used to verify that a given value is declared as an instance of a given class in some specified (not imported) graph. A typical design pattern is as follows: ex:NodeShape sh:property [ sh:path ex:myProperty ; sh:nodeKind sh:IRI ; tosh:graph <http://example.org/externalGraph> ; tosh:shapeInGraph [ sh:class ex:ExternalClass ; ] ; tosh:editor tosh:InstancesInGraphSelectEditor ; tosh:viewer tosh:URIInGraphViewer ; ] .""" ; rdfs:label "Shape in graph constraint component" ; sh:labelTemplate "Values must have shape {$shapeInGraph} defined in graph {$graph}" ; sh:message "Value does not have shape {$shapeInGraph} defined in graph {$graph}" ; sh:parameter [ a sh:Parameter ; sh:path tosh:graph ; sh:nodeKind sh:IRI ; ] ; sh:parameter [ a sh:Parameter ; sh:path tosh:shapeInGraph ; sh:nodeKind sh:BlankNodeOrIRI ; ] ; sh:validator [ a sh:SPARQLAskValidator ; sh:ask """ASK { GRAPH $graph { FILTER tosh:hasShape($value, $shapeInGraph) } }""" ; sh:prefixes <http://topbraid.org/tosh> ; ] ; . tosh:StringConstraintsPropertyGroup a sh:PropertyGroup ; rdfs:label "String Constraints" ; sh:order "70"^^xsd:decimal ; . tosh:SystemNamespaceShape a sh:NodeShape ; rdfs:comment "A shape that detects whether the focus node is a URI that has a namespace from one of the system namespaces - RDF, RDFS, OWL etc. The list of actual system namespaces is represented via tosh:systemNamespace true triples." ; rdfs:label "System namespace shape" ; sh:sparql [ a sh:SPARQLConstraint ; sh:message "Not a IRI from a system namespace" ; sh:prefixes <http://topbraid.org/tosh> ; sh:select """SELECT $this WHERE { FILTER (!isIRI($this) || (isIRI($this) && EXISTS { BIND (IRI(afn:namespace($this)) AS ?ns) . FILTER NOT EXISTS { ?ns tosh:systemNamespace true } . } )) . }""" ; ] ; . tosh:TargetsPropertyGroup a sh:PropertyGroup ; rdfs:label "Targets" ; sh:order "5"^^xsd:decimal ; . tosh:TeamworkPlatform a dash:ExecutionPlatform ; dash:includedExecutionPlatform tosh:TopBraidPlatform ; rdfs:comment "The platform consisting of TopBraid plus any teamwork features used by TopBraid EDG." ; rdfs:label "Teamwork platform" ; . tosh:TestCase-deactivated a sh:PropertyShape ; sh:path sh:deactivated ; sh:datatype xsd:boolean ; sh:description "If set to true, this test case will be skipped." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:name "deactivated" ; sh:order "50"^^xsd:decimal ; . tosh:TestPropertiesPropertyGroup a sh:PropertyGroup ; rdfs:label "Test Properties" ; sh:order "20"^^xsd:decimal ; . tosh:TopBraidPlatform a dash:ExecutionPlatform ; rdfs:comment "The platform consisting of TopBraid." ; rdfs:label "TopBraid platform" ; . tosh:TripleRule-object a sh:PropertyShape ; sh:path sh:object ; dash:viewer dash:NodeExpressionViewer ; sh:description "The node expression producing the object(s) of the triple inferred by the rule." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:minCount 1 ; sh:name "object" ; sh:order 2 ; . tosh:TripleRule-predicate a sh:PropertyShape ; sh:path sh:predicate ; dash:viewer dash:NodeExpressionViewer ; sh:description "The node expression producing the predicate(s) of the triple inferred by the rule." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:minCount 1 ; sh:name "predicate" ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order 1 ; . tosh:TripleRule-subject a sh:PropertyShape ; sh:path sh:subject ; dash:viewer dash:NodeExpressionViewer ; sh:description "The node expression producing the subject(s) of the triple inferred by the rule." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:minCount 1 ; sh:name "subject" ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order 0 ; . tosh:TypeOfValuesPropertyGroup a sh:PropertyGroup ; rdfs:label "Type of Values" ; sh:order "50"^^xsd:decimal ; . tosh:URIInGraphViewer a dash:SingleViewer ; rdfs:comment "A viewer for URI resources that have their data in a given graph that may be outside of the imports closure. The graph must be specified using a tosh:graph constraint for the property." ; rdfs:label "URI in graph viewer" ; . tosh:UseDeclaredDatatypeConstraintComponent a sh:ConstraintComponent ; dash:propertySuggestionGenerator [ a dash:SPARQLUpdateSuggestionGenerator ; sh:message "Change datatype of the invalid value to the specified sh:datatype" ; sh:prefixes <http://topbraid.org/tosh> ; sh:update """DELETE { $subject $predicate $object . } INSERT { $subject $predicate ?newObject . } WHERE { $subject sh:datatype ?datatype . BIND (spif:cast(?object, ?datatype) AS ?newObject) . }""" ; ] ; rdfs:comment "Constrains the value nodes to be either non-literals or literals that have the same datatype as the declared sh:datatype for the given constraint node. This is used, among others, in properties such as sh:hasValue and sh:minExclusive." ; rdfs:label "Use declared datatype constraint component" ; sh:parameter [ a sh:Parameter ; sh:path tosh:useDeclaredDatatype ; sh:datatype xsd:boolean ; sh:description "True to state that the datatype of literal values must be the same as the declared sh:datatype." ; sh:name "use declared datatype" ; ] ; sh:propertyValidator [ a sh:SPARQLSelectValidator ; sh:message "Datatype must match the declared datatype " ; sh:prefixes <http://topbraid.org/tosh> ; sh:select """ SELECT DISTINCT $this ?value ?datatype WHERE { { FILTER ($useDeclaredDatatype) } $this sh:datatype ?datatype . $this $PATH ?value . FILTER (isLiteral(?value) && datatype(?value) != ?datatype) . }""" ; ] ; sh:targetClass sh:PropertyShape ; . tosh:ValidationPropertyGroup a sh:PropertyGroup ; rdfs:label "Validation" ; sh:order "30"^^xsd:decimal ; . tosh:ValidationTestCase-expectedResult a sh:PropertyShape ; sh:path dash:expectedResult ; sh:description "The expected validation report, either as instance of sh:ValidationReport or a Turtle string with one instance of sh:ValidationReport in it when parsed." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:name "expected result" ; sh:or ( [ sh:datatype xsd:string ; ] [ sh:class sh:ValidationReport ; ] ) ; sh:order "10"^^xsd:decimal ; . tosh:ValidationTestCase-includeSuggestions a sh:PropertyShape ; sh:path dash:includeSuggestions ; sh:datatype xsd:boolean ; sh:description "True to also generate and verify suggestions." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:name "include suggestions" ; sh:order "0"^^xsd:decimal ; . tosh:ValidationTestCase-validateShapes a sh:PropertyShape ; sh:path dash:validateShapes ; sh:datatype xsd:boolean ; sh:description "True to also validate shapes themselves." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:name "validate shapes" ; sh:order "5"^^xsd:decimal ; . tosh:ValueConstraintsPropertyGroup a sh:PropertyGroup ; rdfs:label "Value Constraints" ; sh:order "60"^^xsd:decimal ; . tosh:ValueRangePropertyGroup a sh:PropertyGroup ; rdfs:label "Value Range" ; sh:order "60"^^xsd:decimal ; . tosh:countShapesWithMatchResult a sh:SPARQLFunction ; rdfs:comment "Counts the number of shapes from a given rdf:List (?arg2) defined in a given shapes graph (?arg3) where tosh:hasShape returns the provided match value (true or false, ?arg4) for a given focus node (?arg1). The function produces a failure if one of the shapes validated to a failure." ; rdfs:label "count shapes with match result" ; sh:parameter [ a sh:Parameter ; sh:path sh:expectedValue ; sh:datatype xsd:boolean ; sh:description "The expected value of tosh:hasShape to count." ; sh:order 3.0 ; ] ; sh:parameter [ a sh:Parameter ; sh:path sh:focusNode ; sh:class rdfs:Resource ; sh:description "The focus node." ; sh:order 0.0 ; ] ; sh:parameter [ a sh:Parameter ; sh:path sh:shapes ; sh:class rdf:List ; sh:description "The list of shapes to walk through." ; sh:order 1.0 ; ] ; sh:parameter [ a sh:Parameter ; sh:path sh:shapesGraph ; sh:class rdfs:Resource ; sh:description "The shapes graph." ; sh:order 2.0 ; ] ; sh:prefixes <http://topbraid.org/tosh> ; sh:returnType xsd:integer ; sh:select """ # The SUM will fail with an error if one of the operands is not a number # (this mechanism is used to propagate errors from tosh:hasShape calls) SELECT (SUM(?s) AS ?result) WHERE { GRAPH $shapesGraph { $shapes rdf:rest*/rdf:first ?shape . } BIND (tosh:hasShape($focusNode, ?shape, true) AS ?hasShape) . BIND (IF(bound(?hasShape), IF(?hasShape = $expectedValue, 1, 0), 'error') AS ?s) . } """ ; . tosh:editGroupDescription a rdf:Property ; rdfs:comment "A description of the property group when in \"edit\" mode." ; rdfs:domain sh:PropertyGroup ; rdfs:label "edit group description" ; rdfs:range xsd:string ; . tosh:graph a rdf:Property ; rdfs:comment "The graph that the shape is validated in." ; rdfs:label "graph" ; . tosh:hasDatatype a sh:SPARQLAskValidator ; rdfs:comment "Checks whether a given node ($value) is a literal with a given datatype ($datatype), and that the literal is well-formed." ; rdfs:label "has datatype" ; sh:ask """ ASK { FILTER (datatype($value) = $datatype && spif:isValidForDatatype($value, $datatype)) . } """ ; sh:prefixes <http://topbraid.org/tosh> ; . tosh:hasShape a sh:Function ; dash:apiStatus dash:Experimental ; rdfs:comment """A built-in function of the TopBraid SHACL implementation. Can be used to validate a given (focus) node against a given shape, returning <code>true</code> if the node is valid. If executed within a SHACL validation engine, this uses the shapes graph that was provided when the engine started. If executed in other contexts, e.g. in a stand-alone SPARQL query, the function attempts to use the URI of the current default graph as the shapes graph. This may not always be supported. If called
57
Various changes (from latest TopBraid snapshot)
7
.ttl
ttl
apache-2.0
TopQuadrant/shacl
307
<NME> tosh.ttl <BEF> # baseURI: http://topbraid.org/tosh # imports: http://datashapes.org/dash # prefix: tosh @prefix dash: <http://datashapes.org/dash#> . @prefix graphql: <http://datashapes.org/graphql#> . @prefix owl: <http://www.w3.org/2002/07/owl#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix sh: <http://www.w3.org/ns/shacl#> . @prefix swa: <http://topbraid.org/swa#> . @prefix tosh: <http://topbraid.org/tosh#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . dash: tosh:systemNamespace true ; . dash:Action sh:property tosh:Action-actionGroup ; sh:property tosh:Action-actionIconClass ; sh:property tosh:Action-deactivated ; . dash:ActionGroup sh:property tosh:ActionGroup-order ; sh:property tosh:Resource-comment ; sh:property tosh:Resource-label ; . dash:ActionTestCase sh:property tosh:ActionTestCase-action ; sh:property tosh:ActionTestCase-expectedResult ; sh:property tosh:ActionTestCase-focusNode ; sh:property tosh:ActionTestCase-variables ; . dash:ChangeScript sh:property tosh:ChangeScript-deactivated ; sh:property tosh:ChangeScript-order ; dash:StemConstraintComponent-stem sh:group tosh:StringBasedConstraintPropertyGroup ; . <http://spinrdf.org/sp#> tosh:systemNamespace "true"^^xsd:boolean ; . dash:IndexedConstraintComponent-indexed sh:group tosh:ReificationPropertyGroup ; sh:order "1"^^xsd:decimal ; . dash:InferencingTestCase sh:property tosh:InferencingTestCase-expectedResult ; . dash:JSTestCase sh:property tosh:JSTestCase-expectedResult ; . dash:MultiFunction sh:property tosh:Function-apiStatus ; sh:property tosh:MultiFunction-resultVariable ; . dash:NonRecursiveConstraintComponent dash:propertySuggestionGenerator tosh:DeleteTripleSuggestionGenerator ; . dash:NonRecursiveConstraintComponent-nonRecursive sh:group tosh:ValueConstraintsPropertyGroup ; sh:order "5"^^xsd:decimal ; . dash:PrimaryKeyConstraintComponent-uriStart sh:group tosh:StringConstraintsPropertyGroup ; sh:order "40"^^xsd:decimal ; . dash:PropertyRole sh:property tosh:Resource-comment ; sh:property tosh:Resource-label ; . dash:QueryTestCase sh:property tosh:QueryTestCase-expectedResult ; . dash:ReifiableByConstraintComponent-reifiableBy sh:group tosh:ReificationPropertyGroup ; sh:order "0"^^xsd:decimal ; . dash:ResourceAction sh:property tosh:ResourceAction-jsCondition ; . dash:RootClassConstraintComponent dash:propertySuggestionGenerator tosh:DeleteTripleSuggestionGenerator ; . tosh:CardinalityConstraintPropertyGroup rdf:type sh:PropertyGroup ; rdfs:label "Cardinality" ; sh:order 2 ; . tosh:ComplexConstraintPropertyGroup rdf:type sh:PropertyGroup ; tosh:editGroupDescription "Most edit fields in this section currently require Turtle source code, esp to enter blank node expressions. To reference existing shapes via their URI, enter them as <URI>." ; tosh:openable "true"^^xsd:boolean ; rdfs:label "Complex Constraints" ; sh:order 9 ; . tosh:ConstraintMetadataPropertyGroup sh:property tosh:Resource-comment ; sh:property tosh:Resource-label ; sh:property tosh:Script-js ; . dash:ScriptConstraint sh:property tosh:Script-onAllValues ; sh:property tosh:ScriptConstraint-deactivated ; sh:property tosh:ScriptConstraint-message ; . dash:ScriptConstraintComponent-scriptConstraint sh:group tosh:AdvancedPropertyGroup ; sh:order "20"^^xsd:decimal ; . dash:ScriptFunction sh:property tosh:ScriptFunction-canWrite ; . tosh:DisplayPropertyGroup rdf:type sh:PropertyGroup ; rdfs:comment "A group for properties that are primarily for display purposes (names, ordering etc)." ; rdfs:label "Display" ; sh:order 1 ; . tosh:MemberShapeConstraintComponent dash:Service sh:property tosh:Service-canWrite ; sh:property tosh:Service-deactivated ; sh:property tosh:Service-responseContentType ; . dash:StemConstraintComponent-stem sh:group tosh:StringConstraintsPropertyGroup ; sh:order "45"^^xsd:decimal ; . dash:SubSetOfConstraintComponent-subSetOf sh:group tosh:PropertyPairConstraintsPropertyGroup ; sh:order "20"^^xsd:decimal ; . dash:SymmetricConstraintComponent dash:propertySuggestionGenerator tosh:DeleteTripleSuggestionGenerator ; dash:propertySuggestionGenerator [ a dash:SPARQLUpdateSuggestionGenerator ; sh:message "Add symmetric value." ; sh:order "0"^^xsd:decimal ; sh:prefixes <http://topbraid.org/tosh> ; sh:update """INSERT { $value $predicate $focusNode . } WHERE { }""" ; ] ; . dash:SymmetricConstraintComponent-symmetric sh:group tosh:ValueConstraintsPropertyGroup ; sh:order "10"^^xsd:decimal ; . dash:TestCase sh:property tosh:TestCase-deactivated ; . dash:TestCaseResult sh:property [ a sh:PropertyShape ; sh:path dash:testCase ; sh:class dash:TestCase ; sh:description "The dash:TestCase that was executed." ; sh:maxCount 1 ; sh:minCount 1 ; sh:name "test case" ; tosh:PropertyPairConstraintPropertyGroup rdf:type sh:PropertyGroup ; tosh:openable "true"^^xsd:boolean ; rdfs:label "Property Pairs" ; sh:order 6 ; . tosh:PropertyShapeShape sh:minCount 1 ; sh:name "test graph" ; sh:nodeKind sh:IRI ; ] ; . dash:UniqueValueForClassConstraintComponent-uniqueValueForClass sh:group tosh:ValueConstraintsPropertyGroup ; sh:order "20"^^xsd:decimal ; . dash:ValidationTestCase sh:property tosh:ValidationTestCase-expectedResult ; sh:property tosh:ValidationTestCase-includeSuggestions ; sh:property tosh:ValidationTestCase-validateShapes ; . dash:Widget sh:property tosh:Resource-comment ; sh:property tosh:Resource-label ; . dash:Widget-hidden sh:group tosh:DisplayPropertyGroup ; . <http://spinrdf.org/sp#> tosh:systemNamespace true ; . <http://spinrdf.org/spin#> tosh:systemNamespace true ; . <http://spinrdf.org/spl#> tosh:systemNamespace true ; . <http://topbraid.org/tosh> a owl:Ontology ; dash:generateClass dash:ConstraintReificationShape ; dash:generateClass rdf:Property ; dash:generateClass rdfs:Class ; dash:generateClass rdfs:Datatype ; dash:generateClass owl:Class ; dash:generateClass owl:Ontology ; dash:generateClass sh:ConstraintComponent ; dash:generateClass sh:PropertyGroup ; dash:generateClass sh:Rule ; dash:generateClass sh:Shape ; dash:generatePrefixConstants "dash" ; dash:generatePrefixConstants "owl" ; dash:generatePrefixConstants "rdf" ; dash:generatePrefixConstants "rdfs" ; dash:generatePrefixConstants "sh" ; dash:generatePrefixConstants "xsd" ; rdfs:comment """A collection of SHACL features that are available whenever SHACL graphs are used within TopBraid Suite products. In particular this includes shape definitions for the \"system\" classes such as rdfs:Class, sh:PropertyShape etc. These shapes are used by TopBraid products to validate ontology definitions and to drive user interface forms. The TOSH namespace also includes things like suggestions, Active Data Shapes scripts and a couple of SPARQL functions. Some of these may be of general use outside of TopBraid too.""" ; rdfs:label "TopBraid Data Shapes Library" ; owl:imports <http://datashapes.org/dash> ; sh:declare [ a sh:PrefixDeclaration ; sh:namespace "http://jena.hpl.hp.com/ARQ/function#"^^xsd:anyURI ; sh:prefix "afn" ; ] ; sh:declare [ a sh:PrefixDeclaration ; sh:namespace "http://spinrdf.org/spif#"^^xsd:anyURI ; sh:prefix "spif" ; ] ; sh:declare [ a sh:PrefixDeclaration ; sh:namespace "http://topbraid.org/sparqlmotionfunctions#"^^xsd:anyURI ; sh:prefix "smf" ; ] ; sh:declare [ a sh:PrefixDeclaration ; sh:namespace "http://topbraid.org/tosh#"^^xsd:anyURI ; sh:prefix "tosh" ; ] ; . tosh: tosh:systemNamespace true ; . tosh:Action-actionGroup a sh:PropertyShape ; sh:path dash:actionGroup ; sh:class dash:ActionGroup ; sh:description "The Action Group that the action should appear in (in menus etc)." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:order "5"^^xsd:decimal ; . tosh:Action-actionIconClass a sh:PropertyShape ; sh:path dash:actionIconClass ; sh:datatype xsd:string ; sh:description "The CSS class for the action for display purposes. For example, pick one of https://fontawesome.com/icons?d=gallery&m=free or https://getbootstrap.com/docs/3.3/components/#glyphicons-glyphs" ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:order "7"^^xsd:decimal ; . tosh:Action-deactivated a sh:PropertyShape ; sh:path sh:deactivated ; sh:datatype xsd:boolean ; sh:description "True to deactivate this action (from user interfaces)." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "deactivated" ; sh:order "8"^^xsd:decimal ; . tosh:ActionGroup-order a sh:PropertyShape ; sh:path sh:order ; sh:description "The relative order of this group compared to other groups, e.g. to display in drop down menus." ; sh:group tosh:DisplayPropertyGroup ; sh:maxCount 1 ; sh:name "order" ; sh:or ( [ sh:datatype xsd:decimal ; ] [ sh:datatype xsd:integer ; ] ) ; . tosh:ActionTestCase-action a sh:PropertyShape ; sh:path dash:action ; sh:class dash:Action ; sh:description "The dash:Action to execute." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:minCount 1 ; sh:name "action" ; sh:nodeKind sh:IRI ; sh:order "0"^^xsd:decimal ; . tosh:ActionTestCase-expectedResult a sh:PropertyShape ; sh:path dash:expectedResult ; sh:description "The expected result of the evaluation, as JSON object as produced by the servlet, or true or false." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:name "expected result" ; sh:order "10"^^xsd:decimal ; . tosh:ActionTestCase-focusNode a sh:PropertyShape ; sh:path dash:focusNode ; sh:description "The selected resource, which will become value of focusNode for the script, with its \"most suitable\" JavaScript class as type. Defaults to the test case itself." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:name "focus node" ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order "5"^^xsd:decimal ; . tosh:ActionTestCase-variables a sh:PropertyShape ; sh:path dash:variables ; sh:datatype xsd:string ; sh:description """A JSON object (string) with name-value pairs for the variable bindings. This must be in the same format as expected by the script servlet. For parameters that declare dash:mimeTypes (i.e. file upload parameters), the value needs to be the path to a file relative to the workspace root. This file will be temporarily uploaded for the duration of the test case execution.""" ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:name "variables" ; sh:order "2"^^xsd:decimal ; . tosh:AdvancedPropertyGroup a sh:PropertyGroup ; rdfs:label "Advanced" ; sh:order "95"^^xsd:decimal ; . tosh:ChangeScript-deactivated a sh:PropertyShape ; sh:path sh:deactivated ; sh:datatype xsd:boolean ; sh:description "True to deactivate this script, for example for testing purposes, without having to delete it." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "deactivated" ; sh:order "10"^^xsd:decimal ; . tosh:ChangeScript-order a sh:PropertyShape ; sh:path sh:order ; sh:description "The relative order of this script compared to other change scripts. The default value is 0. Scripts with lower numbers are executed first." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "order" ; tosh:StringBasedConstraintPropertyGroup rdf:type sh:PropertyGroup ; tosh:openable "true"^^xsd:boolean ; rdfs:label "String Constraints" ; sh:order 7 ; . tosh:SystemNamespaceShape ) ; sh:order "40"^^xsd:decimal ; . tosh:Class-ShapeScript a dash:ShapeScript ; dash:js """ /** * Returns this class as an instance of sh:NodeShape. * @returns {sh_NodeShape} */ asNodeShape() { return sh.asNodeShape(this); } }""" ; ] ; . tosh:UseDeclaredDatatypeConstraintComponent rdf:type sh:ConstraintComponent ; dash:propertySuggestionGenerator [ reached = new Set(); } if(!reached.has(this.uri)) { reached.add(this.uri); let result = callback(this); if(result !== undefined && result !== null) { return result; } let supers = this.superclasses; for(let i = 0; i < supers.length; i++) { result = supers[i].walkSuperclasses(callback, reached); if(result !== undefined && result !== null) { return result; } } } } """ ; . tosh:Class-abstract a sh:PropertyShape ; sh:path dash:abstract ; sh:datatype xsd:boolean ; sh:description "States whether this class is abstract, i.e. cannot have direct instances. Abstract classes are typically used to defined shared properties of its subclasses." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "abstract" ; sh:order "30"^^xsd:decimal ; . tosh:Class-classIcon a sh:PropertyShape ; sh:path tosh:classIcon ; dash:hidden true ; dash:propertyRole dash:IconRole ; sh:datatype xsd:string ; sh:defaultValue "http://datashapes.org/icons/class.svg" ; sh:description "Used to return the default icon for all classes." ; sh:group tosh:DisplayPropertyGroup ; sh:maxCount 1 ; tosh:ValueRangeConstraintPropertyGroup rdf:type sh:PropertyGroup ; tosh:openable "true"^^xsd:boolean ; rdfs:label "Value Range" ; sh:order 5 ; . tosh:ValueTypeConstraintPropertyGroup rdf:type sh:PropertyGroup ; tosh:editGroupDescription "Hint: Use \"or\" under Complex Constraints to represent choices between multiple value types." ; rdfs:comment "A property group for constraint parameters that restrict the value types of values." ; rdfs:label "Value Type" ; sh:order 3 ; . tosh:countShapesWithMatchResult tosh:Class-disjointWith a sh:PropertyShape ; sh:path owl:disjointWith ; sh:class owl:Class ; sh:group tosh:OWLAxiomsPropertyGroup ; sh:name "disjoint with" ; sh:order "1"^^xsd:decimal ; . tosh:Class-domain-inverse a sh:PropertyShape ; sh:path [ sh:inversePath rdfs:domain ; ] ; dash:editor dash:PropertyAutoCompleteEditor ; sh:class rdf:Property ; sh:description "The properties that declare to have this class in their domain." ; sh:group tosh:RDFSPropertyAxiomsPropertyGroup ; sh:name "domain of" ; sh:nodeKind sh:IRI ; sh:order "0"^^xsd:decimal ; . tosh:Class-equivalentClass a sh:PropertyShape ; sh:path owl:equivalentClass ; sh:class owl:Class ; sh:group tosh:OWLAxiomsPropertyGroup ; sh:name "equivalent classes" ; sh:order "0"^^xsd:decimal ; . tosh:Class-hidden a sh:PropertyShape ; sh:path dash:hidden ; sh:datatype xsd:boolean ; sh:description "True if this class shall be hidden from the class hierarchies." ; sh:group tosh:DisplayPropertyGroup ; sh:maxCount 1 ; sh:name "hidden" ; sh:order "0"^^xsd:decimal ; . tosh:Class-range-inverse a sh:PropertyShape ; sh:path [ sh:inversePath rdfs:range ; ] ; dash:editor dash:PropertyAutoCompleteEditor ; sh:class rdf:Property ; sh:description "The properties that have this class in their rdfs:range." ; sh:group tosh:RDFSPropertyAxiomsPropertyGroup ; sh:name "range of" ; sh:nodeKind sh:IRI ; sh:order "1"^^xsd:decimal ; . tosh:Class-resourceAction a sh:PropertyShape ; sh:path dash:resourceAction ; graphql:name "resourceActions" ; sh:class dash:ResourceAction ; sh:description "The Resource Actions that can be applied to instances of this class." ; sh:group tosh:ScriptsPropertyGroup ; sh:name "resource actions" ; sh:order "0"^^xsd:decimal ; . tosh:Class-resourceService a sh:PropertyShape ; sh:path dash:resourceService ; graphql:name "resourceServices" ; sh:class dash:ResourceService ; sh:description "The Services that can be applied to instances of this class (as focusNode)." ; sh:group tosh:ScriptsPropertyGroup ; sh:name "resource services" ; sh:order "10"^^xsd:decimal ; . tosh:Class-subClassOf a sh:PropertyShape ; sh:path rdfs:subClassOf ; graphql:name "superclasses" ; sh:class rdfs:Class ; sh:description "The (direct) parent classes of this class." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "superclasses" ; sh:order "20"^^xsd:decimal ; . tosh:Class-subClassOf-inverse a sh:PropertyShape ; sh:path [ sh:inversePath rdfs:subClassOf ; ] ; dash:hidden true ; graphql:name "subclasses" ; sh:class rdfs:Class ; sh:description "The (direct) subclasses of this class." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "subclasses" ; sh:order "21"^^xsd:decimal ; . tosh:ConstraintComponent-localConstraint a sh:PropertyShape ; sh:path dash:localConstraint ; sh:datatype xsd:boolean ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "local constraint" ; sh:order "10"^^xsd:decimal ; . tosh:ConstraintComponent-message a sh:PropertyShape ; sh:path sh:message ; sh:description "The message to generate on violations." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "messages" ; sh:or dash:StringOrLangString ; sh:order "26"^^xsd:decimal ; . tosh:ConstraintComponent-nodeValidator a sh:PropertyShape ; sh:path sh:nodeValidator ; sh:class sh:Validator ; sh:description "The validator(s) used to evaluate a constraint in the context of a node shape." ; sh:group tosh:ImplementationPropertyGroup ; sh:name "node validators" ; sh:order "2"^^xsd:decimal ; . tosh:ConstraintComponent-propertySuggestionGenerator a sh:PropertyShape ; sh:path dash:propertySuggestionGenerator ; sh:class dash:SuggestionGenerator ; sh:group tosh:ImplementationPropertyGroup ; sh:name "property suggestion generators" ; sh:order "20"^^xsd:decimal ; . tosh:ConstraintComponent-propertyValidator a sh:PropertyShape ; sh:path sh:propertyValidator ; sh:class sh:Validator ; sh:description "The validator(s) used to evaluate a constraint in the context of a property shape." ; sh:group tosh:ImplementationPropertyGroup ; sh:name "property validators" ; sh:order "1"^^xsd:decimal ; . tosh:ConstraintComponent-staticConstraint a sh:PropertyShape ; sh:path dash:staticConstraint ; sh:datatype xsd:boolean ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "static constraint" ; sh:order "11"^^xsd:decimal ; . tosh:ConstraintComponent-validator a sh:PropertyShape ; sh:path sh:validator ; sh:class sh:Validator ; sh:description "The validator(s) used to evaluate constraints of either node or property shapes, unless more specific validators are available." ; sh:group tosh:ImplementationPropertyGroup ; sh:name "validators" ; sh:order "0"^^xsd:decimal ; . tosh:DatatypePropertyShapeView a sh:NodeShape ; rdfs:comment "The default view shape for property shapes on datatype values." ; rdfs:label "Attribute view" ; sh:node tosh:PropertyShapeView ; sh:property dash:PrimaryKeyConstraintComponent-uriStart ; sh:property dash:SingleLineConstraintComponent-singleLine ; sh:property tosh:Shape-datatypes ; sh:property sh:LanguageInConstraintComponent-languageIn ; sh:property sh:LessThanConstraintComponent-lessThan ; sh:property sh:LessThanOrEqualsConstraintComponent-lessThanOrEquals ; sh:property sh:MaxExclusiveConstraintComponent-maxExclusive ; sh:property sh:MaxInclusiveConstraintComponent-maxInclusive ; sh:property sh:MaxLengthConstraintComponent-maxLength ; sh:property sh:MinExclusiveConstraintComponent-minExclusive ; sh:property sh:MinInclusiveConstraintComponent-minInclusive ; sh:property sh:MinLengthConstraintComponent-minLength ; sh:property sh:PatternConstraintComponent-flags ; sh:property sh:PatternConstraintComponent-pattern ; sh:property sh:UniqueLangConstraintComponent-uniqueLang ; . tosh:DatatypesViewer a dash:MultiViewer ; dash:hidden true ; rdfs:label "Datatypes viewer" ; . tosh:DefinitionPropertyGroup a sh:PropertyGroup ; rdfs:label "Definition" ; sh:order "0"^^xsd:decimal ; . tosh:DeleteTripleSuggestionGenerator a dash:SPARQLUpdateSuggestionGenerator ; rdfs:comment "Produces a suggestion that would delete the offending value in the validation result from the focus node." ; rdfs:label "Delete triple suggestion generator" ; sh:message "Delete the invalid statement" ; sh:order 100.0 ; sh:update """DELETE { $focusNode $predicate $value . } WHERE { $focusNode $predicate $value . }""" ; . tosh:DependentEnumSelectEditor a dash:SingleEditor ; rdfs:comment """A drop-down editor for enumerated values that are dynamically determined via a node shape that has sh:target dash:HasValueTarget. Example: states:USAddressShape rdf:type sh:NodeShape ; rdfs:label \"US Address shape\" ; sh:property [ rdf:type sh:PropertyShape ; sh:path states:state ; sh:in ( \"AZ\" \"CA\" \"FL\" ) ; ] ; sh:target [ rdf:type dash:HasValueTarget ; dash:object \"USA\" ; dash:predicate states:country ; ] . """ ; rdfs:label "Dependent enum select editor" ; . tosh:DisplayPropertyGroup a sh:PropertyGroup ; rdfs:label "Display" ; sh:order "30"^^xsd:decimal ; . tosh:Function-apiStatus a sh:PropertyShape ; sh:path dash:apiStatus ; sh:class dash:APIStatus ; sh:description "Declares the status of this function within the TopBraid API. The usual life cycle is to start with no value (meaning: not part of the API at all), then experimental from which it later either moves to stable or deprecated. Stable functions may also get deprecated and have no api status after at least one release cycle." ; sh:group tosh:DefinitionPropertyGroup ; sh:in ( dash:Experimental dash:Stable dash:Deprecated ) ; sh:maxCount 1 ; sh:name "API status" ; sh:order "15"^^xsd:decimal ; . tosh:Function-cachable a sh:PropertyShape ; sh:path dash:cachable ; sh:datatype xsd:boolean ; sh:description "True to indicate that this function will always return the same values for the same combination of arguments, regardless of the query graphs. Engines can use this information to cache and reuse previous function calls." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "cachable" ; sh:order "10"^^xsd:decimal ; . tosh:Function-returnType a sh:PropertyShape ; sh:path sh:returnType ; sh:class rdfs:Class ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "return type" ; sh:order "5"^^xsd:decimal ; . tosh:FunctionTestCase-expectedResult a sh:PropertyShape ; sh:path dash:expectedResult ; sh:description "The expected result of a function call." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:name "expected result" ; sh:order "10"^^xsd:decimal ; . tosh:FunctionTestCase-expression a sh:PropertyShape ; sh:path dash:expression ; sh:description "A valid SPARQL expression calling the function to test." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:minCount 1 ; sh:name "expression" ; sh:order "0"^^xsd:decimal ; sh:ClassConstraintComponent dash:propertySuggestionGenerator tosh:DeleteTripleSuggestionGenerator ; dash:propertySuggestionGenerator tosh:ReplaceWithDefaultValueSuggestionGenerator ; . sh:ClassConstraintComponent-class sh:group tosh:ValueTypeConstraintPropertyGroup ; a sh:PropertyGroup ; rdfs:label "Implementation" ; sh:order "10"^^xsd:decimal ; . tosh:IncludedScript-exports a sh:PropertyShape ; sh:path dash:exports ; sh:datatype xsd:string ; sh:description "Declares the symbols that shall be exported from the surrounding module, e.g. for use in Node.js applications." ; sh:group tosh:ImplementationPropertyGroup ; sh:name "exports" ; sh:order "30"^^xsd:decimal ; . tosh:InferenceRulesShape a sh:NodeShape ; rdfs:comment "A node shape for classes and node shapes, declaring the sh:rule property." ; rdfs:label "Inference rules" ; sh:property tosh:InferenceRulesShape-rule ; sh:targetClass sh:NodeShape ; . tosh:InferenceRulesShape-rule a sh:PropertyShape ; sh:path sh:rule ; sh:class sh:Rule ; sh:description "The inference rules associated with this node shape or class." ; sh:group tosh:InferencesPropertyGroup ; sh:name "rule" ; . tosh:InferencesPropertyGroup a sh:PropertyGroup ; rdfs:label "Inferences" ; sh:order "80"^^xsd:decimal ; . tosh:InferencingTestCase-expectedResult a sh:PropertyShape ; sh:path dash:expectedResult ; sh:description "The expected inferred triples, represented by instances of rdfs:Statement." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:name "expected result" ; sh:order "10"^^xsd:decimal ; . tosh:InstancesInGraphSelectEditor a dash:SingleEditor ; rdfs:comment "A drop-down editor for all instances of a class (based on tosh:shapeInGraph/sh:class of the property) in a graph specified using tosh:graph." ; rdfs:label "Instances in graph select editor" ; . tosh:JSTestCase-expectedResult a sh:PropertyShape ; sh:path dash:expectedResult ; sh:description "The expected result of the JavaScript function call, as an RDF node." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:name "expected result" ; . tosh:MemberShapeConstraintComponent a sh:ConstraintComponent ; rdfs:comment "Can be used to specify constraints on the members of a given list, assuming that the given sh:property has rdf:Lists as values. A violation is reported for each member of the list that does not comply with the constraints specified by the given shape." ; rdfs:label "Member shape constraint component" ; sh:parameter tosh:MemberShapeConstraintComponent-memberShape ; sh:propertyValidator [ a sh:SPARQLSelectValidator ; sh:message "List member does not have the shape {$memberShape}" ; sh:prefixes <http://topbraid.org/tosh> ; sh:select """ SELECT DISTINCT $this ?value ?failure ?member WHERE { $this $PATH ?value . ?value rdf:rest*/rdf:first ?member . BIND (tosh:hasShape(?member, $memberShape) AS ?hasShape) . BIND (!bound(?hasShape) AS ?failure) . FILTER (?failure || !?hasShape) . } """ ; ] ; sh:targetClass sh:PropertyShape ; . tosh:MemberShapeConstraintComponent-memberShape a sh:Parameter ; sh:path tosh:memberShape ; sh:class sh:Shape ; sh:description "The shape that the list members must have." ; sh:name "member shape" ; . tosh:ModifyAction-skipPreview a sh:PropertyShape ; sh:path dash:skipPreview ; sh:datatype xsd:boolean ; sh:description "For actions that take no parameters, this can be set to true to skip any means for the user to preview the action. It will instead directly execute the modification." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "skip preview" ; sh:order "11"^^xsd:decimal ; . tosh:MultiFunction-resultVariable a sh:PropertyShape ; sh:path dash:resultVariable ; sh:class sh:Parameter ; sh:description "The result variables." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "result variables" ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order "30"^^xsd:decimal ; . tosh:NodeShape-ShapeScript a dash:ShapeScript ; dash:js """ /** * Returns this class as an instance of rdfs_Class, assuming this node shape is also a class. * @returns {rdfs_Class} */ asClass() { return rdfs.asClass(this); } /** * Gets the \"nearest\" constraint of a given type and a given path property. Deactivated shapes are skipped. * For example, call it with (ex.myProperty, sh.datatype) to find the closest sh:datatype constraint for ex:myProperty. * @param {NamedNode} path the property that is the sh:path of matching property shapes * @param {NamedNode} predicate the property to fetch the nearest value of */ nearestPropertyShapeValue(path, predicate) { return this.walkSupershapes(s => { if(!s.deactivated) { let ps = s.properties; for(let i = 0; i < ps.length; i++) { if(!ps[i].deactivated && graph.contains(ps[i], sh.path, path)) { let value = ps[i].value(predicate); if(value !== null && value !== undefined) { return value; } } } } }) } /** * @callback sh_NodeShape_callback * @param {sh_NodeShape} nodeShape the visited node shape */ /** * Performs a depth-first traversal of this and its superclasses (via rdfs:subClassOf) and supershapes (via sh:node), * visiting each (super) shape once until the callback function returns a non-null/undefined result. This becomes the result of this function. * The order in which sibling parents are traversed is undefined. * @param {sh_NodeShape_callback} callback the callback for each shape * @param {Set} [reached] the Set of reached URI strings, used internally but may also be used to terminate at certain supers * @returns the return value of the first callback that returned any value */ walkSupershapes(callback, reached) { if(!reached) { reached = new Set(); } if(!reached.has(this.uri)) { reached.add(this.uri); let result = callback(this); if(result !== undefined && result !== null) { return result; } let superClasses = this.asClass().superclasses; for(let i = 0; i < superClasses.length; i++) { result = superClasses[i].asNodeShape().walkSupershapes(callback, reached); if(result !== undefined && result !== null) { return result; } } let superShapes = this.supershapes; for(let i = 0; i < superShapes.length; i++) { result = superShapes[i].walkSupershapes(callback, reached); if(result !== undefined && result !== null) { return result; } } } } """ ; . tosh:NodeShape-applicableToClass a sh:PropertyShape ; sh:path dash:applicableToClass ; sh:class rdfs:Class ; sh:description "Links a node shape with the classes that it can be applied to." ; sh:group tosh:TargetsPropertyGroup ; sh:name "applicable to classes" ; sh:nodeKind sh:IRI ; sh:order "10"^^xsd:decimal ; . tosh:NodeShape-defaultViewForRole a sh:PropertyShape ; sh:path dash:defaultViewForRole ; dash:editor tosh:GovernanceRoleSelectEditor ; dash:viewer tosh:GovernanceRoleViewer ; sh:description "The user roles that this shape shall be used as default view for." ; sh:group tosh:TargetsPropertyGroup ; sh:name "default view for roles" ; sh:nodeKind sh:IRI ; sh:order "20"^^xsd:decimal ; . tosh:NodeShape-inheritedProperty a sh:PropertyShape ; sh:path tosh:inheritedProperty ; dash:neverMaterialize true ; dash:viewer tosh:PropertyTableViewer ; sh:description "Returns all property shapes that have been declared at \"super-shapes\" (via sh:node) or \"superclasses\" (via rdfs:subClassOf), including the indirect supers, recursively." ; sh:group tosh:PropertiesPropertyGroup ; sh:name "inherited properties" ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order "1"^^xsd:decimal ; sh:values [ sh:path sh:property ; sh:nodes [ sh:minus sh:this ; sh:nodes [ sh:distinct [ sh:path [ sh:oneOrMorePath [ sh:alternativePath ( rdfs:subClassOf sh:node ) ; ] ; ] ; ] ; ] ; ] ; ] ; . tosh:NodeShape-node a sh:PropertyShape ; sh:path sh:node ; graphql:name "supershapes" ; sh:description "The node shapes that this must also conform to, forming a kind of inheritance between shapes similar to a subclass-of relationship." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "node (super shapes)" ; sh:node sh:NodeShape ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order "20"^^xsd:decimal ; . tosh:NodeShape-targetClass a sh:PropertyShape ; sh:path sh:targetClass ; graphql:name "targetClasses" ; sh:class rdfs:Class ; sh:description "The types of instances that this shape is targeted at." ; sh:group tosh:TargetsPropertyGroup ; sh:name "target classes" ; sh:nodeKind sh:IRI ; sh:order "0"^^xsd:decimal ; . tosh:NodeShape-targetObjectsOf a sh:PropertyShape ; sh:path sh:targetObjectsOf ; sh:group tosh:TargetsPropertyGroup ; sh:name "target objects of" ; sh:node rdf:Property ; sh:nodeKind sh:IRI ; sh:order "1"^^xsd:decimal ; . tosh:NodeShape-targetSubjectsOf a sh:PropertyShape ; sh:path sh:targetSubjectsOf ; sh:group tosh:TargetsPropertyGroup ; sh:name "target subjects of" ; sh:node rdf:Property ; sh:nodeKind sh:IRI ; sh:order "2"^^xsd:decimal ; . tosh:NodeShapeConstraintsShape a sh:NodeShape ; rdfs:comment "A shape that can be used to validate the syntax of node shapes, and to enter constraints for node shapes on forms." ; rdfs:label "Node shape constraints" ; sh:property dash:ClosedByTypesConstraintComponent-closedByTypes ; sh:property dash:ScriptConstraintComponent-scriptConstraint ; sh:property dash:SingleLineConstraintComponent-singleLine ; sh:property dash:StemConstraintComponent-stem ; sh:property tosh:Shape-datatypes ; sh:property sh:ClassConstraintComponent-class ; sh:property sh:ClosedConstraintComponent-closed ; sh:property sh:ClosedConstraintComponent-ignoredProperties ; sh:property sh:DatatypeConstraintComponent-datatype ; sh:property sh:HasValueConstraintComponent-hasValue ; sh:property sh:InConstraintComponent-in ; sh:property sh:LanguageInConstraintComponent-languageIn ; sh:property sh:MaxExclusiveConstraintComponent-maxExclusive ; sh:property sh:MaxInclusiveConstraintComponent-maxInclusive ; sh:property sh:MaxLengthConstraintComponent-maxLength ; sh:property sh:MinExclusiveConstraintComponent-minExclusive ; sh:property sh:MinInclusiveConstraintComponent-minInclusive ; sh:property sh:MinLengthConstraintComponent-minLength ; sh:property sh:NodeKindConstraintComponent-nodeKind ; sh:property sh:PatternConstraintComponent-flags ; sh:property sh:PatternConstraintComponent-pattern ; sh:property sh:SPARQLConstraintComponent-sparql ; sh:targetClass sh:NodeShape ; . tosh:NumberOfValuesPropertyGroup a sh:PropertyGroup ; rdfs:label "Number of Values" ; sh:order "40"^^xsd:decimal ; . tosh:OWLAxiomsPropertyGroup a sh:PropertyGroup ; rdfs:label "OWL Axioms" ; sh:order "17"^^xsd:decimal ; . tosh:ObjectPropertyShapeView a sh:NodeShape ; rdfs:comment "The default view shape for property shapes on object values." ; rdfs:label "Relationship view" ; sh:node tosh:PropertyShapeView ; sh:property dash:NonRecursiveConstraintComponent-nonRecursive ; sh:property dash:RootClassConstraintComponent-rootClass ; sh:property dash:StemConstraintComponent-stem ; sh:property dash:SymmetricConstraintComponent-symmetric ; sh:property tosh:ObjectPropertyShapeView-node ; sh:property sh:ClassConstraintComponent-class ; sh:property sh:NodeKindConstraintComponent-nodeKind ; . tosh:ObjectPropertyShapeView-node a sh:PropertyShape ; sh:path sh:node ; dash:reifiableBy dash:ConstraintReificationShape ; sh:class sh:NodeShape ; sh:description "The node shape(s) that all values of the property must conform to." ; sh:group tosh:ValueConstraintsPropertyGroup ; sh:name "node" ; sh:order "0"^^xsd:decimal ; . tosh:Ontology-imports a sh:PropertyShape ; sh:path owl:imports ; sh:description "The (directly) imported graphs." ; sh:name "imports" ; sh:nodeKind sh:IRI ; . tosh:Parameterizable-labelTemplate a sh:PropertyShape ; sh:path sh:labelTemplate ; sh:description "Outlines how human-readable labels of instances of the associated Parameterizable shall be produced. The values can contain {?paramName} as placeholders for the actual values of the given parameter." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "label template" ; sh:or dash:StringOrLangString ; sh:order "25"^^xsd:decimal ; . tosh:Parameterizable-parameter a sh:PropertyShape ; sh:path sh:parameter ; sh:class sh:Parameter ; sh:description "The input parameters." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "parameters" ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order "20"^^xsd:decimal ; . tosh:PathStringViewer a dash:MultiViewer ; dash:hidden true ; rdfs:label "Path string viewer" ; . tosh:PropertiesPropertyGroup a sh:PropertyGroup ; rdfs:comment "The declared and inferred properties of a shape or class." ; rdfs:label "Properties" ; sh:order "10"^^xsd:decimal ; . tosh:Property-domain a sh:PropertyShape ; sh:path rdfs:domain ; graphql:name "domains" ; sh:description "The domain(s) of this property." ; sh:group tosh:PropertyAxiomsPropertyGroup ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order "0"^^xsd:decimal ; . tosh:Property-range a sh:PropertyShape ; sh:path rdfs:range ; graphql:name "ranges" ; sh:description "The range(s) of this property." ; sh:group tosh:PropertyAxiomsPropertyGroup ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order "1"^^xsd:decimal ; . tosh:Property-subPropertyOf a sh:PropertyShape ; sh:path rdfs:subPropertyOf ; graphql:name "superproperties" ; sh:class rdf:Property ; sh:description "The (direct) superproperties of this." ; sh:group tosh:PropertyAxiomsPropertyGroup ; sh:name "superproperties" ; sh:nodeKind sh:IRI ; sh:order "2"^^xsd:decimal ; . tosh:Property-subPropertyOf-inverse a sh:PropertyShape ; sh:path [ sh:inversePath rdfs:subPropertyOf ; ] ; graphql:name "subproperties" ; sh:class rdf:Property ; sh:description "The (direct) subproperties of this." ; sh:group tosh:PropertyAxiomsPropertyGroup ; sh:name "subproperties" ; sh:nodeKind sh:IRI ; sh:order "3"^^xsd:decimal ; . tosh:PropertyAxiomsPropertyGroup a sh:PropertyGroup ; rdfs:label "Property Axioms" ; sh:order "1"^^xsd:decimal ; . tosh:PropertyGroup-order a sh:PropertyShape ; sh:path sh:order ; sh:description "The relative order of this group compared to others." ; sh:group tosh:DisplayPropertyGroup ; sh:maxCount 1 ; sh:name "order" ; sh:or ( [ sh:datatype xsd:decimal ; ] [ sh:datatype xsd:integer ; ] ) ; sh:order "0"^^xsd:decimal ; . tosh:PropertyPairConstraintsPropertyGroup a sh:PropertyGroup ; rdfs:label "Property Pair Constraints" ; sh:order "75"^^xsd:decimal ; . tosh:PropertyShape-defaultValue a sh:PropertyShape ; sh:path sh:defaultValue ; dash:readOnly true ; dash:viewer dash:NodeExpressionViewer ; tosh:useDeclaredDatatype true ; sh:description "The default value to be used for this property if no other value has been asserted. This may be a constant value or a SHACL node expression, in which case the values can be derived from other values. Default values are typically inferred and not stored as RDF statements." ; sh:group tosh:InferencesPropertyGroup ; sh:name "default value" ; sh:order "0"^^xsd:decimal ; . tosh:PropertyShape-description a sh:PropertyShape ; sh:path sh:description ; dash:singleLine false ; graphql:name "descriptions" ; sh:description "The description(s) of the property, possibly in multiple languages." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "descriptions" ; sh:nodeKind sh:Literal ; sh:or dash:StringOrLangStringOrHTML ; sh:order "1"^^xsd:decimal ; sh:sparql [ sh:message "Property shapes cannot have both class and datatype constraints." ; sh:prefixes <http://topbraid.org/tosh> ; sh:select """SELECT $this WHERE { FILTER EXISTS { $this sh:class ?class . $this sh:datatype ?datatype . } }""" ; ] ; . tosh:PropertyShape-detailsEndpoint a sh:PropertyShape ; sh:path dash:detailsEndpoint ; sh:datatype xsd:string ; sh:maxCount 1 ; sh:name "details endpoint" ; . tosh:PropertyShape-editor a sh:PropertyShape ; sh:path dash:editor ; dash:editor dash:InstancesSelectEditor ; sh:class dash:Editor ; sh:description "The editor component that should be used to edit values of this property." ; sh:group tosh:DisplayPropertyGroup ; sh:maxCount 1 ; sh:nodeKind sh:IRI ; sh:order "11"^^xsd:decimal ; . tosh:PropertyShape-group a sh:PropertyShape ; sh:path sh:group ; sh:class sh:PropertyGroup ; sh:description "The group that this property belongs to." ; sh:group tosh:DisplayPropertyGroup ; sh:maxCount 1 ; sh:name "group" ; sh:order "0"^^xsd:decimal ; . tosh:PropertyShape-hidden a sh:PropertyShape ; sh:path dash:hidden ; dash:editor dash:BooleanSelectEditor ; sh:datatype xsd:boolean ; sh:description "True to mark this property as hidden in user interface, yet still used in data tasks." ; sh:group tosh:DisplayPropertyGroup ; sh:maxCount 1 ; sh:order "30"^^xsd:decimal ; . tosh:PropertyShape-indexed a sh:PropertyShape ; sh:path dash:indexed ; sh:datatype xsd:boolean ; sh:description "True to indicate that the values of this shall be indexed, forming ordered arrays." ; sh:maxCount 1 ; sh:name "indexed" ; . tosh:PropertyShape-name a sh:PropertyShape ; sh:path sh:name ; dash:singleLine true ; graphql:name "names" ; sh:description "The display names of the property, possibly in multiple languages." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "names" ; sh:nodeKind sh:Literal ; sh:or dash:StringOrLangString ; sh:order "0"^^xsd:decimal ; . tosh:PropertyShape-neverMaterialize a sh:PropertyShape ; sh:path dash:neverMaterialize ; sh:datatype xsd:boolean ; sh:group tosh:InferencesPropertyGroup ; sh:maxCount 1 ; sh:name "never materialize" ; sh:order "11"^^xsd:decimal ; . tosh:PropertyShape-order a sh:PropertyShape ; sh:path sh:order ; sh:description "The relative order of this property shape compared to others." ; sh:group tosh:DisplayPropertyGroup ; sh:maxCount 1 ; sh:name "order" ; sh:or ( [ sh:datatype xsd:decimal ; ] [ sh:datatype xsd:integer ; ] ) ; sh:order "1"^^xsd:decimal ; . tosh:PropertyShape-path a sh:PropertyShape ; sh:path sh:path ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:minCount 1 ; sh:name "path" ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order "31"^^xsd:decimal ; . tosh:PropertyShape-propertyRole a sh:PropertyShape ; sh:path dash:propertyRole ; sh:class dash:PropertyRole ; sh:group tosh:DisplayPropertyGroup ; sh:maxCount 1 ; sh:name "role" ; sh:order "40"^^xsd:decimal ; . tosh:PropertyShape-readOnly a sh:PropertyShape ; sh:path dash:readOnly ; dash:editor dash:BooleanSelectEditor ; dash:viewer dash:NodeExpressionViewer ; sh:datatype xsd:boolean ; sh:description """If set to true then the values of this property should not be editable in the user interface. Note that low-level access such as source code editors may still allow editing, but form-based editors would not. More generally, the values of this property are SHACL node expressions, e.g. function calls, in which case the property counts as read-only if the expression evaluates to true.""" ; sh:group tosh:DisplayPropertyGroup ; sh:maxCount 1 ; sh:order "20"^^xsd:decimal ; . tosh:PropertyShape-values a sh:PropertyShape ; sh:path sh:values ; dash:viewer dash:NodeExpressionViewer ; sh:group tosh:InferencesPropertyGroup ; sh:name "values" ; sh:order "10"^^xsd:decimal ; sh:sparql [ sh:message "sh:values must be accompanied by a sh:path that is an IRI." ; sh:prefixes <http://topbraid.org/tosh> ; sh:select """SELECT $this ?value WHERE { $this $PATH ?value . FILTER NOT EXISTS { $this sh:path ?path . FILTER isIRI(?path) } }""" ; ] ; . tosh:PropertyShape-viewer a sh:PropertyShape ; sh:path dash:viewer ; dash:editor dash:InstancesSelectEditor ; sh:class dash:Viewer ; sh:description "The viewer component that should be used to render values of this property." ; sh:group tosh:DisplayPropertyGroup ; sh:maxCount 1 ; sh:nodeKind sh:IRI ; sh:order "10"^^xsd:decimal ; . tosh:PropertyShapeView a sh:NodeShape ; rdfs:comment "Base view shape for either datatype or object property shapes." ; rdfs:label "Property shape view" ; sh:property dash:CoExistsWithConstraintComponent-coExistsWith ; sh:property dash:IndexedConstraintComponent-indexed ; sh:property dash:ReifiableByConstraintComponent-reifiableBy ; sh:property dash:ScriptConstraintComponent-scriptConstraint ; sh:property dash:SubSetOfConstraintComponent-subSetOf ; sh:property tosh:PropertyShape-defaultValue ; sh:property tosh:PropertyShape-description ; sh:property tosh:PropertyShape-editor ; sh:property tosh:PropertyShape-group ; sh:property tosh:PropertyShape-hidden ; sh:property tosh:PropertyShape-name ; sh:property tosh:PropertyShape-neverMaterialize ; sh:property tosh:PropertyShape-order ; sh:property tosh:PropertyShape-propertyRole ; sh:property tosh:PropertyShape-readOnly ; sh:property tosh:PropertyShape-values ; sh:property tosh:PropertyShape-viewer ; sh:property tosh:PropertyShapeView-message ; sh:property tosh:PropertyShapeView-pathSystemLabel ; sh:property tosh:PropertyShapeView-qualifiedMaxCount ; sh:property tosh:PropertyShapeView-qualifiedMinCount ; sh:property tosh:PropertyShapeView-qualifiedValueShape ; sh:property tosh:PropertyShapeView-qualifiedValueShapesDisjoint ; sh:property tosh:Shape-deactivated ; sh:property tosh:Shape-severity ; sh:property sh:DisjointConstraintComponent-disjoint ; sh:property sh:EqualsConstraintComponent-equals ; sh:property sh:MaxCountConstraintComponent-maxCount ; sh:property sh:MinCountConstraintComponent-minCount ; sh:property sh:SPARQLConstraintComponent-sparql ; . tosh:PropertyShapeView-indexed a sh:PropertyShape ; sh:path dash:indexed ; sh:datatype xsd:boolean ; sh:description "Indicates whether the values are sorted by an index. The user interface will display them in-order." ; sh:group tosh:ReificationPropertyGroup ; sh:maxCount 1 ; sh:name "indexed" ; sh:order "1"^^xsd:decimal ; . tosh:PropertyShapeView-message a sh:PropertyShape ; sh:path sh:message ; sh:description "The message that shall be generated for all constraint violations produced by this property shape." ; sh:group tosh:ValidationPropertyGroup ; sh:name "messages" ; sh:or dash:StringOrLangString ; sh:order "5"^^xsd:decimal ; . tosh:PropertyShapeView-pathSystemLabel a sh:PropertyShape ; sh:path tosh:pathSystemLabel ; dash:neverMaterialize true ; dash:viewer tosh:PathStringViewer ; sh:datatype xsd:string ; sh:description "A display label of the sh:path based on qnames." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "property path" ; sh:order "2"^^xsd:decimal ; sh:values [ sh:else [ <http://uispin.org/ui#label> ( [ sh:path sh:path ; ] ) ; ] ; sh:if [ <http://datashapes.org/sparql#isIRI> ( [ sh:path sh:path ; ] ) ; ] ; sh:then [ <http://topbraid.org/sparqlmotionfunctions#qname> ( [ sh:path sh:path ; ] ) ; ] ; ] ; . tosh:PropertyShapeView-qualifiedMaxCount a sh:PropertyShape ; sh:path sh:qualifiedMaxCount ; sh:datatype xsd:integer ; sh:description "The maximum number of values that may conform to the qualified value shape." ; sh:group tosh:QualifiedCardinalityConstraintsPropertyGroup ; sh:maxCount 1 ; sh:name "qualified max count" ; sh:order "1"^^xsd:decimal ; . tosh:PropertyShapeView-qualifiedMinCount a sh:PropertyShape ; sh:path sh:qualifiedMinCount ; sh:datatype xsd:integer ; sh:description "The minimum number of values that must conform to the qualified value shape." ; sh:group tosh:QualifiedCardinalityConstraintsPropertyGroup ; sh:maxCount 1 ; sh:name "qualified min count" ; sh:order "0"^^xsd:decimal ; . tosh:PropertyShapeView-qualifiedValueShape a sh:PropertyShape ; sh:path sh:qualifiedValueShape ; sh:class sh:NodeShape ; sh:description "The shape that the specified number of values must conform to." ; sh:group tosh:QualifiedCardinalityConstraintsPropertyGroup ; sh:name "qualified value shape" ; sh:order "2"^^xsd:decimal ; . tosh:PropertyShapeView-qualifiedValueShapesDisjoint a sh:PropertyShape ; sh:path sh:qualifiedValueShapesDisjoint ; sh:datatype xsd:boolean ; sh:description "True to treat all qualified values as disjoint." ; sh:group tosh:QualifiedCardinalityConstraintsPropertyGroup ; sh:maxCount 1 ; sh:name "qualified value shapes disjoint" ; sh:order "3"^^xsd:decimal ; . tosh:PropertyTableViewer a dash:MultiViewer ; dash:hidden true ; rdfs:label "Property table viewer" ; . tosh:QualifiedCardinalityConstraintsPropertyGroup a sh:PropertyGroup ; rdfs:comment "The properties in this group are used together to express that a certain number of values must conform to a given shape." ; rdfs:label "Qualified Cardinality Constraints" ; sh:order "77"^^xsd:decimal ; . tosh:QueryTestCase-expectedResult a sh:PropertyShape ; sh:path dash:expectedResult ; dash:singleLine false ; sh:description "The expected result set, as a JSON string." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:name "expected result" ; sh:or ( [ sh:datatype rdf:JSON ; ] [ sh:datatype xsd:string ; ] ) ; . tosh:RDFSOWLClassView a sh:NodeShape ; dash:applicableToClass rdfs:Class ; rdfs:comment "A node shape collecting RDFS and OWL axioms for classes." ; rdfs:label "RDFS/OWL class view" ; sh:property tosh:Class-disjointWith ; sh:property tosh:Class-domain-inverse ; sh:property tosh:Class-equivalentClass ; sh:property tosh:Class-range-inverse ; sh:property tosh:Class-subClassOf ; sh:property tosh:Class-subClassOf-inverse ; sh:property tosh:Resource-comment ; sh:property tosh:Resource-label ; sh:property tosh:Resource-type ; . tosh:RDFSPropertyAxiomsPropertyGroup a sh:PropertyGroup ; rdfs:label "RDFS Property Axioms" ; sh:order "15"^^xsd:decimal ; . tosh:ReferencesPropertyGroup a sh:PropertyGroup ; rdfs:comment "A property group typically used for incoming references or usages."^^rdf:HTML ; rdfs:label "References" ; sh:order "100"^^xsd:decimal ; . tosh:ReificationPropertyGroup a sh:PropertyGroup ; rdfs:label "Reification (Statements about Statements)" ; sh:order "90"^^xsd:decimal ; . tosh:ReplaceWithDefaultValueSuggestionGenerator a dash:SPARQLUpdateSuggestionGenerator ; rdfs:comment "Produces a suggestion to replace all values of the given predicate (which must exist) at the focus node to the default value declared at the shape that has caused the violation. Does nothing if the shape does not declare a sh:defaultValue. Deletes any old value of the property." ; rdfs:label "Replace with default value suggestion generator" ; sh:message "Replace with default value" ; sh:prefixes <http://topbraid.org/tosh> ; sh:select """SELECT ?defaultValue WHERE { GRAPH $shapesGraph { $sourceShape sh:defaultValue ?defaultValue . } }""" ; sh:update """DELETE { $focusNode $predicate ?oldValue . } INSERT { $focusNode $predicate ?defaultValue . } WHERE { $focusNode $predicate ?oldValue . }""" ; . tosh:Resource-comment a sh:PropertyShape ; sh:path rdfs:comment ; dash:propertyRole dash:DescriptionRole ; dash:singleLine false ; graphql:name "comments" ; sh:description "The comments of this, possibly in multiple languages." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "comments" ; sh:or dash:StringOrLangStringOrHTML ; sh:order "1"^^xsd:decimal ; . tosh:Resource-label a sh:PropertyShape ; sh:path rdfs:label ; dash:propertyRole dash:LabelRole ; graphql:name "labels" ; sh:description "The display name(s) of this, possibly in multiple languages." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "labels" ; sh:or dash:StringOrLangString ; sh:order "0"^^xsd:decimal ; . tosh:Resource-type a sh:PropertyShape ; sh:path rdf:type ; graphql:name "types" ; sh:class rdfs:Class ; sh:description "The type(s) of this." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "types" ; sh:order "10"^^xsd:decimal ; . tosh:ResourceAction-jsCondition a sh:PropertyShape ; sh:path dash:jsCondition ; sh:datatype xsd:string ; sh:description "An (ADS) JavaScript expression that will be executed to determine whether the action is applicable to the selected resource in the current context. The variable focusNode can be queried here. The expression needs to return true for the action to be deemed suitable." ; sh:group tosh:ImplementationPropertyGroup ; sh:name "action pre-condition" ; sh:order "25"^^xsd:decimal ; . tosh:ResourceView a sh:NodeShape ; rdfs:comment "A generic view shape that can be used as fallback to display typical resources that have an rdfs:label and an rdfs:comment." ; rdfs:label "Resource view" ; sh:property tosh:Resource-comment ; sh:property tosh:Resource-label ; . tosh:Rule-condition a sh:PropertyShape ; sh:path sh:condition ; sh:description "The pre-conditions that must apply before a rule gets executed. The focus node must conform to all conditions, which must be shapes." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "conditions" ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order "40"^^xsd:decimal ; . tosh:Rule-deactivated a sh:PropertyShape ; sh:path sh:deactivated ; sh:datatype xsd:boolean ; sh:description "True to deactivate the rule so that it will not get executed." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "deactivated" ; sh:order "30"^^xsd:decimal ; . tosh:Rule-order a sh:PropertyShape ; sh:path sh:order ; sh:description "The order of this rule relative to other rules at the same shape. Rules with lower order are executed first. Default value is 0. Rules with the same order cannot \"see\" each other's inferences." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "order" ; sh:or ( [ sh:datatype xsd:decimal ; ] [ sh:datatype xsd:integer ; ] ) ; sh:order "35"^^xsd:decimal ; . tosh:Rule-rule-inverse a sh:PropertyShape ; sh:path [ sh:inversePath sh:rule ; ] ; sh:class sh:Shape ; sh:description "The shapes or classes that the rule is attached to." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "rule of" ; sh:order "20"^^xsd:decimal ; . tosh:SHMinMaxEditor a dash:SingleEditor ; dash:hidden true ; rdfs:comment "An internally used editor for min/max range values of property shapes."^^rdf:HTML ; rdfs:label "SHACL Min Max Editor" ; . tosh:SPARQLAskExecutable-ask a sh:PropertyShape ; sh:path sh:ask ; dash:singleLine false ; sh:datatype xsd:string ; sh:description "The SPARQL ASK query string." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "ask" ; sh:order "1"^^xsd:decimal ; . tosh:SPARQLConstraint-deactivated a sh:PropertyShape ; sh:path sh:deactivated ; sh:datatype xsd:boolean ; sh:description "True to deactive this constraint." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "deactivated" ; sh:order "30"^^xsd:decimal ; . tosh:SPARQLConstraint-message a sh:PropertyShape ; sh:path sh:message ; sh:description "The message(s) that should be produced for constraint violations. The messages may contain placeholders such as {$value} for any variable returned in the SELECT clause of the SPARQL query." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "messages" ; sh:or dash:StringOrLangString ; sh:order "20"^^xsd:decimal ; . tosh:SPARQLConstructExecutable-construct a sh:PropertyShape ; sh:path sh:construct ; dash:singleLine false ; sh:datatype xsd:string ; sh:description "The SPARQL CONSTRUCT query string." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "construct" ; sh:order "1"^^xsd:decimal ; . tosh:SPARQLExecutable-prefixes a sh:PropertyShape ; sh:path sh:prefixes ; sh:class owl:Ontology ; sh:description "The Ontology declaring the SHACL prefix declarations to use for the SPARQL query." ; sh:group tosh:ImplementationPropertyGroup ; sh:name "prefixes" ; sh:order "0"^^xsd:decimal ; . tosh:SPARQLSelectExecutable-select a sh:PropertyShape ; sh:path sh:select ; dash:singleLine false ; sh:datatype xsd:string ; sh:description "The SPARQL SELECT query string." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "select" ; sh:order "1"^^xsd:decimal ; . tosh:SPARQLUpdateExecutable-update a sh:PropertyShape ; sh:path sh:update ; dash:singleLine false ; sh:datatype xsd:string ; sh:description "The SPARQL UPDATE request string." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "update" ; sh:order "1"^^xsd:decimal ; . tosh:Script-js a sh:PropertyShape ; sh:path dash:js ; sh:datatype xsd:string ; sh:description "The implementation as JavaScript." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "JavaScript code" ; sh:order "20"^^xsd:decimal ; . tosh:Script-onAllValues a sh:PropertyShape ; sh:path dash:onAllValues ; sh:datatype xsd:boolean ; sh:description "If true then all value nodes will be available to the script at once, through the variable \"values\"." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "on all values" ; sh:order "0"^^xsd:decimal ; . tosh:ScriptConstraint-deactivated a sh:PropertyShape ; sh:path sh:deactivated ; sh:datatype xsd:boolean ; sh:description "True to deactivate this constraint." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "deactivated" ; sh:order "30"^^xsd:decimal ; . tosh:ScriptConstraint-message a sh:PropertyShape ; sh:path sh:message ; sh:description "The message(s) to use for violations produced by this script." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "messages" ; sh:or dash:StringOrLangString ; sh:order "20"^^xsd:decimal ; . tosh:ScriptFunction-canWrite a sh:PropertyShape ; sh:path dash:canWrite ; sh:datatype xsd:boolean ; sh:description "True to allow this function to have side effects. By default, functions are not permitted to modify the graph as this would violate SPARQL contracts. However, if canWrite is true then the function will not be available as a SPARQL function and only be injected into the generated API in read/write mode." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "can write" ; sh:order "15"^^xsd:decimal ; . tosh:ScriptTestCase-expectedResult a sh:PropertyShape ; sh:path dash:expectedResult ; sh:description "The expected result of the evaluation, as JSON object as produced by the servlet, or true or false." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:name "expected result" ; sh:or ( [ sh:datatype rdf:JSON ; ] [ sh:datatype xsd:boolean ; ] ) ; sh:order "0"^^xsd:decimal ; . tosh:ScriptTestCase-focusNode a sh:PropertyShape ; sh:path dash:focusNode ; sh:description "The selected resource, which will become value of focusNode for the script, with its \"most suitable\" JavaScript class as type. Defaults to the test case itself." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:name "focus node" ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order "10"^^xsd:decimal ; . tosh:ScriptsPropertyGroup a sh:PropertyGroup ; rdfs:comment "Scripts based on Active Data Shapes." ; rdfs:label "Scripts" ; sh:order "30"^^xsd:decimal ; . tosh:Service-canWrite a sh:PropertyShape ; sh:path dash:canWrite ; sh:datatype xsd:boolean ; sh:description "True if this service can modify the data, i.e. it will execute in read/write mode. By default, all services are read-only." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "can write" ; . tosh:Service-deactivated a sh:PropertyShape ; sh:path sh:deactivated ; sh:datatype xsd:boolean ; sh:description "True to deactivate this service." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "deactivated" ; sh:order "30"^^xsd:decimal ; . tosh:Service-responseContentType a sh:PropertyShape ; sh:path dash:responseContentType ; sh:datatype xsd:string ; sh:description "The content type (mime type) of the service response, defaulting to \"application/json\". Use \"void\" to return nothing." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "response content type" ; sh:order "10"^^xsd:decimal ; . tosh:SetToDefaultValueSuggestionGenerator a dash:SPARQLUpdateSuggestionGenerator ; rdfs:comment "Produces a suggestion to set the given predicate at the focus node to the default value declared at the shape that has caused the violation. Does nothing if the shape does not declare a sh:defaultValue. Deletes any old value of the property." ; rdfs:label "Set to default value suggestion generator" ; sh:message "Set to default value" ; sh:prefixes <http://topbraid.org/tosh> ; sh:select """SELECT ?defaultValue WHERE { GRAPH $shapesGraph { $sourceShape sh:defaultValue ?defaultValue . } }""" ; sh:update """DELETE { $focusNode $predicate ?oldValue . } INSERT { $focusNode $predicate ?defaultValue . } WHERE { OPTIONAL { $focusNode $predicate ?oldValue . } }""" ; . tosh:Shape-datatypes a sh:PropertyShape ; sh:path tosh:datatypes ; dash:neverMaterialize true ; dash:viewer tosh:DatatypesViewer ; sh:description "Zero of more datatypes that value nodes can take. In SHACL, the typical pattern is to either use a single sh:datatype or a sh:or of multiple sh:datatype constraints. This inferred property here provides a unified way to access these two design patterns." ; sh:group tosh:TypeOfValuesPropertyGroup ; sh:name "datatypes" ; sh:nodeKind sh:IRI ; sh:order "0"^^xsd:decimal ; sh:values [ sh:union ( [ sh:path sh:datatype ; ] [ sh:path ( sh:or [ sh:zeroOrMorePath rdf:rest ; ] rdf:first sh:datatype ) ; ] ) ; ] ; . tosh:Shape-deactivated a sh:PropertyShape ; sh:path sh:deactivated ; sh:datatype xsd:boolean ; sh:description "True to deactivate this shape, making it literally invisible and without any effect." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "deactivated" ; sh:order "30"^^xsd:decimal ; . tosh:Shape-severity a sh:PropertyShape ; sh:path sh:severity ; dash:editor dash:InstancesSelectEditor ; sh:class sh:Severity ; sh:description "The severity to be used for validation results produced by the constraints." ; sh:group tosh:ValidationPropertyGroup ; sh:maxCount 1 ; sh:name "severity" ; sh:order "0"^^xsd:decimal ; . tosh:ShapeInGraphConstraintComponent a sh:ConstraintComponent ; dash:propertySuggestionGenerator tosh:DeleteTripleSuggestionGenerator ; rdfs:comment """A constraint component that can be used to verify that the value nodes have a given shape, where the shape validation is executed in a given graph. This can, for example, be used to verify that a given value is declared as an instance of a given class in some specified (not imported) graph. A typical design pattern is as follows: ex:NodeShape sh:property [ sh:path ex:myProperty ; sh:nodeKind sh:IRI ; tosh:graph <http://example.org/externalGraph> ; tosh:shapeInGraph [ sh:class ex:ExternalClass ; ] ; tosh:editor tosh:InstancesInGraphSelectEditor ; tosh:viewer tosh:URIInGraphViewer ; ] .""" ; rdfs:label "Shape in graph constraint component" ; sh:labelTemplate "Values must have shape {$shapeInGraph} defined in graph {$graph}" ; sh:message "Value does not have shape {$shapeInGraph} defined in graph {$graph}" ; sh:parameter [ a sh:Parameter ; sh:path tosh:graph ; sh:nodeKind sh:IRI ; ] ; sh:parameter [ a sh:Parameter ; sh:path tosh:shapeInGraph ; sh:nodeKind sh:BlankNodeOrIRI ; ] ; sh:validator [ a sh:SPARQLAskValidator ; sh:ask """ASK { GRAPH $graph { FILTER tosh:hasShape($value, $shapeInGraph) } }""" ; sh:prefixes <http://topbraid.org/tosh> ; ] ; . tosh:StringConstraintsPropertyGroup a sh:PropertyGroup ; rdfs:label "String Constraints" ; sh:order "70"^^xsd:decimal ; . tosh:SystemNamespaceShape a sh:NodeShape ; rdfs:comment "A shape that detects whether the focus node is a URI that has a namespace from one of the system namespaces - RDF, RDFS, OWL etc. The list of actual system namespaces is represented via tosh:systemNamespace true triples." ; rdfs:label "System namespace shape" ; sh:sparql [ a sh:SPARQLConstraint ; sh:message "Not a IRI from a system namespace" ; sh:prefixes <http://topbraid.org/tosh> ; sh:select """SELECT $this WHERE { FILTER (!isIRI($this) || (isIRI($this) && EXISTS { BIND (IRI(afn:namespace($this)) AS ?ns) . FILTER NOT EXISTS { ?ns tosh:systemNamespace true } . } )) . }""" ; ] ; . tosh:TargetsPropertyGroup a sh:PropertyGroup ; rdfs:label "Targets" ; sh:order "5"^^xsd:decimal ; . tosh:TeamworkPlatform a dash:ExecutionPlatform ; dash:includedExecutionPlatform tosh:TopBraidPlatform ; rdfs:comment "The platform consisting of TopBraid plus any teamwork features used by TopBraid EDG." ; rdfs:label "Teamwork platform" ; . tosh:TestCase-deactivated a sh:PropertyShape ; sh:path sh:deactivated ; sh:datatype xsd:boolean ; sh:description "If set to true, this test case will be skipped." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:name "deactivated" ; sh:order "50"^^xsd:decimal ; . tosh:TestPropertiesPropertyGroup a sh:PropertyGroup ; rdfs:label "Test Properties" ; sh:order "20"^^xsd:decimal ; . tosh:TopBraidPlatform a dash:ExecutionPlatform ; rdfs:comment "The platform consisting of TopBraid." ; rdfs:label "TopBraid platform" ; . tosh:TripleRule-object a sh:PropertyShape ; sh:path sh:object ; dash:viewer dash:NodeExpressionViewer ; sh:description "The node expression producing the object(s) of the triple inferred by the rule." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:minCount 1 ; sh:name "object" ; sh:order 2 ; . tosh:TripleRule-predicate a sh:PropertyShape ; sh:path sh:predicate ; dash:viewer dash:NodeExpressionViewer ; sh:description "The node expression producing the predicate(s) of the triple inferred by the rule." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:minCount 1 ; sh:name "predicate" ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order 1 ; . tosh:TripleRule-subject a sh:PropertyShape ; sh:path sh:subject ; dash:viewer dash:NodeExpressionViewer ; sh:description "The node expression producing the subject(s) of the triple inferred by the rule." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:minCount 1 ; sh:name "subject" ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order 0 ; . tosh:TypeOfValuesPropertyGroup a sh:PropertyGroup ; rdfs:label "Type of Values" ; sh:order "50"^^xsd:decimal ; . tosh:URIInGraphViewer a dash:SingleViewer ; rdfs:comment "A viewer for URI resources that have their data in a given graph that may be outside of the imports closure. The graph must be specified using a tosh:graph constraint for the property." ; rdfs:label "URI in graph viewer" ; . tosh:UseDeclaredDatatypeConstraintComponent a sh:ConstraintComponent ; dash:propertySuggestionGenerator [ a dash:SPARQLUpdateSuggestionGenerator ; sh:message "Change datatype of the invalid value to the specified sh:datatype" ; sh:prefixes <http://topbraid.org/tosh> ; sh:update """DELETE { $subject $predicate $object . } INSERT { $subject $predicate ?newObject . } WHERE { $subject sh:datatype ?datatype . BIND (spif:cast(?object, ?datatype) AS ?newObject) . }""" ; ] ; rdfs:comment "Constrains the value nodes to be either non-literals or literals that have the same datatype as the declared sh:datatype for the given constraint node. This is used, among others, in properties such as sh:hasValue and sh:minExclusive." ; rdfs:label "Use declared datatype constraint component" ; sh:parameter [ a sh:Parameter ; sh:path tosh:useDeclaredDatatype ; sh:datatype xsd:boolean ; sh:description "True to state that the datatype of literal values must be the same as the declared sh:datatype." ; sh:name "use declared datatype" ; ] ; sh:propertyValidator [ a sh:SPARQLSelectValidator ; sh:message "Datatype must match the declared datatype " ; sh:prefixes <http://topbraid.org/tosh> ; sh:select """ SELECT DISTINCT $this ?value ?datatype WHERE { { FILTER ($useDeclaredDatatype) } $this sh:datatype ?datatype . $this $PATH ?value . FILTER (isLiteral(?value) && datatype(?value) != ?datatype) . }""" ; ] ; sh:targetClass sh:PropertyShape ; . tosh:ValidationPropertyGroup a sh:PropertyGroup ; rdfs:label "Validation" ; sh:order "30"^^xsd:decimal ; . tosh:ValidationTestCase-expectedResult a sh:PropertyShape ; sh:path dash:expectedResult ; sh:description "The expected validation report, either as instance of sh:ValidationReport or a Turtle string with one instance of sh:ValidationReport in it when parsed." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:name "expected result" ; sh:or ( [ sh:datatype xsd:string ; ] [ sh:class sh:ValidationReport ; ] ) ; sh:order "10"^^xsd:decimal ; . tosh:ValidationTestCase-includeSuggestions a sh:PropertyShape ; sh:path dash:includeSuggestions ; sh:datatype xsd:boolean ; sh:description "True to also generate and verify suggestions." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:name "include suggestions" ; sh:order "0"^^xsd:decimal ; . tosh:ValidationTestCase-validateShapes a sh:PropertyShape ; sh:path dash:validateShapes ; sh:datatype xsd:boolean ; sh:description "True to also validate shapes themselves." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:name "validate shapes" ; sh:order "5"^^xsd:decimal ; . tosh:ValueConstraintsPropertyGroup a sh:PropertyGroup ; rdfs:label "Value Constraints" ; sh:order "60"^^xsd:decimal ; . tosh:ValueRangePropertyGroup a sh:PropertyGroup ; rdfs:label "Value Range" ; sh:order "60"^^xsd:decimal ; . tosh:countShapesWithMatchResult a sh:SPARQLFunction ; rdfs:comment "Counts the number of shapes from a given rdf:List (?arg2) defined in a given shapes graph (?arg3) where tosh:hasShape returns the provided match value (true or false, ?arg4) for a given focus node (?arg1). The function produces a failure if one of the shapes validated to a failure." ; rdfs:label "count shapes with match result" ; sh:parameter [ a sh:Parameter ; sh:path sh:expectedValue ; sh:datatype xsd:boolean ; sh:description "The expected value of tosh:hasShape to count." ; sh:order 3.0 ; ] ; sh:parameter [ a sh:Parameter ; sh:path sh:focusNode ; sh:class rdfs:Resource ; sh:description "The focus node." ; sh:order 0.0 ; ] ; sh:parameter [ a sh:Parameter ; sh:path sh:shapes ; sh:class rdf:List ; sh:description "The list of shapes to walk through." ; sh:order 1.0 ; ] ; sh:parameter [ a sh:Parameter ; sh:path sh:shapesGraph ; sh:class rdfs:Resource ; sh:description "The shapes graph." ; sh:order 2.0 ; ] ; sh:prefixes <http://topbraid.org/tosh> ; sh:returnType xsd:integer ; sh:select """ # The SUM will fail with an error if one of the operands is not a number # (this mechanism is used to propagate errors from tosh:hasShape calls) SELECT (SUM(?s) AS ?result) WHERE { GRAPH $shapesGraph { $shapes rdf:rest*/rdf:first ?shape . } BIND (tosh:hasShape($focusNode, ?shape, true) AS ?hasShape) . BIND (IF(bound(?hasShape), IF(?hasShape = $expectedValue, 1, 0), 'error') AS ?s) . } """ ; . tosh:editGroupDescription a rdf:Property ; rdfs:comment "A description of the property group when in \"edit\" mode." ; rdfs:domain sh:PropertyGroup ; rdfs:label "edit group description" ; rdfs:range xsd:string ; . tosh:graph a rdf:Property ; rdfs:comment "The graph that the shape is validated in." ; rdfs:label "graph" ; . tosh:hasDatatype a sh:SPARQLAskValidator ; rdfs:comment "Checks whether a given node ($value) is a literal with a given datatype ($datatype), and that the literal is well-formed." ; rdfs:label "has datatype" ; sh:ask """ ASK { FILTER (datatype($value) = $datatype && spif:isValidForDatatype($value, $datatype)) . } """ ; sh:prefixes <http://topbraid.org/tosh> ; . tosh:hasShape a sh:Function ; dash:apiStatus dash:Experimental ; rdfs:comment """A built-in function of the TopBraid SHACL implementation. Can be used to validate a given (focus) node against a given shape, returning <code>true</code> if the node is valid. If executed within a SHACL validation engine, this uses the shapes graph that was provided when the engine started. If executed in other contexts, e.g. in a stand-alone SPARQL query, the function attempts to use the URI of the current default graph as the shapes graph. This may not always be supported. If called
57
Various changes (from latest TopBraid snapshot)
7
.ttl
ttl
apache-2.0
TopQuadrant/shacl
308
<NME> RuleExample.java <BEF> ADDFILE <MSG> SHACL-AF rule example <DFF> @@ -0,0 +1,31 @@ +package org.topbraid.shacl; + +import org.apache.jena.rdf.model.Model; +import org.apache.jena.util.FileUtils; +import org.topbraid.jenax.util.JenaUtil; +import org.topbraid.shacl.rules.RuleUtil; +import org.topbraid.shacl.util.ModelPrinter; + +public class RuleExample { + + /** + * Loads an example SHACL-AF (rules) file and execute it against the data. + */ + public static void main(String[] args) throws Exception { + + // Load the main data model that contains rule(s) + Model dataModel = JenaUtil.createMemoryModel(); + dataModel.read(RuleExample.class.getResourceAsStream("sh/tests/rules/triple/rectangle.test.ttl"), "urn:dummy", + FileUtils.langTurtle); + + // Perform the rule calculation, using the data model + // also as the rule model - you may have them separated + Model result = RuleUtil.executeRules(dataModel, dataModel, null, null); + + // you may want to add the original data, to make sense of the rule results + result.add(dataModel); + + // Print rule calculation results + System.out.println(ModelPrinter.get().print(result)); + } +}
31
SHACL-AF rule example
0
.java
java
apache-2.0
TopQuadrant/shacl
309
<NME> RuleExample.java <BEF> ADDFILE <MSG> SHACL-AF rule example <DFF> @@ -0,0 +1,31 @@ +package org.topbraid.shacl; + +import org.apache.jena.rdf.model.Model; +import org.apache.jena.util.FileUtils; +import org.topbraid.jenax.util.JenaUtil; +import org.topbraid.shacl.rules.RuleUtil; +import org.topbraid.shacl.util.ModelPrinter; + +public class RuleExample { + + /** + * Loads an example SHACL-AF (rules) file and execute it against the data. + */ + public static void main(String[] args) throws Exception { + + // Load the main data model that contains rule(s) + Model dataModel = JenaUtil.createMemoryModel(); + dataModel.read(RuleExample.class.getResourceAsStream("sh/tests/rules/triple/rectangle.test.ttl"), "urn:dummy", + FileUtils.langTurtle); + + // Perform the rule calculation, using the data model + // also as the rule model - you may have them separated + Model result = RuleUtil.executeRules(dataModel, dataModel, null, null); + + // you may want to add the original data, to make sense of the rule results + result.add(dataModel); + + // Print rule calculation results + System.out.println(ModelPrinter.get().print(result)); + } +}
31
SHACL-AF rule example
0
.java
java
apache-2.0
TopQuadrant/shacl
310
<NME> LICENSE <BEF> Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "{}" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright {yyyy} {name of copyright owner} Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "{}" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright {yyyy} {name of copyright owner} Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. <MSG> Switched to AGPL <DFF> @@ -1,202 +1,3 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. +The TopBraid SHACL API is currently distributed under the GNU Affero General Public License + https://gnu.org/licenses/agpl.html
2
Switched to AGPL
201
LICENSE
apache-2.0
TopQuadrant/shacl
311
<NME> LICENSE <BEF> Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "{}" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright {yyyy} {name of copyright owner} Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "{}" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright {yyyy} {name of copyright owner} Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. <MSG> Switched to AGPL <DFF> @@ -1,202 +1,3 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. +The TopBraid SHACL API is currently distributed under the GNU Affero General Public License + https://gnu.org/licenses/agpl.html
2
Switched to AGPL
201
LICENSE
apache-2.0
TopQuadrant/shacl
312
<NME> notEqual-001.ttl <BEF> ADDFILE <MSG> Redesigned results vocabulary, property pair constraints <DFF> @@ -0,0 +1,53 @@ +# baseURI: http://www.w3.org/ns/shacl/test/features/core/notEqual-001 + +@prefix ex: <http://example.org/> . +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix sh: <http://www.w3.org/ns/shacl#> . +@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . + +<> + a sh:Graph ; + sh:shapesGraph <http://www.w3.org/ns/shacl> ; +. + + +# Shape Definitions ----------------------------------------------------------- + +ex:MyShape + a sh:Shape ; + sh:constraint [ + a sh:NotEqualConstraint ; + sh:predicate1 ex:property1 ; + sh:predicate2 ex:property2 ; + ] +. + +# Instances ------------------------------------------------------------------- + +ex:ValidResource1 + sh:nodeShape ex:MyShape ; + ex:property1 "A" ; + ex:property2 "B" ; +. + +ex:ValidResource2 + sh:nodeShape ex:MyShape ; + ex:property1 "A" ; + ex:property1 "B" ; + ex:property2 "C" ; + ex:property2 "D" ; +. + +ex:InvalidResource1 + sh:nodeShape ex:MyShape ; + ex:property1 "A" ; + ex:property2 "A" ; +. + +ex:InvalidResource2 + sh:nodeShape ex:MyShape ; + ex:property1 "A" ; + ex:property1 "B" ; + ex:property2 "A" ; +.
53
Redesigned results vocabulary, property pair constraints
0
.ttl
ttl
apache-2.0
TopQuadrant/shacl
313
<NME> notEqual-001.ttl <BEF> ADDFILE <MSG> Redesigned results vocabulary, property pair constraints <DFF> @@ -0,0 +1,53 @@ +# baseURI: http://www.w3.org/ns/shacl/test/features/core/notEqual-001 + +@prefix ex: <http://example.org/> . +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix sh: <http://www.w3.org/ns/shacl#> . +@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . + +<> + a sh:Graph ; + sh:shapesGraph <http://www.w3.org/ns/shacl> ; +. + + +# Shape Definitions ----------------------------------------------------------- + +ex:MyShape + a sh:Shape ; + sh:constraint [ + a sh:NotEqualConstraint ; + sh:predicate1 ex:property1 ; + sh:predicate2 ex:property2 ; + ] +. + +# Instances ------------------------------------------------------------------- + +ex:ValidResource1 + sh:nodeShape ex:MyShape ; + ex:property1 "A" ; + ex:property2 "B" ; +. + +ex:ValidResource2 + sh:nodeShape ex:MyShape ; + ex:property1 "A" ; + ex:property1 "B" ; + ex:property2 "C" ; + ex:property2 "D" ; +. + +ex:InvalidResource1 + sh:nodeShape ex:MyShape ; + ex:property1 "A" ; + ex:property2 "A" ; +. + +ex:InvalidResource2 + sh:nodeShape ex:MyShape ; + ex:property1 "A" ; + ex:property1 "B" ; + ex:property2 "A" ; +.
53
Redesigned results vocabulary, property pair constraints
0
.ttl
ttl
apache-2.0
TopQuadrant/shacl
314
<NME> rectangle.test.ttl <BEF> ADDFILE <MSG> Tracking latest SHACL-JS <DFF> @@ -0,0 +1,45 @@ +# baseURI: http://datashapes.org/js/tests/rules/rectangle.test +# imports: http://datashapes.org/dash +# prefix: ex + +@prefix dash: <http://datashapes.org/dash#> . +@prefix ex: <http://datashapes.org/js/tests/rules/rectangle.test#> . +@prefix owl: <http://www.w3.org/2002/07/owl#> . +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix sh: <http://www.w3.org/ns/shacl#> . +@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . + +<http://datashapes.org/js/tests/rules/rectangle.test> + rdf:type owl:Ontology ; + rdfs:label "Test of rectangle" ; + owl:imports <http://datashapes.org/dash> ; +. +ex:ExampleRectangle + rdf:type ex:Rectangle ; + ex:height 8 ; + ex:width 7 ; +. +ex:InferencingTestCase + rdf:type dash:InferencingTestCase ; + dash:expectedResult [ + rdf:object 56 ; + rdf:predicate ex:area ; + rdf:subject ex:ExampleRectangle ; + ] ; +. +ex:Rectangle + rdf:type rdfs:Class ; + rdfs:subClassOf rdfs:Resource ; +. +ex:RectangleShape + rdf:type sh:NodeShape ; + sh:rule [ + rdf:type sh:JSRule ; + sh:jsFunctionName "computeArea" ; + sh:jsLibrary [ + sh:jsLibraryURL "http://datashapes.org/js/tests/rules/rectangle.js"^^xsd:anyURI ; + ] ; + ] ; + sh:targetClass ex:Rectangle ; +.
45
Tracking latest SHACL-JS
0
.ttl
test
apache-2.0
TopQuadrant/shacl
315
<NME> rectangle.test.ttl <BEF> ADDFILE <MSG> Tracking latest SHACL-JS <DFF> @@ -0,0 +1,45 @@ +# baseURI: http://datashapes.org/js/tests/rules/rectangle.test +# imports: http://datashapes.org/dash +# prefix: ex + +@prefix dash: <http://datashapes.org/dash#> . +@prefix ex: <http://datashapes.org/js/tests/rules/rectangle.test#> . +@prefix owl: <http://www.w3.org/2002/07/owl#> . +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix sh: <http://www.w3.org/ns/shacl#> . +@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . + +<http://datashapes.org/js/tests/rules/rectangle.test> + rdf:type owl:Ontology ; + rdfs:label "Test of rectangle" ; + owl:imports <http://datashapes.org/dash> ; +. +ex:ExampleRectangle + rdf:type ex:Rectangle ; + ex:height 8 ; + ex:width 7 ; +. +ex:InferencingTestCase + rdf:type dash:InferencingTestCase ; + dash:expectedResult [ + rdf:object 56 ; + rdf:predicate ex:area ; + rdf:subject ex:ExampleRectangle ; + ] ; +. +ex:Rectangle + rdf:type rdfs:Class ; + rdfs:subClassOf rdfs:Resource ; +. +ex:RectangleShape + rdf:type sh:NodeShape ; + sh:rule [ + rdf:type sh:JSRule ; + sh:jsFunctionName "computeArea" ; + sh:jsLibrary [ + sh:jsLibraryURL "http://datashapes.org/js/tests/rules/rectangle.js"^^xsd:anyURI ; + ] ; + ] ; + sh:targetClass ex:Rectangle ; +.
45
Tracking latest SHACL-JS
0
.ttl
test
apache-2.0
TopQuadrant/shacl
316
<NME> ValidationEngine.java <BEF> /* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * See the NOTICE file distributed with this work for additional * information regarding copyright ownership. */ package org.topbraid.shacl.validation; import java.net.URI; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; import java.util.WeakHashMap; import java.util.concurrent.ConcurrentHashMap; import java.util.function.Function; import java.util.function.Predicate; import java.util.function.Supplier; import org.apache.jena.graph.Graph; import org.apache.jena.graph.Node; import org.apache.jena.graph.Triple; import org.apache.jena.graph.compose.MultiUnion; import org.apache.jena.query.Dataset; import org.apache.jena.query.QuerySolution; import org.apache.jena.rdf.model.Literal; import org.apache.jena.rdf.model.Model; import org.apache.jena.rdf.model.ModelFactory; import org.apache.jena.rdf.model.Property; import org.apache.jena.rdf.model.RDFNode; import org.apache.jena.rdf.model.Resource; import org.apache.jena.rdf.model.ResourceFactory; import org.apache.jena.rdf.model.Statement; import org.apache.jena.rdf.model.StmtIterator; import org.apache.jena.sparql.path.P_Inverse; import org.apache.jena.sparql.path.P_Link; import org.apache.jena.sparql.path.Path; import org.apache.jena.sparql.path.eval.PathEval; import org.apache.jena.sparql.util.Context; import org.apache.jena.vocabulary.RDF; import org.topbraid.jenax.util.ExceptionUtil; import org.topbraid.jenax.util.JenaDatatypes; import org.topbraid.jenax.util.JenaUtil; import org.topbraid.jenax.util.RDFLabels; import org.topbraid.shacl.arq.SHACLPaths; import org.topbraid.shacl.engine.AbstractEngine; import org.topbraid.shacl.engine.Constraint; import org.topbraid.shacl.engine.SHACLScriptEngineManager; import org.topbraid.shacl.engine.Shape; import org.topbraid.shacl.engine.ShapesGraph; import org.topbraid.shacl.engine.filters.ExcludeMetaShapesFilter; import org.topbraid.shacl.expr.NodeExpression; import org.topbraid.shacl.expr.NodeExpressionFactory; import org.topbraid.shacl.model.SHNodeShape; import org.topbraid.shacl.model.SHPropertyShape; import org.topbraid.shacl.targets.InstancesTarget; import org.topbraid.shacl.targets.Target; import org.topbraid.shacl.util.FailureLog; import org.topbraid.shacl.util.SHACLPreferences; import org.topbraid.shacl.util.SHACLUtil; import org.topbraid.shacl.validation.sparql.SPARQLSubstitutions; import org.topbraid.shacl.vocabulary.DASH; import org.topbraid.shacl.vocabulary.SH; /** * A ValidationEngine uses a given shapes graph (represented via an instance of ShapesGraph) * and performs SHACL validation on a given Dataset. * * Instances of this class should be created via the ValidatorFactory. * * @author Holger Knublauch */ public class ValidationEngine extends AbstractEngine { // The currently active ValidationEngine for cases where no direct pointer can be acquired, e.g. from HasShapeFunction private static ThreadLocal<ValidationEngine> current = new ThreadLocal<>(); public static ValidationEngine getCurrent() { return current.get(); } public static void setCurrent(ValidationEngine value) { current.set(value); } // Avoids repeatedly walking up/down the class hierarchy for sh:class constraints private ClassesCache classesCache; private ValidationEngineConfiguration configuration; // Can be used to drop certain focus nodes from validation private Predicate<RDFNode> focusNodeFilter; // The inferred triples if the shapes graph declares an entailment regime private Model inferencesModel; // The label function for rendering nodes in validation results (message templates etc) private Function<RDFNode,String> labelFunction = (node -> RDFLabels.get().getNodeLabel(node)); // Avoids repeatedly fetching labels private Map<RDFNode,String> labelsCache = new ConcurrentHashMap<>(); setConfiguration(new ValidationEngineConfiguration()); if(report == null) { Model reportModel = JenaUtil.createMemoryModel(); reportModel.setNsPrefixes(shapesGraph.getShapesModel()); reportModel.setNsPrefixes(dataset.getDefaultModel()); this.report = reportModel.createResource(SH.ValidationReport); } else { private int resultsCount = 0; // Avoids repeatedly fetching the value nodes of a focus node / path combination private Map<ValueNodesCacheKey,Collection<RDFNode>> valueNodes = new WeakHashMap<>(); // Number of created violations, e.g. for progress monitor private int violationsCount = 0; /** * Constructs a new ValidationEngine. * @param dataset the Dataset to operate on * @param shapesGraphURI the URI of the shapes graph (must be in the dataset) * @param shapesGraph the ShapesGraph with the shapes to validate against * @param report the sh:ValidationReport object in the results Model, or null to create a new one */ protected ValidationEngine(Dataset dataset, URI shapesGraphURI, ShapesGraph shapesGraph, Resource report) { super(dataset, shapesGraph, shapesGraphURI); setConfiguration(new ValidationEngineConfiguration()); if(report == null) { Model reportModel = JenaUtil.createMemoryModel(); reportModel.setNsPrefixes(dataset.getDefaultModel()); // This can be very expensive in some databases reportModel.withDefaultMappings(shapesGraph.getShapesModel()); this.report = reportModel.createResource(SH.ValidationReport); } else { this.report = report; } } /** * Checks if entailments are active for the current shapes graph and applies them for a given focus node. * This will only work for the sh:Rules entailment, e.g. to compute sh:values and sh:defaultValue. * If any inferred triples exist, the focus node will be returned attached to the model that includes those inferences. * The dataset used internally will also be switched to use that new model as its default model, so that if * a node gets validated it will "see" the inferred triples too. * @param focusNode the focus node * @return the focus node, possibly in a different Model than originally */ public RDFNode applyEntailments(Resource focusNode) { Model shapesModel = dataset.getNamedModel(shapesGraphURI.toString()); if(shapesModel.contains(null, SH.entailment, SH.Rules)) { // Create union of data model and inferences if called for the first time if(inferencesModel == null) { inferencesModel = JenaUtil.createDefaultModel(); Model dataModel = dataset.getDefaultModel(); MultiUnion multiUnion = new MultiUnion(new Graph[]{ dataModel.getGraph(), inferencesModel.getGraph() }); multiUnion.setBaseGraph(dataModel.getGraph()); dataset.setDefaultModel(ModelFactory.createModelForGraph(multiUnion)); } // Apply sh:values rules Map<Property,RDFNode> defaultValueMap = new HashMap<>(); for(SHNodeShape nodeShape : SHACLUtil.getAllShapesAtNode(focusNode)) { if(!nodeShape.hasProperty(SH.deactivated, JenaDatatypes.TRUE)) { for(SHPropertyShape ps : nodeShape.getPropertyShapes()) { if(!ps.hasProperty(SH.deactivated, JenaDatatypes.TRUE)) { Resource path = ps.getPath(); if(path instanceof Resource) { Statement values = ps.getProperty(SH.values); if(values != null) { NodeExpression ne = NodeExpressionFactory.get().create(values.getObject()); ne.eval(focusNode, this).forEachRemaining(v -> inferencesModel.getGraph().add(Triple.create(focusNode.asNode(), path.asNode(), v.asNode()))); } Statement defaultValue = ps.getProperty(SH.defaultValue); if(defaultValue != null) { defaultValueMap.put(JenaUtil.asProperty(path), defaultValue.getObject()); } } } } } } // Add sh:defaultValue where needed Model dataModel = dataset.getDefaultModel(); // This is now the union model Resource newFocusNode = focusNode.inModel(dataModel); for(Property predicate : defaultValueMap.keySet()) { if(!newFocusNode.hasProperty(predicate)) { NodeExpression ne = NodeExpressionFactory.get().create(defaultValueMap.get(predicate)); ne.eval(focusNode, this).forEachRemaining(v -> inferencesModel.add(focusNode, predicate, v)); } } return newFocusNode; } return focusNode; } public void addResultMessage(Resource result, Literal message, QuerySolution bindings) { result.addProperty(SH.resultMessage, SPARQLSubstitutions.withSubstitutions(message, bindings, getLabelFunction())); } // Note: does not set sh:path public Resource createResult(Resource type, Constraint constraint, RDFNode focusNode) { Resource result = report.getModel().createResource(type); report.addProperty(SH.result, result); result.addProperty(SH.resultSeverity, constraint.getSeverity()); result.addProperty(SH.sourceConstraintComponent, constraint.getComponent()); result.addProperty(SH.sourceShape, constraint.getShapeResource()); if(focusNode != null) { result.addProperty(SH.focusNode, focusNode); } checkMaximumNumberFailures(constraint); resultsCount++; return result; } public Resource createValidationResult(Constraint constraint, RDFNode focusNode, RDFNode value, Supplier<String> defaultMessage) { Resource result = createResult(SH.ValidationResult, constraint, focusNode); if(value != null) { result.addProperty(SH.value, value); } if(!constraint.getShape().isNodeShape()) { result.addProperty(SH.resultPath, SHACLPaths.clonePath(constraint.getShapeResource().getPath(), result.getModel())); } Collection<RDFNode> messages = constraint.getMessages(); if(messages.size() > 0) { messages.stream().forEach(message -> result.addProperty(SH.resultMessage, message)); } else if(defaultMessage != null) { String m = defaultMessage.get(); if(m != null) { result.addProperty(SH.resultMessage, m); } } return result; } private void checkMaximumNumberFailures(Constraint constraint) { if (SH.Violation.equals(constraint.getShape().getSeverity())) { this.violationsCount++; if (configuration.getValidationErrorBatch() != -1 && violationsCount >= configuration.getValidationErrorBatch()) { throw new MaximumNumberViolations(violationsCount); } } } public ClassesCache getClassesCache() { return classesCache; } public ValidationEngineConfiguration getConfiguration() { return configuration; } public String getLabel(RDFNode node) { return labelsCache.computeIfAbsent(node, n -> getLabelFunction().apply(n)); } public Function<RDFNode,String> getLabelFunction() { return labelFunction; } public ValidationProfile getProfile() { return profile; } /** * Gets the validation report as a Resource in the report Model. * @return the report Resource */ public Resource getReport() { return report; } /** * Gets a Set of all shapes that should be evaluated for a given resource. * @param focusNode the focus node to get the shapes for * @param dataset the Dataset containing the resource * @param shapesModel the shapes Model * @return a Set of shape resources */ private Set<Resource> getShapesForNode(RDFNode focusNode, Dataset dataset, Model shapesModel) { Set<Resource> shapes = new HashSet<>(); for(Shape rootShape : shapesGraph.getRootShapes()) { for(Target target : rootShape.getTargets()) { if(!(target instanceof InstancesTarget)) { if(target.contains(dataset, focusNode)) { shapes.add(rootShape.getShapeResource()); } } } } // rdf:type / sh:targetClass if(focusNode instanceof Resource) { for(Resource type : JenaUtil.getAllTypes((Resource)focusNode)) { if(JenaUtil.hasIndirectType(type.inModel(shapesModel), SH.Shape)) { shapes.add(type); } for(Statement s : shapesModel.listStatements(null, SH.targetClass, type).toList()) { shapes.add(s.getSubject()); } } } return shapes; } public ValidationReport getValidationReport() { return new ResourceValidationReport(report); } public Collection<RDFNode> getValueNodes(Constraint constraint, RDFNode focusNode) { if(constraint.getShape().isNodeShape()) { return Collections.singletonList(focusNode); } else { // We use a cache here because many shapes contains for example both sh:datatype and sh:minCount, and fetching // the value nodes each time may be expensive, esp for sh:minCount/maxCount constraints. ValueNodesCacheKey key = new ValueNodesCacheKey(focusNode, constraint.getShape().getPath()); return valueNodes.computeIfAbsent(key, k -> getValueNodesHelper(focusNode, constraint)); } } private Collection<RDFNode> getValueNodesHelper(RDFNode focusNode, Constraint constraint) { Property predicate = constraint.getShape().getPredicate(); if(predicate != null) { List<RDFNode> results = new LinkedList<>(); if(focusNode instanceof Resource) { Iterator<Statement> it = ((Resource)focusNode).listProperties(predicate); while(it.hasNext()) { results.add(it.next().getObject()); } } return results; } else { Path jenaPath = constraint.getShape().getJenaPath(); if(jenaPath instanceof P_Inverse && ((P_Inverse)jenaPath).getSubPath() instanceof P_Link) { List<RDFNode> results = new LinkedList<>(); Property inversePredicate = ResourceFactory.createProperty(((P_Link)((P_Inverse)jenaPath).getSubPath()).getNode().getURI()); Iterator<Statement> it = focusNode.getModel().listStatements(null, inversePredicate, focusNode); while(it.hasNext()) { results.add(it.next().getSubject()); } return results; } Set<RDFNode> results = new HashSet<>(); Iterator<Node> it = PathEval.eval(focusNode.getModel().getGraph(), focusNode.asNode(), jenaPath, Context.emptyContext()); while(it.hasNext()) { Node node = it.next(); results.add(focusNode.getModel().asRDFNode(node)); } return results; } } /** * Validates a given list of focus nodes against a given Shape, and stops as soon * as one validation result is reported. No results are recorded. * @param focusNodes the nodes to validate * @param shape the sh:Shape to validate against * @return true if there were no validation results, false for violations */ public boolean nodesConformToShape(List<RDFNode> focusNodes, Node shape) { if(!shapesGraph.isIgnored(shape)) { Resource oldReport = report; report = JenaUtil.createMemoryModel().createResource(); try { Shape vs = shapesGraph.getShape(shape); if(!vs.isDeactivated()) { boolean nested = SHACLScriptEngineManager.get().begin(); try { for(Constraint constraint : vs.getConstraints()) { validateNodesAgainstConstraint(focusNodes, constraint); if(report.hasProperty(SH.result)) { return false; } } } finally { SHACLScriptEngineManager.get().end(nested); } } } finally { this.report = oldReport; } } return true; } public void setClassesCache(ClassesCache value) { this.classesCache = value; } /** * Sets a filter that can be used to skip certain focus node from validation. * The filter must return true if the given candidate focus node shall be validated, * and false to skip it. * @param value the new filter */ public void setFocusNodeFilter(Predicate<RDFNode> value) { this.focusNodeFilter = value; } public void setLabelFunction(Function<RDFNode,String> value) { this.labelFunction = value; } public void updateConforms() { boolean conforms = true; StmtIterator it = report.listProperties(SH.result); while(it.hasNext()) { Statement s = it.next(); if(s.getResource().hasProperty(RDF.type, SH.ValidationResult)) { conforms = false; it.close(); break; } } if(report.hasProperty(SH.conforms)) { report.removeAll(SH.conforms); } report.addProperty(SH.conforms, conforms ? JenaDatatypes.TRUE : JenaDatatypes.FALSE); } /** * Validates all target nodes against all of their shapes. * To further narrow down which nodes to validate, use {@link #setFocusNodeFilter(Predicate)}. * @return an instance of sh:ValidationReport in the results Model * @throws InterruptedException if the monitor has canceled this */ public Resource validateAll() throws InterruptedException { List<Shape> rootShapes = shapesGraph.getRootShapes(); return validateShapes(rootShapes); } /** * Validates a given focus node against all of the shapes that have matching targets. * @param focusNode the node to validate * @return an instance of sh:ValidationReport in the results Model * @throws InterruptedException if the monitor has canceled this */ public Resource validateNode(Node focusNode) throws InterruptedException { Model shapesModel = dataset.getNamedModel(shapesGraphURI.toString()); RDFNode focusRDFNode = dataset.getDefaultModel().asRDFNode(focusNode); Set<Resource> shapes = getShapesForNode(focusRDFNode, dataset, shapesModel); boolean nested = SHACLScriptEngineManager.get().begin(); try { for(Resource shape : shapes) { if(monitor != null && monitor.isCanceled()) { throw new InterruptedException(); } validateNodesAgainstShape(Collections.singletonList(focusRDFNode), shape.asNode()); } } finally { SHACLScriptEngineManager.get().end(nested); } return report; } /** * Validates a given list of focus node against a given Shape. * @param focusNodes the nodes to validate * @param shape the sh:Shape to validate against * @return an instance of sh:ValidationReport in the results Model */ public Resource validateNodesAgainstShape(List<RDFNode> focusNodes, Node shape) { if(!shapesGraph.isIgnored(shape)) { Shape vs = shapesGraph.getShape(shape); if(!vs.isDeactivated()) { boolean nested = SHACLScriptEngineManager.get().begin(); ValidationEngine oldEngine = current.get(); current.set(this); try { for(Constraint constraint : vs.getConstraints()) { validateNodesAgainstConstraint(focusNodes, constraint); } } finally { current.set(oldEngine); SHACLScriptEngineManager.get().end(nested); } } } return report; } /** * Validates all target nodes of a given collection of shapes against these shapes. * To further narrow down which nodes to validate, use {@link #setFocusNodeFilter(Predicate)}. * @return an instance of sh:ValidationReport in the results Model * @throws InterruptedException if the monitor has canceled this */ public Resource validateShapes(Collection<Shape> shapes) throws InterruptedException { boolean nested = SHACLScriptEngineManager.get().begin(); try { if(monitor != null) { monitor.beginTask("Validating " + shapes.size() + " shapes", shapes.size()); } if(classesCache == null) { // If we are doing everything then the cache should be used, but not for validation of individual focus nodes classesCache = new ClassesCache(); } int i = 0; for(Shape shape : shapes) { if(monitor != null) { String label = "Shape " + (++i) + ": " + getLabelFunction().apply(shape.getShapeResource()); if(resultsCount > 0) { label = "" + resultsCount + " results. " + label; } monitor.subTask(label); } Collection<RDFNode> focusNodes = shape.getTargetNodes(dataset); if(focusNodeFilter != null) { List<RDFNode> filteredFocusNodes = new LinkedList<>(); for(RDFNode focusNode : focusNodes) { if(focusNodeFilter.test(focusNode)) { filteredFocusNodes.add(focusNode); } } focusNodes = filteredFocusNodes; } if(!focusNodes.isEmpty()) { for(Constraint constraint : shape.getConstraints()) { validateNodesAgainstConstraint(focusNodes, constraint); } } if(monitor != null) { monitor.worked(1); if(monitor.isCanceled()) { throw new InterruptedException(); } } } } catch(MaximumNumberViolations ex) { // Ignore as this is just our way to stop validation when max number of violations is reached } finally { SHACLScriptEngineManager.get().end(nested); } updateConforms(); return report; } protected void validateNodesAgainstConstraint(Collection<RDFNode> focusNodes, Constraint constraint) { if(configuration != null && configuration.isSkippedConstraintComponent(constraint.getComponent())) { return; } ConstraintExecutor executor; try { executor = constraint.getExecutor(); } catch(Exception ex) { Resource result = createResult(DASH.FailureResult, constraint, constraint.getShapeResource()); result.addProperty(SH.resultMessage, "Failed to create validator: " + ExceptionUtil.getStackTrace(ex)); return; } if(executor != null) { if(SHACLPreferences.isProduceFailuresMode()) { try { executor.executeConstraint(constraint, this, focusNodes); } catch(Exception ex) { Resource result = createResult(DASH.FailureResult, constraint, constraint.getShapeResource()); result.addProperty(SH.resultMessage, "Exception during validation: " + ExceptionUtil.getStackTrace(ex)); } } else { executor.executeConstraint(constraint, this, focusNodes); } } else { FailureLog.get().logWarning("No suitable validator found for constraint " + constraint); } } public void setConfiguration(ValidationEngineConfiguration configuration) { this.configuration = configuration; if(!configuration.getValidateShapes()) { shapesGraph.setShapeFilter(new ExcludeMetaShapesFilter()); } } public void setProfile(ValidationProfile profile) { this.profile = profile; } // Used to avoid repeated computation of value nodes for a focus node / path combination private static class ValueNodesCacheKey { Resource path; RDFNode focusNode; ValueNodesCacheKey(RDFNode focusNode, Resource path) { this.path = path; this.focusNode = focusNode; } public boolean equals(Object o) { if(o instanceof ValueNodesCacheKey) { return path.equals(((ValueNodesCacheKey)o).path) && focusNode.equals(((ValueNodesCacheKey)o).focusNode); } else { return false; } } @Override public int hashCode() { return path.hashCode() + focusNode.hashCode(); } @Override public String toString() { return focusNode.toString() + " . " + path; } } } <MSG> #95 second attempt <DFF> @@ -118,8 +118,8 @@ public class ValidationEngine extends AbstractEngine implements ConfigurableEngi setConfiguration(new ValidationEngineConfiguration()); if(report == null) { Model reportModel = JenaUtil.createMemoryModel(); - reportModel.setNsPrefixes(shapesGraph.getShapesModel()); reportModel.setNsPrefixes(dataset.getDefaultModel()); + reportModel.withDefaultMappings(shapesGraph.getShapesModel()); this.report = reportModel.createResource(SH.ValidationReport); } else {
1
#95 second attempt
1
.java
java
apache-2.0
TopQuadrant/shacl
317
<NME> ValidationEngine.java <BEF> /* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * See the NOTICE file distributed with this work for additional * information regarding copyright ownership. */ package org.topbraid.shacl.validation; import java.net.URI; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; import java.util.WeakHashMap; import java.util.concurrent.ConcurrentHashMap; import java.util.function.Function; import java.util.function.Predicate; import java.util.function.Supplier; import org.apache.jena.graph.Graph; import org.apache.jena.graph.Node; import org.apache.jena.graph.Triple; import org.apache.jena.graph.compose.MultiUnion; import org.apache.jena.query.Dataset; import org.apache.jena.query.QuerySolution; import org.apache.jena.rdf.model.Literal; import org.apache.jena.rdf.model.Model; import org.apache.jena.rdf.model.ModelFactory; import org.apache.jena.rdf.model.Property; import org.apache.jena.rdf.model.RDFNode; import org.apache.jena.rdf.model.Resource; import org.apache.jena.rdf.model.ResourceFactory; import org.apache.jena.rdf.model.Statement; import org.apache.jena.rdf.model.StmtIterator; import org.apache.jena.sparql.path.P_Inverse; import org.apache.jena.sparql.path.P_Link; import org.apache.jena.sparql.path.Path; import org.apache.jena.sparql.path.eval.PathEval; import org.apache.jena.sparql.util.Context; import org.apache.jena.vocabulary.RDF; import org.topbraid.jenax.util.ExceptionUtil; import org.topbraid.jenax.util.JenaDatatypes; import org.topbraid.jenax.util.JenaUtil; import org.topbraid.jenax.util.RDFLabels; import org.topbraid.shacl.arq.SHACLPaths; import org.topbraid.shacl.engine.AbstractEngine; import org.topbraid.shacl.engine.Constraint; import org.topbraid.shacl.engine.SHACLScriptEngineManager; import org.topbraid.shacl.engine.Shape; import org.topbraid.shacl.engine.ShapesGraph; import org.topbraid.shacl.engine.filters.ExcludeMetaShapesFilter; import org.topbraid.shacl.expr.NodeExpression; import org.topbraid.shacl.expr.NodeExpressionFactory; import org.topbraid.shacl.model.SHNodeShape; import org.topbraid.shacl.model.SHPropertyShape; import org.topbraid.shacl.targets.InstancesTarget; import org.topbraid.shacl.targets.Target; import org.topbraid.shacl.util.FailureLog; import org.topbraid.shacl.util.SHACLPreferences; import org.topbraid.shacl.util.SHACLUtil; import org.topbraid.shacl.validation.sparql.SPARQLSubstitutions; import org.topbraid.shacl.vocabulary.DASH; import org.topbraid.shacl.vocabulary.SH; /** * A ValidationEngine uses a given shapes graph (represented via an instance of ShapesGraph) * and performs SHACL validation on a given Dataset. * * Instances of this class should be created via the ValidatorFactory. * * @author Holger Knublauch */ public class ValidationEngine extends AbstractEngine { // The currently active ValidationEngine for cases where no direct pointer can be acquired, e.g. from HasShapeFunction private static ThreadLocal<ValidationEngine> current = new ThreadLocal<>(); public static ValidationEngine getCurrent() { return current.get(); } public static void setCurrent(ValidationEngine value) { current.set(value); } // Avoids repeatedly walking up/down the class hierarchy for sh:class constraints private ClassesCache classesCache; private ValidationEngineConfiguration configuration; // Can be used to drop certain focus nodes from validation private Predicate<RDFNode> focusNodeFilter; // The inferred triples if the shapes graph declares an entailment regime private Model inferencesModel; // The label function for rendering nodes in validation results (message templates etc) private Function<RDFNode,String> labelFunction = (node -> RDFLabels.get().getNodeLabel(node)); // Avoids repeatedly fetching labels private Map<RDFNode,String> labelsCache = new ConcurrentHashMap<>(); setConfiguration(new ValidationEngineConfiguration()); if(report == null) { Model reportModel = JenaUtil.createMemoryModel(); reportModel.setNsPrefixes(shapesGraph.getShapesModel()); reportModel.setNsPrefixes(dataset.getDefaultModel()); this.report = reportModel.createResource(SH.ValidationReport); } else { private int resultsCount = 0; // Avoids repeatedly fetching the value nodes of a focus node / path combination private Map<ValueNodesCacheKey,Collection<RDFNode>> valueNodes = new WeakHashMap<>(); // Number of created violations, e.g. for progress monitor private int violationsCount = 0; /** * Constructs a new ValidationEngine. * @param dataset the Dataset to operate on * @param shapesGraphURI the URI of the shapes graph (must be in the dataset) * @param shapesGraph the ShapesGraph with the shapes to validate against * @param report the sh:ValidationReport object in the results Model, or null to create a new one */ protected ValidationEngine(Dataset dataset, URI shapesGraphURI, ShapesGraph shapesGraph, Resource report) { super(dataset, shapesGraph, shapesGraphURI); setConfiguration(new ValidationEngineConfiguration()); if(report == null) { Model reportModel = JenaUtil.createMemoryModel(); reportModel.setNsPrefixes(dataset.getDefaultModel()); // This can be very expensive in some databases reportModel.withDefaultMappings(shapesGraph.getShapesModel()); this.report = reportModel.createResource(SH.ValidationReport); } else { this.report = report; } } /** * Checks if entailments are active for the current shapes graph and applies them for a given focus node. * This will only work for the sh:Rules entailment, e.g. to compute sh:values and sh:defaultValue. * If any inferred triples exist, the focus node will be returned attached to the model that includes those inferences. * The dataset used internally will also be switched to use that new model as its default model, so that if * a node gets validated it will "see" the inferred triples too. * @param focusNode the focus node * @return the focus node, possibly in a different Model than originally */ public RDFNode applyEntailments(Resource focusNode) { Model shapesModel = dataset.getNamedModel(shapesGraphURI.toString()); if(shapesModel.contains(null, SH.entailment, SH.Rules)) { // Create union of data model and inferences if called for the first time if(inferencesModel == null) { inferencesModel = JenaUtil.createDefaultModel(); Model dataModel = dataset.getDefaultModel(); MultiUnion multiUnion = new MultiUnion(new Graph[]{ dataModel.getGraph(), inferencesModel.getGraph() }); multiUnion.setBaseGraph(dataModel.getGraph()); dataset.setDefaultModel(ModelFactory.createModelForGraph(multiUnion)); } // Apply sh:values rules Map<Property,RDFNode> defaultValueMap = new HashMap<>(); for(SHNodeShape nodeShape : SHACLUtil.getAllShapesAtNode(focusNode)) { if(!nodeShape.hasProperty(SH.deactivated, JenaDatatypes.TRUE)) { for(SHPropertyShape ps : nodeShape.getPropertyShapes()) { if(!ps.hasProperty(SH.deactivated, JenaDatatypes.TRUE)) { Resource path = ps.getPath(); if(path instanceof Resource) { Statement values = ps.getProperty(SH.values); if(values != null) { NodeExpression ne = NodeExpressionFactory.get().create(values.getObject()); ne.eval(focusNode, this).forEachRemaining(v -> inferencesModel.getGraph().add(Triple.create(focusNode.asNode(), path.asNode(), v.asNode()))); } Statement defaultValue = ps.getProperty(SH.defaultValue); if(defaultValue != null) { defaultValueMap.put(JenaUtil.asProperty(path), defaultValue.getObject()); } } } } } } // Add sh:defaultValue where needed Model dataModel = dataset.getDefaultModel(); // This is now the union model Resource newFocusNode = focusNode.inModel(dataModel); for(Property predicate : defaultValueMap.keySet()) { if(!newFocusNode.hasProperty(predicate)) { NodeExpression ne = NodeExpressionFactory.get().create(defaultValueMap.get(predicate)); ne.eval(focusNode, this).forEachRemaining(v -> inferencesModel.add(focusNode, predicate, v)); } } return newFocusNode; } return focusNode; } public void addResultMessage(Resource result, Literal message, QuerySolution bindings) { result.addProperty(SH.resultMessage, SPARQLSubstitutions.withSubstitutions(message, bindings, getLabelFunction())); } // Note: does not set sh:path public Resource createResult(Resource type, Constraint constraint, RDFNode focusNode) { Resource result = report.getModel().createResource(type); report.addProperty(SH.result, result); result.addProperty(SH.resultSeverity, constraint.getSeverity()); result.addProperty(SH.sourceConstraintComponent, constraint.getComponent()); result.addProperty(SH.sourceShape, constraint.getShapeResource()); if(focusNode != null) { result.addProperty(SH.focusNode, focusNode); } checkMaximumNumberFailures(constraint); resultsCount++; return result; } public Resource createValidationResult(Constraint constraint, RDFNode focusNode, RDFNode value, Supplier<String> defaultMessage) { Resource result = createResult(SH.ValidationResult, constraint, focusNode); if(value != null) { result.addProperty(SH.value, value); } if(!constraint.getShape().isNodeShape()) { result.addProperty(SH.resultPath, SHACLPaths.clonePath(constraint.getShapeResource().getPath(), result.getModel())); } Collection<RDFNode> messages = constraint.getMessages(); if(messages.size() > 0) { messages.stream().forEach(message -> result.addProperty(SH.resultMessage, message)); } else if(defaultMessage != null) { String m = defaultMessage.get(); if(m != null) { result.addProperty(SH.resultMessage, m); } } return result; } private void checkMaximumNumberFailures(Constraint constraint) { if (SH.Violation.equals(constraint.getShape().getSeverity())) { this.violationsCount++; if (configuration.getValidationErrorBatch() != -1 && violationsCount >= configuration.getValidationErrorBatch()) { throw new MaximumNumberViolations(violationsCount); } } } public ClassesCache getClassesCache() { return classesCache; } public ValidationEngineConfiguration getConfiguration() { return configuration; } public String getLabel(RDFNode node) { return labelsCache.computeIfAbsent(node, n -> getLabelFunction().apply(n)); } public Function<RDFNode,String> getLabelFunction() { return labelFunction; } public ValidationProfile getProfile() { return profile; } /** * Gets the validation report as a Resource in the report Model. * @return the report Resource */ public Resource getReport() { return report; } /** * Gets a Set of all shapes that should be evaluated for a given resource. * @param focusNode the focus node to get the shapes for * @param dataset the Dataset containing the resource * @param shapesModel the shapes Model * @return a Set of shape resources */ private Set<Resource> getShapesForNode(RDFNode focusNode, Dataset dataset, Model shapesModel) { Set<Resource> shapes = new HashSet<>(); for(Shape rootShape : shapesGraph.getRootShapes()) { for(Target target : rootShape.getTargets()) { if(!(target instanceof InstancesTarget)) { if(target.contains(dataset, focusNode)) { shapes.add(rootShape.getShapeResource()); } } } } // rdf:type / sh:targetClass if(focusNode instanceof Resource) { for(Resource type : JenaUtil.getAllTypes((Resource)focusNode)) { if(JenaUtil.hasIndirectType(type.inModel(shapesModel), SH.Shape)) { shapes.add(type); } for(Statement s : shapesModel.listStatements(null, SH.targetClass, type).toList()) { shapes.add(s.getSubject()); } } } return shapes; } public ValidationReport getValidationReport() { return new ResourceValidationReport(report); } public Collection<RDFNode> getValueNodes(Constraint constraint, RDFNode focusNode) { if(constraint.getShape().isNodeShape()) { return Collections.singletonList(focusNode); } else { // We use a cache here because many shapes contains for example both sh:datatype and sh:minCount, and fetching // the value nodes each time may be expensive, esp for sh:minCount/maxCount constraints. ValueNodesCacheKey key = new ValueNodesCacheKey(focusNode, constraint.getShape().getPath()); return valueNodes.computeIfAbsent(key, k -> getValueNodesHelper(focusNode, constraint)); } } private Collection<RDFNode> getValueNodesHelper(RDFNode focusNode, Constraint constraint) { Property predicate = constraint.getShape().getPredicate(); if(predicate != null) { List<RDFNode> results = new LinkedList<>(); if(focusNode instanceof Resource) { Iterator<Statement> it = ((Resource)focusNode).listProperties(predicate); while(it.hasNext()) { results.add(it.next().getObject()); } } return results; } else { Path jenaPath = constraint.getShape().getJenaPath(); if(jenaPath instanceof P_Inverse && ((P_Inverse)jenaPath).getSubPath() instanceof P_Link) { List<RDFNode> results = new LinkedList<>(); Property inversePredicate = ResourceFactory.createProperty(((P_Link)((P_Inverse)jenaPath).getSubPath()).getNode().getURI()); Iterator<Statement> it = focusNode.getModel().listStatements(null, inversePredicate, focusNode); while(it.hasNext()) { results.add(it.next().getSubject()); } return results; } Set<RDFNode> results = new HashSet<>(); Iterator<Node> it = PathEval.eval(focusNode.getModel().getGraph(), focusNode.asNode(), jenaPath, Context.emptyContext()); while(it.hasNext()) { Node node = it.next(); results.add(focusNode.getModel().asRDFNode(node)); } return results; } } /** * Validates a given list of focus nodes against a given Shape, and stops as soon * as one validation result is reported. No results are recorded. * @param focusNodes the nodes to validate * @param shape the sh:Shape to validate against * @return true if there were no validation results, false for violations */ public boolean nodesConformToShape(List<RDFNode> focusNodes, Node shape) { if(!shapesGraph.isIgnored(shape)) { Resource oldReport = report; report = JenaUtil.createMemoryModel().createResource(); try { Shape vs = shapesGraph.getShape(shape); if(!vs.isDeactivated()) { boolean nested = SHACLScriptEngineManager.get().begin(); try { for(Constraint constraint : vs.getConstraints()) { validateNodesAgainstConstraint(focusNodes, constraint); if(report.hasProperty(SH.result)) { return false; } } } finally { SHACLScriptEngineManager.get().end(nested); } } } finally { this.report = oldReport; } } return true; } public void setClassesCache(ClassesCache value) { this.classesCache = value; } /** * Sets a filter that can be used to skip certain focus node from validation. * The filter must return true if the given candidate focus node shall be validated, * and false to skip it. * @param value the new filter */ public void setFocusNodeFilter(Predicate<RDFNode> value) { this.focusNodeFilter = value; } public void setLabelFunction(Function<RDFNode,String> value) { this.labelFunction = value; } public void updateConforms() { boolean conforms = true; StmtIterator it = report.listProperties(SH.result); while(it.hasNext()) { Statement s = it.next(); if(s.getResource().hasProperty(RDF.type, SH.ValidationResult)) { conforms = false; it.close(); break; } } if(report.hasProperty(SH.conforms)) { report.removeAll(SH.conforms); } report.addProperty(SH.conforms, conforms ? JenaDatatypes.TRUE : JenaDatatypes.FALSE); } /** * Validates all target nodes against all of their shapes. * To further narrow down which nodes to validate, use {@link #setFocusNodeFilter(Predicate)}. * @return an instance of sh:ValidationReport in the results Model * @throws InterruptedException if the monitor has canceled this */ public Resource validateAll() throws InterruptedException { List<Shape> rootShapes = shapesGraph.getRootShapes(); return validateShapes(rootShapes); } /** * Validates a given focus node against all of the shapes that have matching targets. * @param focusNode the node to validate * @return an instance of sh:ValidationReport in the results Model * @throws InterruptedException if the monitor has canceled this */ public Resource validateNode(Node focusNode) throws InterruptedException { Model shapesModel = dataset.getNamedModel(shapesGraphURI.toString()); RDFNode focusRDFNode = dataset.getDefaultModel().asRDFNode(focusNode); Set<Resource> shapes = getShapesForNode(focusRDFNode, dataset, shapesModel); boolean nested = SHACLScriptEngineManager.get().begin(); try { for(Resource shape : shapes) { if(monitor != null && monitor.isCanceled()) { throw new InterruptedException(); } validateNodesAgainstShape(Collections.singletonList(focusRDFNode), shape.asNode()); } } finally { SHACLScriptEngineManager.get().end(nested); } return report; } /** * Validates a given list of focus node against a given Shape. * @param focusNodes the nodes to validate * @param shape the sh:Shape to validate against * @return an instance of sh:ValidationReport in the results Model */ public Resource validateNodesAgainstShape(List<RDFNode> focusNodes, Node shape) { if(!shapesGraph.isIgnored(shape)) { Shape vs = shapesGraph.getShape(shape); if(!vs.isDeactivated()) { boolean nested = SHACLScriptEngineManager.get().begin(); ValidationEngine oldEngine = current.get(); current.set(this); try { for(Constraint constraint : vs.getConstraints()) { validateNodesAgainstConstraint(focusNodes, constraint); } } finally { current.set(oldEngine); SHACLScriptEngineManager.get().end(nested); } } } return report; } /** * Validates all target nodes of a given collection of shapes against these shapes. * To further narrow down which nodes to validate, use {@link #setFocusNodeFilter(Predicate)}. * @return an instance of sh:ValidationReport in the results Model * @throws InterruptedException if the monitor has canceled this */ public Resource validateShapes(Collection<Shape> shapes) throws InterruptedException { boolean nested = SHACLScriptEngineManager.get().begin(); try { if(monitor != null) { monitor.beginTask("Validating " + shapes.size() + " shapes", shapes.size()); } if(classesCache == null) { // If we are doing everything then the cache should be used, but not for validation of individual focus nodes classesCache = new ClassesCache(); } int i = 0; for(Shape shape : shapes) { if(monitor != null) { String label = "Shape " + (++i) + ": " + getLabelFunction().apply(shape.getShapeResource()); if(resultsCount > 0) { label = "" + resultsCount + " results. " + label; } monitor.subTask(label); } Collection<RDFNode> focusNodes = shape.getTargetNodes(dataset); if(focusNodeFilter != null) { List<RDFNode> filteredFocusNodes = new LinkedList<>(); for(RDFNode focusNode : focusNodes) { if(focusNodeFilter.test(focusNode)) { filteredFocusNodes.add(focusNode); } } focusNodes = filteredFocusNodes; } if(!focusNodes.isEmpty()) { for(Constraint constraint : shape.getConstraints()) { validateNodesAgainstConstraint(focusNodes, constraint); } } if(monitor != null) { monitor.worked(1); if(monitor.isCanceled()) { throw new InterruptedException(); } } } } catch(MaximumNumberViolations ex) { // Ignore as this is just our way to stop validation when max number of violations is reached } finally { SHACLScriptEngineManager.get().end(nested); } updateConforms(); return report; } protected void validateNodesAgainstConstraint(Collection<RDFNode> focusNodes, Constraint constraint) { if(configuration != null && configuration.isSkippedConstraintComponent(constraint.getComponent())) { return; } ConstraintExecutor executor; try { executor = constraint.getExecutor(); } catch(Exception ex) { Resource result = createResult(DASH.FailureResult, constraint, constraint.getShapeResource()); result.addProperty(SH.resultMessage, "Failed to create validator: " + ExceptionUtil.getStackTrace(ex)); return; } if(executor != null) { if(SHACLPreferences.isProduceFailuresMode()) { try { executor.executeConstraint(constraint, this, focusNodes); } catch(Exception ex) { Resource result = createResult(DASH.FailureResult, constraint, constraint.getShapeResource()); result.addProperty(SH.resultMessage, "Exception during validation: " + ExceptionUtil.getStackTrace(ex)); } } else { executor.executeConstraint(constraint, this, focusNodes); } } else { FailureLog.get().logWarning("No suitable validator found for constraint " + constraint); } } public void setConfiguration(ValidationEngineConfiguration configuration) { this.configuration = configuration; if(!configuration.getValidateShapes()) { shapesGraph.setShapeFilter(new ExcludeMetaShapesFilter()); } } public void setProfile(ValidationProfile profile) { this.profile = profile; } // Used to avoid repeated computation of value nodes for a focus node / path combination private static class ValueNodesCacheKey { Resource path; RDFNode focusNode; ValueNodesCacheKey(RDFNode focusNode, Resource path) { this.path = path; this.focusNode = focusNode; } public boolean equals(Object o) { if(o instanceof ValueNodesCacheKey) { return path.equals(((ValueNodesCacheKey)o).path) && focusNode.equals(((ValueNodesCacheKey)o).focusNode); } else { return false; } } @Override public int hashCode() { return path.hashCode() + focusNode.hashCode(); } @Override public String toString() { return focusNode.toString() + " . " + path; } } } <MSG> #95 second attempt <DFF> @@ -118,8 +118,8 @@ public class ValidationEngine extends AbstractEngine implements ConfigurableEngi setConfiguration(new ValidationEngineConfiguration()); if(report == null) { Model reportModel = JenaUtil.createMemoryModel(); - reportModel.setNsPrefixes(shapesGraph.getShapesModel()); reportModel.setNsPrefixes(dataset.getDefaultModel()); + reportModel.withDefaultMappings(shapesGraph.getShapesModel()); this.report = reportModel.createResource(SH.ValidationReport); } else {
1
#95 second attempt
1
.java
java
apache-2.0
TopQuadrant/shacl
318
<NME> nestedShape1.jsonld <BEF> ADDFILE <MSG> Merge pull request #18 from mulesoft-labs/npm NPM Package <DFF> @@ -0,0 +1,365 @@ +{ + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://www.w3.org/ns/shacl#Shape" + ], + "@id": "https://mulesoft-labs.github.io/amf-playground#", + "http://www.w3.org/ns/shacl#property": [ + { + "http://www.w3.org/ns/shacl#maxCount": [ + { + "@value": 1 + } + ], + "http://www.w3.org/ns/shacl#node": [ + { + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://www.w3.org/ns/shacl#Shape" + ], + "@id": "https://mulesoft-labs.github.io/amf-playground#/property/address/node-property", + "http://www.w3.org/ns/shacl#property": [ + { + "http://www.w3.org/ns/shacl#maxCount": [ + { + "@value": 1 + } + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 1 + } + ], + "@id": "https://mulesoft-labs.github.io/amf-playground#/property/address/property/city", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape" + ], + "http://www.w3.org/ns/shacl#path": [ + { + "@id": "http://raml.org/vocabularies/shapes/anon#city" + } + ], + "http://raml.org/vocabularies/shapes#propertyLabel": [ + { + "@value": "city" + } + ] + }, + { + "http://www.w3.org/ns/shacl#maxCount": [ + { + "@value": 1 + } + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 1 + } + ], + "@id": "https://mulesoft-labs.github.io/amf-playground#/property/address/property/country", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape" + ], + "http://www.w3.org/ns/shacl#path": [ + { + "@id": "http://raml.org/vocabularies/shapes/anon#country" + } + ], + "http://raml.org/vocabularies/shapes#propertyLabel": [ + { + "@value": "country" + } + ] + }, + { + "http://www.w3.org/ns/shacl#maxCount": [ + { + "@value": 1 + } + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 1 + } + ], + "@id": "https://mulesoft-labs.github.io/amf-playground#/property/address/property/postcode", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape" + ], + "http://www.w3.org/ns/shacl#path": [ + { + "@id": "http://raml.org/vocabularies/shapes/anon#postcode" + } + ], + "http://raml.org/vocabularies/shapes#propertyLabel": [ + { + "@value": "postcode" + } + ] + }, + { + "http://www.w3.org/ns/shacl#maxCount": [ + { + "@value": 1 + } + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 1 + } + ], + "@id": "https://mulesoft-labs.github.io/amf-playground#/property/address/property/street", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape" + ], + "http://www.w3.org/ns/shacl#path": [ + { + "@id": "http://raml.org/vocabularies/shapes/anon#street" + } + ], + "http://raml.org/vocabularies/shapes#propertyLabel": [ + { + "@value": "street" + } + ] + } + ], + "http://www.w3.org/ns/shacl#closed": [ + { + "@value": true + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 1 + } + ], + "@id": "https://mulesoft-labs.github.io/amf-playground#/property/address", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape" + ], + "http://www.w3.org/ns/shacl#path": [ + { + "@id": "http://raml.org/vocabularies/shapes/anon#address" + } + ], + "http://raml.org/vocabularies/shapes#propertyLabel": [ + { + "@value": "address" + } + ] + }, + { + "http://www.w3.org/ns/shacl#maxCount": [ + { + "@value": 1 + } + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#integer" + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 1 + } + ], + "@id": "https://mulesoft-labs.github.io/amf-playground#/property/age", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape" + ], + "http://www.w3.org/ns/shacl#path": [ + { + "@id": "http://raml.org/vocabularies/shapes/anon#age" + } + ], + "http://raml.org/vocabularies/shapes#propertyLabel": [ + { + "@value": "age" + } + ], + "http://www.w3.org/ns/shacl#minExclusive": [ + { + "@value": 17 + } + ] + }, + { + "http://raml.org/vocabularies/shapes#ordered": [ + { + "@value": true + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 3 + } + ], + "http://www.w3.org/ns/shacl#maxCount": [ + { + "@value": 5 + } + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#integer" + } + ], + "@id": "https://mulesoft-labs.github.io/amf-playground#/property/scores", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape" + ], + "http://www.w3.org/ns/shacl#path": [ + { + "@id": "http://raml.org/vocabularies/shapes/anon#scores" + } + ], + "http://raml.org/vocabularies/shapes#propertyLabel": [ + { + "@value": "scores" + } + ] + }, + { + "http://www.w3.org/ns/shacl#maxCount": [ + { + "@value": 1 + } + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 1 + } + ], + "@id": "https://mulesoft-labs.github.io/amf-playground#/property/gender", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape" + ], + "http://www.w3.org/ns/shacl#path": [ + { + "@id": "http://raml.org/vocabularies/shapes/anon#gender" + } + ], + "http://raml.org/vocabularies/shapes#propertyLabel": [ + { + "@value": "gender" + } + ], + "http://www.w3.org/ns/shacl#in": { + "@list": [ + { + "@value": "female" + }, + { + "@value": "male" + } + ] + } + }, + { + "http://www.w3.org/ns/shacl#maxCount": [ + { + "@value": 1 + } + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 1 + } + ], + "@id": "https://mulesoft-labs.github.io/amf-playground#/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape" + ], + "http://www.w3.org/ns/shacl#path": [ + { + "@id": "http://raml.org/vocabularies/shapes/anon#name" + } + ], + "http://raml.org/vocabularies/shapes#propertyLabel": [ + { + "@value": "name" + } + ] + }, + { + "http://www.w3.org/ns/shacl#maxCount": [ + { + "@value": 1 + } + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "@id": "https://mulesoft-labs.github.io/amf-playground#/property/surname", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape" + ], + "http://www.w3.org/ns/shacl#path": [ + { + "@id": "http://raml.org/vocabularies/shapes/anon#surname" + } + ], + "http://raml.org/vocabularies/shapes#propertyLabel": [ + { + "@value": "surname" + } + ] + } + ], + "http://www.w3.org/ns/shacl#closed": [ + { + "@value": true + } + ] +}
365
Merge pull request #18 from mulesoft-labs/npm
0
.jsonld
jsonld
apache-2.0
TopQuadrant/shacl
319
<NME> nestedShape1.jsonld <BEF> ADDFILE <MSG> Merge pull request #18 from mulesoft-labs/npm NPM Package <DFF> @@ -0,0 +1,365 @@ +{ + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://www.w3.org/ns/shacl#Shape" + ], + "@id": "https://mulesoft-labs.github.io/amf-playground#", + "http://www.w3.org/ns/shacl#property": [ + { + "http://www.w3.org/ns/shacl#maxCount": [ + { + "@value": 1 + } + ], + "http://www.w3.org/ns/shacl#node": [ + { + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://www.w3.org/ns/shacl#Shape" + ], + "@id": "https://mulesoft-labs.github.io/amf-playground#/property/address/node-property", + "http://www.w3.org/ns/shacl#property": [ + { + "http://www.w3.org/ns/shacl#maxCount": [ + { + "@value": 1 + } + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 1 + } + ], + "@id": "https://mulesoft-labs.github.io/amf-playground#/property/address/property/city", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape" + ], + "http://www.w3.org/ns/shacl#path": [ + { + "@id": "http://raml.org/vocabularies/shapes/anon#city" + } + ], + "http://raml.org/vocabularies/shapes#propertyLabel": [ + { + "@value": "city" + } + ] + }, + { + "http://www.w3.org/ns/shacl#maxCount": [ + { + "@value": 1 + } + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 1 + } + ], + "@id": "https://mulesoft-labs.github.io/amf-playground#/property/address/property/country", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape" + ], + "http://www.w3.org/ns/shacl#path": [ + { + "@id": "http://raml.org/vocabularies/shapes/anon#country" + } + ], + "http://raml.org/vocabularies/shapes#propertyLabel": [ + { + "@value": "country" + } + ] + }, + { + "http://www.w3.org/ns/shacl#maxCount": [ + { + "@value": 1 + } + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 1 + } + ], + "@id": "https://mulesoft-labs.github.io/amf-playground#/property/address/property/postcode", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape" + ], + "http://www.w3.org/ns/shacl#path": [ + { + "@id": "http://raml.org/vocabularies/shapes/anon#postcode" + } + ], + "http://raml.org/vocabularies/shapes#propertyLabel": [ + { + "@value": "postcode" + } + ] + }, + { + "http://www.w3.org/ns/shacl#maxCount": [ + { + "@value": 1 + } + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 1 + } + ], + "@id": "https://mulesoft-labs.github.io/amf-playground#/property/address/property/street", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape" + ], + "http://www.w3.org/ns/shacl#path": [ + { + "@id": "http://raml.org/vocabularies/shapes/anon#street" + } + ], + "http://raml.org/vocabularies/shapes#propertyLabel": [ + { + "@value": "street" + } + ] + } + ], + "http://www.w3.org/ns/shacl#closed": [ + { + "@value": true + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 1 + } + ], + "@id": "https://mulesoft-labs.github.io/amf-playground#/property/address", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape" + ], + "http://www.w3.org/ns/shacl#path": [ + { + "@id": "http://raml.org/vocabularies/shapes/anon#address" + } + ], + "http://raml.org/vocabularies/shapes#propertyLabel": [ + { + "@value": "address" + } + ] + }, + { + "http://www.w3.org/ns/shacl#maxCount": [ + { + "@value": 1 + } + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#integer" + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 1 + } + ], + "@id": "https://mulesoft-labs.github.io/amf-playground#/property/age", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape" + ], + "http://www.w3.org/ns/shacl#path": [ + { + "@id": "http://raml.org/vocabularies/shapes/anon#age" + } + ], + "http://raml.org/vocabularies/shapes#propertyLabel": [ + { + "@value": "age" + } + ], + "http://www.w3.org/ns/shacl#minExclusive": [ + { + "@value": 17 + } + ] + }, + { + "http://raml.org/vocabularies/shapes#ordered": [ + { + "@value": true + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 3 + } + ], + "http://www.w3.org/ns/shacl#maxCount": [ + { + "@value": 5 + } + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#integer" + } + ], + "@id": "https://mulesoft-labs.github.io/amf-playground#/property/scores", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape" + ], + "http://www.w3.org/ns/shacl#path": [ + { + "@id": "http://raml.org/vocabularies/shapes/anon#scores" + } + ], + "http://raml.org/vocabularies/shapes#propertyLabel": [ + { + "@value": "scores" + } + ] + }, + { + "http://www.w3.org/ns/shacl#maxCount": [ + { + "@value": 1 + } + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 1 + } + ], + "@id": "https://mulesoft-labs.github.io/amf-playground#/property/gender", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape" + ], + "http://www.w3.org/ns/shacl#path": [ + { + "@id": "http://raml.org/vocabularies/shapes/anon#gender" + } + ], + "http://raml.org/vocabularies/shapes#propertyLabel": [ + { + "@value": "gender" + } + ], + "http://www.w3.org/ns/shacl#in": { + "@list": [ + { + "@value": "female" + }, + { + "@value": "male" + } + ] + } + }, + { + "http://www.w3.org/ns/shacl#maxCount": [ + { + "@value": 1 + } + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 1 + } + ], + "@id": "https://mulesoft-labs.github.io/amf-playground#/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape" + ], + "http://www.w3.org/ns/shacl#path": [ + { + "@id": "http://raml.org/vocabularies/shapes/anon#name" + } + ], + "http://raml.org/vocabularies/shapes#propertyLabel": [ + { + "@value": "name" + } + ] + }, + { + "http://www.w3.org/ns/shacl#maxCount": [ + { + "@value": 1 + } + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "@id": "https://mulesoft-labs.github.io/amf-playground#/property/surname", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape" + ], + "http://www.w3.org/ns/shacl#path": [ + { + "@id": "http://raml.org/vocabularies/shapes/anon#surname" + } + ], + "http://raml.org/vocabularies/shapes#propertyLabel": [ + { + "@value": "surname" + } + ] + } + ], + "http://www.w3.org/ns/shacl#closed": [ + { + "@value": true + } + ] +}
365
Merge pull request #18 from mulesoft-labs/npm
0
.jsonld
jsonld
apache-2.0
TopQuadrant/shacl
320
<NME> closedShape-002.ttl <BEF> ADDFILE <MSG> Fixed Git ISSUE-1, added support for sh:validationFunction, latest spec incl changes to closed shapes <DFF> @@ -0,0 +1,41 @@ +# baseURI: http://www.w3.org/ns/shacl/test/features/core/closedShape-002 + +@prefix ex: <http://example.org/> . +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix sh: <http://www.w3.org/ns/shacl#> . +@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . + +<> + a sh:Graph ; + sh:shapesGraph <http://www.w3.org/ns/shacl> ; +. + + +# Shape Definitions ----------------------------------------------------------- + +ex:MyShape + a sh:Shape ; + sh:property [ + sh:predicate ex:someProperty ; + ] ; + sh:constraint [ + a sh:ClosedShapeConstraint ; + sh:ignoredProperties ( sh:nodeShape rdf:type ) ; + ] ; +. + +# Instances ------------------------------------------------------------------- + +ex:ValidInstance1 + a ex:SomeClass ; + sh:nodeShape ex:MyShape ; + ex:someProperty 3 ; +. + +# Invalid: ex:otherProperty not listed in shape +ex:InvalidInstance1 + sh:nodeShape ex:MyShape ; + ex:otherProperty 4 ; + ex:someProperty 3 ; +.
41
Fixed Git ISSUE-1, added support for sh:validationFunction, latest spec incl changes to closed shapes
0
.ttl
ttl
apache-2.0
TopQuadrant/shacl
321
<NME> closedShape-002.ttl <BEF> ADDFILE <MSG> Fixed Git ISSUE-1, added support for sh:validationFunction, latest spec incl changes to closed shapes <DFF> @@ -0,0 +1,41 @@ +# baseURI: http://www.w3.org/ns/shacl/test/features/core/closedShape-002 + +@prefix ex: <http://example.org/> . +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix sh: <http://www.w3.org/ns/shacl#> . +@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . + +<> + a sh:Graph ; + sh:shapesGraph <http://www.w3.org/ns/shacl> ; +. + + +# Shape Definitions ----------------------------------------------------------- + +ex:MyShape + a sh:Shape ; + sh:property [ + sh:predicate ex:someProperty ; + ] ; + sh:constraint [ + a sh:ClosedShapeConstraint ; + sh:ignoredProperties ( sh:nodeShape rdf:type ) ; + ] ; +. + +# Instances ------------------------------------------------------------------- + +ex:ValidInstance1 + a ex:SomeClass ; + sh:nodeShape ex:MyShape ; + ex:someProperty 3 ; +. + +# Invalid: ex:otherProperty not listed in shape +ex:InvalidInstance1 + sh:nodeShape ex:MyShape ; + ex:otherProperty 4 ; + ex:someProperty 3 ; +.
41
Fixed Git ISSUE-1, added support for sh:validationFunction, latest spec incl changes to closed shapes
0
.ttl
ttl
apache-2.0
TopQuadrant/shacl
322
<NME> AppTest.java <BEF> ADDFILE <MSG> Initial dump of current work-in-progress <DFF> @@ -0,0 +1,38 @@ +package org.topbraid.shacl; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +/** + * Unit test for simple App. + */ +public class AppTest + extends TestCase +{ + /** + * Create the test case + * + * @param testName name of the test case + */ + public AppTest( String testName ) + { + super( testName ); + } + + /** + * @return the suite of tests being tested + */ + public static Test suite() + { + return new TestSuite( AppTest.class ); + } + + /** + * Rigourous Test :-) + */ + public void testApp() + { + assertTrue( true ); + } +}
38
Initial dump of current work-in-progress
0
.java
java
apache-2.0
TopQuadrant/shacl
323
<NME> AppTest.java <BEF> ADDFILE <MSG> Initial dump of current work-in-progress <DFF> @@ -0,0 +1,38 @@ +package org.topbraid.shacl; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +/** + * Unit test for simple App. + */ +public class AppTest + extends TestCase +{ + /** + * Create the test case + * + * @param testName name of the test case + */ + public AppTest( String testName ) + { + super( testName ); + } + + /** + * @return the suite of tests being tested + */ + public static Test suite() + { + return new TestSuite( AppTest.class ); + } + + /** + * Rigourous Test :-) + */ + public void testApp() + { + assertTrue( true ); + } +}
38
Initial dump of current work-in-progress
0
.java
java
apache-2.0
TopQuadrant/shacl
324
<NME> RuleEngine.java <BEF> /* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * See the NOTICE file distributed with this work for additional * information regarding copyright ownership. */ package org.topbraid.shacl.rules; import java.net.URI; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; import org.apache.jena.graph.Node; import org.apache.jena.graph.Triple; import org.apache.jena.query.Dataset; import org.apache.jena.rdf.model.Model; import org.apache.jena.rdf.model.Property; import org.apache.jena.rdf.model.RDFNode; import org.apache.jena.rdf.model.Resource; import org.apache.jena.rdf.model.Statement; import org.apache.jena.util.iterator.ExtendedIterator; import org.apache.jena.vocabulary.RDF; import org.topbraid.jenax.progress.ProgressMonitor; import org.topbraid.jenax.statistics.ExecStatistics; import org.topbraid.jenax.statistics.ExecStatisticsManager; import org.topbraid.jenax.util.JenaDatatypes; import org.topbraid.jenax.util.JenaUtil; import org.topbraid.jenax.util.RDFLabels; import org.topbraid.shacl.engine.AbstractEngine; import org.topbraid.shacl.engine.Shape; import org.topbraid.shacl.engine.ShapesGraph; import org.topbraid.shacl.expr.NodeExpression; import org.topbraid.shacl.expr.NodeExpressionFactory; import org.topbraid.shacl.util.OrderComparator; import org.topbraid.shacl.validation.ValidationEngine; import org.topbraid.shacl.validation.ValidationEngineFactory; import org.topbraid.shacl.vocabulary.DASH; import org.topbraid.shacl.vocabulary.SH; /** * A SHACL Rules engine with a pluggable architecture for different execution languages * including Triple rules, SPARQL rules and JavaScript rules. * * In preparation for inclusion into SHACL 1.1, this engine also supports sh:values rules, * see https://www.topquadrant.com/graphql/values.html and treats sh:defaultValues as inferences. * * @author Holger Knublauch */ public class RuleEngine extends AbstractEngine { // true to skip sh:values rules from property shapes marked with dash:neverMaterialize true private boolean excludeNeverMaterialize; // true to skip all sh:values rules private boolean excludeValues; private Model inferences; private Set<Triple> pending = new HashSet<>(); private Map<Rule,List<Resource>> rule2Conditions = new HashMap<>(); private Map<Shape,List<Rule>> shape2Rules = new HashMap<>(); public RuleEngine(Dataset dataset, URI shapesGraphURI, ShapesGraph shapesGraph, Model inferences) { super(dataset, shapesGraph, shapesGraphURI); this.inferences = inferences; } public void executeAll() throws InterruptedException { List<Shape> ruleShapes = new ArrayList<>(); for(Shape shape : shapesGraph.getRootShapes()) { if(shape.getShapeResource().hasProperty(SH.rule)) { ruleShapes.add(shape); } else { for(Resource ps : JenaUtil.getResourceProperties(shape.getShapeResource(), SH.property)) { if(ps.hasProperty(SH.values)) { ruleShapes.add(shape); break; } } } } executeShapes(ruleShapes, null); } public void executeAllDefaultValues() throws InterruptedException { // Add sh:defaultValues where applicable Model shapesModel = this.getShapesModel(); Set<Property> defaultValuePredicates = new HashSet<>(); shapesModel.listSubjectsWithProperty(SH.defaultValue).forEachRemaining(ps -> { Resource path = ps.getPropertyResourceValue(SH.path); if(path != null && path.isURIResource() && !ps.hasProperty(SH.deactivated, JenaDatatypes.TRUE)) { defaultValuePredicates.add(JenaUtil.asProperty(path)); } }); for(Property predicate : defaultValuePredicates) { Map<Node,NodeExpression> map = shapesGraph.getDefaultValueNodeExpressionsMap(predicate); for(Node shapeNode : map.keySet()) { Shape shape = shapesGraph.getShape(shapeNode); if(shape != null) { NodeExpression expr = map.get(shapeNode); List<RDFNode> targetNodes = new ArrayList<>(shape.getTargetNodes(getDataset())); for(RDFNode targetNode : targetNodes) { if(targetNode.isResource() && !targetNode.asResource().hasProperty(predicate)) { ExtendedIterator<RDFNode> it = expr.eval(targetNode, this); if(it.hasNext()) { List<RDFNode> list = it.toList(); for(RDFNode value : list) { inferences.add(targetNode.asResource(), predicate, value); } } } } } } } } /** * Executes the rules attached to a given list of shapes, either for a dedicated * focus node or all target nodes of the shapes. * @param ruleShapes the shapes to execute * @param focusNode the (optional) focus node or null for all target nodes * @throws InterruptedException if the monitor has canceled this */ public void executeShapes(List<Shape> ruleShapes, RDFNode focusNode) throws InterruptedException { if(ruleShapes.isEmpty()) { return; } Collections.sort(ruleShapes, new Comparator<Shape>() { @Override public int compare(Shape shape1, Shape shape2) { return shape1.getOrder().compareTo(shape2.getOrder()); } }); String baseMessage = null; if(monitor != null) { int rules = 0; for(Shape shape : ruleShapes) { rules += getShapeRules(shape).size(); } baseMessage = "Executing " + rules + " SHACL rules from " + ruleShapes.size() + " shapes"; monitor.beginTask(baseMessage, rules); } Double oldOrder = ruleShapes.get(0).getOrder(); for(Shape shape : ruleShapes) { if(!oldOrder.equals(shape.getOrder())) { oldOrder = shape.getOrder(); flushPending(); } executeShape(shape, baseMessage, focusNode); } flushPending(); } public void executeShape(Shape shape, String baseMessage, RDFNode focusNode) throws InterruptedException { if(shape.isDeactivated()) { return; } List<Rule> rules = getShapeRules(shape); if(rules.isEmpty()) { return; } List<RDFNode> targetNodes; if(focusNode != null) { targetNodes = Collections.singletonList(focusNode); } else { targetNodes = new ArrayList<>(shape.getTargetNodes(dataset)); } if(!targetNodes.isEmpty()) { Number oldOrder = rules.get(0).getOrder(); for(Rule rule : rules) { if(monitor != null) { if(monitor.isCanceled()) { throw new InterruptedException(); } monitor.setTaskName(baseMessage + " (at " + RDFLabels.get().getLabel(shape.getShapeResource()) + " with " + targetNodes.size() + " target nodes)"); monitor.subTask(rule.toString().replace("\n", " ")); } if(!oldOrder.equals(rule.getOrder())) { oldOrder = rule.getOrder(); // If new rdf:type triples have been inferred, recompute the target nodes (this is brute-force for now) boolean recomputeTarget = focusNode == null && pending.stream().anyMatch(triple -> RDF.type.asNode().equals(triple.getPredicate())); flushPending(); if(recomputeTarget) { targetNodes = new ArrayList<>(shape.getTargetNodes(dataset)); } } List<Resource> conditions = rule2Conditions.get(rule); if(conditions != null && !conditions.isEmpty()) { private List<Rule> getShapeRules(Shape shape) { return shape2Rules.computeIfAbsent(shape, s2 -> { List<Rule> rules = new LinkedList<>(); shape2Rules.put(shape, rules); List<Resource> raws = new LinkedList<>(); for(Statement s : shape.getShapeResource().listProperties(SH.rule).toList()) { if(s.getObject().isResource() && !s.getResource().hasProperty(SH.deactivated, JenaDatatypes.TRUE)) { executeRule(rule, filtered, shape); } else { executeRule(rule, targetNodes, shape); } if(monitor != null) { monitor.worked(1); } } } } private void executeRule(Rule rule, List<RDFNode> focusNodes, Shape shape) { JenaUtil.setGraphReadOptimization(true); try { if(ExecStatisticsManager.get().isRecording()) { long startTime = System.currentTimeMillis(); rule.execute(this, focusNodes, shape); long endTime = System.currentTimeMillis(); long duration = (endTime - startTime); String queryText = rule.toString(); ExecStatisticsManager.get().add(Collections.singletonList( new ExecStatistics(queryText, queryText, duration, startTime, rule.getContextNode()))); } else { rule.execute(this, focusNodes, shape); } } finally { JenaUtil.setGraphReadOptimization(false); } } private void flushPending() { for(Triple triple : pending) { inferences.add(inferences.asStatement(triple)); } pending.clear(); } private List<Rule> getShapeRules(Shape shape) { return shape2Rules.computeIfAbsent(shape, s2 -> { List<Rule> rules = new LinkedList<>(); List<Resource> raws = new LinkedList<>(); for(Statement s : shape.getShapeResource().listProperties(SH.rule).toList()) { if(s.getObject().isResource() && !s.getResource().hasProperty(SH.deactivated, JenaDatatypes.TRUE)) { raws.add(s.getResource()); } } Collections.sort(raws, OrderComparator.get()); for(Resource raw : raws) { RuleLanguage ruleLanguage = RuleLanguages.get().getRuleLanguage(raw); if(ruleLanguage == null) { throw new IllegalArgumentException("Unsupported SHACL rule type for " + raw); } Rule rule = ruleLanguage.createRule(raw); rules.add(rule); List<Resource> conditions = JenaUtil.getResourceProperties(raw, SH.condition); rule2Conditions.put(rule, conditions); } if(!excludeValues) { for(Resource ps : JenaUtil.getResourceProperties(shape.getShapeResource(), SH.property)) { if(!ps.hasProperty(SH.deactivated, JenaDatatypes.TRUE) && (!excludeNeverMaterialize || !ps.hasProperty(DASH.neverMaterialize, JenaDatatypes.TRUE))) { Resource path = ps.getPropertyResourceValue(SH.path); if(path != null && path.isURIResource()) { for(Statement s : ps.listProperties(SH.values).toList()) { NodeExpression expr = NodeExpressionFactory.get().create(s.getObject()); rules.add(new ValuesRule(expr, path.asNode(), false)); } } } } } return rules; }); } public Model getInferencesModel() { return inferences; } @Override public Model getShapesModel() { return dataset.getNamedModel(shapesGraphURI.toString()); } public void infer(Triple triple, Rule rule, Shape shape) { pending.add(triple); } private boolean nodeConformsToAllShapes(RDFNode focusNode, Iterable<Resource> shapes) { for(Resource shape : shapes) { ValidationEngine engine = ValidationEngineFactory.get().create(dataset, shapesGraphURI, shapesGraph, null); if(!engine.nodesConformToShape(Collections.singletonList(focusNode), shape.asNode())) { return false; } } return true; } /** * If set to true then all sh:values rules in property shapes marked with dash:neverMaterialize will be skipped. * @param value the new flag (defaults to false) */ public void setExcludeNeverMaterialize(boolean value) { this.excludeNeverMaterialize = value; } /** * If set to true then all sh:values rules will be skipped. * @param value the new flag (defaults to false) */ public void setExcludeValues(boolean value) { this.excludeValues = value; } @Override public void setProgressMonitor(ProgressMonitor value) { this.monitor = value; } } <MSG> Fixed a potential ConcurrentModificationException in RuleEngine, removed some legacy Jena code <DFF> @@ -224,7 +224,6 @@ public class RuleEngine extends AbstractEngine { private List<Rule> getShapeRules(Shape shape) { return shape2Rules.computeIfAbsent(shape, s2 -> { List<Rule> rules = new LinkedList<>(); - shape2Rules.put(shape, rules); List<Resource> raws = new LinkedList<>(); for(Statement s : shape.getShapeResource().listProperties(SH.rule).toList()) { if(s.getObject().isResource() && !s.getResource().hasProperty(SH.deactivated, JenaDatatypes.TRUE)) {
0
Fixed a potential ConcurrentModificationException in RuleEngine, removed some legacy Jena code
1
.java
java
apache-2.0
TopQuadrant/shacl
325
<NME> RuleEngine.java <BEF> /* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * See the NOTICE file distributed with this work for additional * information regarding copyright ownership. */ package org.topbraid.shacl.rules; import java.net.URI; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; import org.apache.jena.graph.Node; import org.apache.jena.graph.Triple; import org.apache.jena.query.Dataset; import org.apache.jena.rdf.model.Model; import org.apache.jena.rdf.model.Property; import org.apache.jena.rdf.model.RDFNode; import org.apache.jena.rdf.model.Resource; import org.apache.jena.rdf.model.Statement; import org.apache.jena.util.iterator.ExtendedIterator; import org.apache.jena.vocabulary.RDF; import org.topbraid.jenax.progress.ProgressMonitor; import org.topbraid.jenax.statistics.ExecStatistics; import org.topbraid.jenax.statistics.ExecStatisticsManager; import org.topbraid.jenax.util.JenaDatatypes; import org.topbraid.jenax.util.JenaUtil; import org.topbraid.jenax.util.RDFLabels; import org.topbraid.shacl.engine.AbstractEngine; import org.topbraid.shacl.engine.Shape; import org.topbraid.shacl.engine.ShapesGraph; import org.topbraid.shacl.expr.NodeExpression; import org.topbraid.shacl.expr.NodeExpressionFactory; import org.topbraid.shacl.util.OrderComparator; import org.topbraid.shacl.validation.ValidationEngine; import org.topbraid.shacl.validation.ValidationEngineFactory; import org.topbraid.shacl.vocabulary.DASH; import org.topbraid.shacl.vocabulary.SH; /** * A SHACL Rules engine with a pluggable architecture for different execution languages * including Triple rules, SPARQL rules and JavaScript rules. * * In preparation for inclusion into SHACL 1.1, this engine also supports sh:values rules, * see https://www.topquadrant.com/graphql/values.html and treats sh:defaultValues as inferences. * * @author Holger Knublauch */ public class RuleEngine extends AbstractEngine { // true to skip sh:values rules from property shapes marked with dash:neverMaterialize true private boolean excludeNeverMaterialize; // true to skip all sh:values rules private boolean excludeValues; private Model inferences; private Set<Triple> pending = new HashSet<>(); private Map<Rule,List<Resource>> rule2Conditions = new HashMap<>(); private Map<Shape,List<Rule>> shape2Rules = new HashMap<>(); public RuleEngine(Dataset dataset, URI shapesGraphURI, ShapesGraph shapesGraph, Model inferences) { super(dataset, shapesGraph, shapesGraphURI); this.inferences = inferences; } public void executeAll() throws InterruptedException { List<Shape> ruleShapes = new ArrayList<>(); for(Shape shape : shapesGraph.getRootShapes()) { if(shape.getShapeResource().hasProperty(SH.rule)) { ruleShapes.add(shape); } else { for(Resource ps : JenaUtil.getResourceProperties(shape.getShapeResource(), SH.property)) { if(ps.hasProperty(SH.values)) { ruleShapes.add(shape); break; } } } } executeShapes(ruleShapes, null); } public void executeAllDefaultValues() throws InterruptedException { // Add sh:defaultValues where applicable Model shapesModel = this.getShapesModel(); Set<Property> defaultValuePredicates = new HashSet<>(); shapesModel.listSubjectsWithProperty(SH.defaultValue).forEachRemaining(ps -> { Resource path = ps.getPropertyResourceValue(SH.path); if(path != null && path.isURIResource() && !ps.hasProperty(SH.deactivated, JenaDatatypes.TRUE)) { defaultValuePredicates.add(JenaUtil.asProperty(path)); } }); for(Property predicate : defaultValuePredicates) { Map<Node,NodeExpression> map = shapesGraph.getDefaultValueNodeExpressionsMap(predicate); for(Node shapeNode : map.keySet()) { Shape shape = shapesGraph.getShape(shapeNode); if(shape != null) { NodeExpression expr = map.get(shapeNode); List<RDFNode> targetNodes = new ArrayList<>(shape.getTargetNodes(getDataset())); for(RDFNode targetNode : targetNodes) { if(targetNode.isResource() && !targetNode.asResource().hasProperty(predicate)) { ExtendedIterator<RDFNode> it = expr.eval(targetNode, this); if(it.hasNext()) { List<RDFNode> list = it.toList(); for(RDFNode value : list) { inferences.add(targetNode.asResource(), predicate, value); } } } } } } } } /** * Executes the rules attached to a given list of shapes, either for a dedicated * focus node or all target nodes of the shapes. * @param ruleShapes the shapes to execute * @param focusNode the (optional) focus node or null for all target nodes * @throws InterruptedException if the monitor has canceled this */ public void executeShapes(List<Shape> ruleShapes, RDFNode focusNode) throws InterruptedException { if(ruleShapes.isEmpty()) { return; } Collections.sort(ruleShapes, new Comparator<Shape>() { @Override public int compare(Shape shape1, Shape shape2) { return shape1.getOrder().compareTo(shape2.getOrder()); } }); String baseMessage = null; if(monitor != null) { int rules = 0; for(Shape shape : ruleShapes) { rules += getShapeRules(shape).size(); } baseMessage = "Executing " + rules + " SHACL rules from " + ruleShapes.size() + " shapes"; monitor.beginTask(baseMessage, rules); } Double oldOrder = ruleShapes.get(0).getOrder(); for(Shape shape : ruleShapes) { if(!oldOrder.equals(shape.getOrder())) { oldOrder = shape.getOrder(); flushPending(); } executeShape(shape, baseMessage, focusNode); } flushPending(); } public void executeShape(Shape shape, String baseMessage, RDFNode focusNode) throws InterruptedException { if(shape.isDeactivated()) { return; } List<Rule> rules = getShapeRules(shape); if(rules.isEmpty()) { return; } List<RDFNode> targetNodes; if(focusNode != null) { targetNodes = Collections.singletonList(focusNode); } else { targetNodes = new ArrayList<>(shape.getTargetNodes(dataset)); } if(!targetNodes.isEmpty()) { Number oldOrder = rules.get(0).getOrder(); for(Rule rule : rules) { if(monitor != null) { if(monitor.isCanceled()) { throw new InterruptedException(); } monitor.setTaskName(baseMessage + " (at " + RDFLabels.get().getLabel(shape.getShapeResource()) + " with " + targetNodes.size() + " target nodes)"); monitor.subTask(rule.toString().replace("\n", " ")); } if(!oldOrder.equals(rule.getOrder())) { oldOrder = rule.getOrder(); // If new rdf:type triples have been inferred, recompute the target nodes (this is brute-force for now) boolean recomputeTarget = focusNode == null && pending.stream().anyMatch(triple -> RDF.type.asNode().equals(triple.getPredicate())); flushPending(); if(recomputeTarget) { targetNodes = new ArrayList<>(shape.getTargetNodes(dataset)); } } List<Resource> conditions = rule2Conditions.get(rule); if(conditions != null && !conditions.isEmpty()) { private List<Rule> getShapeRules(Shape shape) { return shape2Rules.computeIfAbsent(shape, s2 -> { List<Rule> rules = new LinkedList<>(); shape2Rules.put(shape, rules); List<Resource> raws = new LinkedList<>(); for(Statement s : shape.getShapeResource().listProperties(SH.rule).toList()) { if(s.getObject().isResource() && !s.getResource().hasProperty(SH.deactivated, JenaDatatypes.TRUE)) { executeRule(rule, filtered, shape); } else { executeRule(rule, targetNodes, shape); } if(monitor != null) { monitor.worked(1); } } } } private void executeRule(Rule rule, List<RDFNode> focusNodes, Shape shape) { JenaUtil.setGraphReadOptimization(true); try { if(ExecStatisticsManager.get().isRecording()) { long startTime = System.currentTimeMillis(); rule.execute(this, focusNodes, shape); long endTime = System.currentTimeMillis(); long duration = (endTime - startTime); String queryText = rule.toString(); ExecStatisticsManager.get().add(Collections.singletonList( new ExecStatistics(queryText, queryText, duration, startTime, rule.getContextNode()))); } else { rule.execute(this, focusNodes, shape); } } finally { JenaUtil.setGraphReadOptimization(false); } } private void flushPending() { for(Triple triple : pending) { inferences.add(inferences.asStatement(triple)); } pending.clear(); } private List<Rule> getShapeRules(Shape shape) { return shape2Rules.computeIfAbsent(shape, s2 -> { List<Rule> rules = new LinkedList<>(); List<Resource> raws = new LinkedList<>(); for(Statement s : shape.getShapeResource().listProperties(SH.rule).toList()) { if(s.getObject().isResource() && !s.getResource().hasProperty(SH.deactivated, JenaDatatypes.TRUE)) { raws.add(s.getResource()); } } Collections.sort(raws, OrderComparator.get()); for(Resource raw : raws) { RuleLanguage ruleLanguage = RuleLanguages.get().getRuleLanguage(raw); if(ruleLanguage == null) { throw new IllegalArgumentException("Unsupported SHACL rule type for " + raw); } Rule rule = ruleLanguage.createRule(raw); rules.add(rule); List<Resource> conditions = JenaUtil.getResourceProperties(raw, SH.condition); rule2Conditions.put(rule, conditions); } if(!excludeValues) { for(Resource ps : JenaUtil.getResourceProperties(shape.getShapeResource(), SH.property)) { if(!ps.hasProperty(SH.deactivated, JenaDatatypes.TRUE) && (!excludeNeverMaterialize || !ps.hasProperty(DASH.neverMaterialize, JenaDatatypes.TRUE))) { Resource path = ps.getPropertyResourceValue(SH.path); if(path != null && path.isURIResource()) { for(Statement s : ps.listProperties(SH.values).toList()) { NodeExpression expr = NodeExpressionFactory.get().create(s.getObject()); rules.add(new ValuesRule(expr, path.asNode(), false)); } } } } } return rules; }); } public Model getInferencesModel() { return inferences; } @Override public Model getShapesModel() { return dataset.getNamedModel(shapesGraphURI.toString()); } public void infer(Triple triple, Rule rule, Shape shape) { pending.add(triple); } private boolean nodeConformsToAllShapes(RDFNode focusNode, Iterable<Resource> shapes) { for(Resource shape : shapes) { ValidationEngine engine = ValidationEngineFactory.get().create(dataset, shapesGraphURI, shapesGraph, null); if(!engine.nodesConformToShape(Collections.singletonList(focusNode), shape.asNode())) { return false; } } return true; } /** * If set to true then all sh:values rules in property shapes marked with dash:neverMaterialize will be skipped. * @param value the new flag (defaults to false) */ public void setExcludeNeverMaterialize(boolean value) { this.excludeNeverMaterialize = value; } /** * If set to true then all sh:values rules will be skipped. * @param value the new flag (defaults to false) */ public void setExcludeValues(boolean value) { this.excludeValues = value; } @Override public void setProgressMonitor(ProgressMonitor value) { this.monitor = value; } } <MSG> Fixed a potential ConcurrentModificationException in RuleEngine, removed some legacy Jena code <DFF> @@ -224,7 +224,6 @@ public class RuleEngine extends AbstractEngine { private List<Rule> getShapeRules(Shape shape) { return shape2Rules.computeIfAbsent(shape, s2 -> { List<Rule> rules = new LinkedList<>(); - shape2Rules.put(shape, rules); List<Resource> raws = new LinkedList<>(); for(Statement s : shape.getShapeResource().listProperties(SH.rule).toList()) { if(s.getObject().isResource() && !s.getResource().hasProperty(SH.deactivated, JenaDatatypes.TRUE)) {
0
Fixed a potential ConcurrentModificationException in RuleEngine, removed some legacy Jena code
1
.java
java
apache-2.0
TopQuadrant/shacl
326
<NME> README.md <BEF> # TopBraid SHACL API **An open source implementation of the W3C Shapes Constraint Language (SHACL) based on Apache Jena.** Contact: Holger Knublauch ([email protected]) Can be used to perform SHACL constraint checking and rule inferencing in any Jena-based Java application. This API also serves as a reference implementation of the SHACL spec. Coverage: * [SHACL Core and SHACL-SPARQL validation](https://www.w3.org/TR/shacl/) * [SHACL Advanced Features (Rules etc)](https://www.w3.org/TR/shacl-af/) * [SHACL JavaScript Extensions](https://www.w3.org/TR/shacl-js/) * [SHACL Compact Syntax](https://w3c.github.io/shacl/shacl-compact-syntax/) See [SHACL-JS](https://github.com/TopQuadrant/shacl-js) for a pure JavaScript implementation. The same code is used in the TopBraid products (currently aligned with the TopBraid 6.3 release). The TopBraid SHACL API is internally used by the European Commission's generic [SHACL-based RDF validator](https://www.itb.ec.europa.eu/shacl/any/upload) (used to validate RDF content against SHACL shapes) and [SHACL shape validator](https://www.itb.ec.europa.eu/shacl/shacl/upload) (used to validate SHACL shapes themselves). The same code is used in the TopBraid products (currently aligned with the TopBraid 7.1 release). Feedback and questions should become GitHub issues or sent to TopBraid Users mailing list: https://groups.google.com/forum/#!forum/topbraid-users Please prefix your messages with [SHACL API] To get started, look at the class ValidationUtil in the package org.topbraid.shacl.validation. There is also an [Example Test Case](../master/src/test/java/org/topbraid/shacl/ValidationExample.java) ## Application dependency Releases are available in the central maven repository: ``` <dependency> <groupId>org.topbraid</groupId> <artifactId>shacl</artifactId> <version>*VER*</version> </dependency> ``` ## Command Line Usage Download the latest release from: `https://repo1.maven.org/maven2/org/topbraid/shacl/` The binary distribution is: `https://repo1.maven.org/maven2/org/topbraid/shacl/*VER*/shacl-*VER*-bin.zip`. Two command line utilities are included: shaclvalidate (performs constraint validation) and shaclinfer (performs SHACL rule inferencing). To use them, set up your environment similar to https://jena.apache.org/documentation/tools/ (note that the SHACL download includes Jena). For example, on Windows: ``` SET SHACLROOT=C:\Users\Holger\Desktop\shacl-1.4.1-bin SET PATH=%PATH%;%SHACLROOT%\bin ``` As another example, for Linux, add to .bashrc these lines: ``` # for shacl export SHACLROOT=/home/holger/shacl/shacl-1.4.1-bin/shacl-1.4.1/bin export PATH=$SHACLROOT:$PATH ``` Both tools take the following parameters, for example: `shaclvalidate.bat -datafile myfile.ttl -shapesfile myshapes.ttl` where `-shapesfile` is optional and falls back to using the data graph as shapes graph. Add -validateShapes in case you want to include the metashapes (from the tosh namespace in particular). Currently only Turtle (.ttl) files are supported. The tools print the validation report or the inferences graph to the output screen. <MSG> Update README.md Added link to external validator <DFF> @@ -13,7 +13,7 @@ Coverage: * [SHACL JavaScript Extensions](https://www.w3.org/TR/shacl-js/) * [SHACL Compact Syntax](https://w3c.github.io/shacl/shacl-compact-syntax/) -See [SHACL-JS](https://github.com/TopQuadrant/shacl-js) for a pure JavaScript implementation. +This [Online SHACL Shape Validator](https://www.itb.ec.europa.eu/shacl/shacl/upload) uses the TopBraid SHACL API internally. The same code is used in the TopBraid products (currently aligned with the TopBraid 6.3 release).
1
Update README.md
1
.md
md
apache-2.0
TopQuadrant/shacl
327
<NME> README.md <BEF> # TopBraid SHACL API **An open source implementation of the W3C Shapes Constraint Language (SHACL) based on Apache Jena.** Contact: Holger Knublauch ([email protected]) Can be used to perform SHACL constraint checking and rule inferencing in any Jena-based Java application. This API also serves as a reference implementation of the SHACL spec. Coverage: * [SHACL Core and SHACL-SPARQL validation](https://www.w3.org/TR/shacl/) * [SHACL Advanced Features (Rules etc)](https://www.w3.org/TR/shacl-af/) * [SHACL JavaScript Extensions](https://www.w3.org/TR/shacl-js/) * [SHACL Compact Syntax](https://w3c.github.io/shacl/shacl-compact-syntax/) See [SHACL-JS](https://github.com/TopQuadrant/shacl-js) for a pure JavaScript implementation. The same code is used in the TopBraid products (currently aligned with the TopBraid 6.3 release). The TopBraid SHACL API is internally used by the European Commission's generic [SHACL-based RDF validator](https://www.itb.ec.europa.eu/shacl/any/upload) (used to validate RDF content against SHACL shapes) and [SHACL shape validator](https://www.itb.ec.europa.eu/shacl/shacl/upload) (used to validate SHACL shapes themselves). The same code is used in the TopBraid products (currently aligned with the TopBraid 7.1 release). Feedback and questions should become GitHub issues or sent to TopBraid Users mailing list: https://groups.google.com/forum/#!forum/topbraid-users Please prefix your messages with [SHACL API] To get started, look at the class ValidationUtil in the package org.topbraid.shacl.validation. There is also an [Example Test Case](../master/src/test/java/org/topbraid/shacl/ValidationExample.java) ## Application dependency Releases are available in the central maven repository: ``` <dependency> <groupId>org.topbraid</groupId> <artifactId>shacl</artifactId> <version>*VER*</version> </dependency> ``` ## Command Line Usage Download the latest release from: `https://repo1.maven.org/maven2/org/topbraid/shacl/` The binary distribution is: `https://repo1.maven.org/maven2/org/topbraid/shacl/*VER*/shacl-*VER*-bin.zip`. Two command line utilities are included: shaclvalidate (performs constraint validation) and shaclinfer (performs SHACL rule inferencing). To use them, set up your environment similar to https://jena.apache.org/documentation/tools/ (note that the SHACL download includes Jena). For example, on Windows: ``` SET SHACLROOT=C:\Users\Holger\Desktop\shacl-1.4.1-bin SET PATH=%PATH%;%SHACLROOT%\bin ``` As another example, for Linux, add to .bashrc these lines: ``` # for shacl export SHACLROOT=/home/holger/shacl/shacl-1.4.1-bin/shacl-1.4.1/bin export PATH=$SHACLROOT:$PATH ``` Both tools take the following parameters, for example: `shaclvalidate.bat -datafile myfile.ttl -shapesfile myshapes.ttl` where `-shapesfile` is optional and falls back to using the data graph as shapes graph. Add -validateShapes in case you want to include the metashapes (from the tosh namespace in particular). Currently only Turtle (.ttl) files are supported. The tools print the validation report or the inferences graph to the output screen. <MSG> Update README.md Added link to external validator <DFF> @@ -13,7 +13,7 @@ Coverage: * [SHACL JavaScript Extensions](https://www.w3.org/TR/shacl-js/) * [SHACL Compact Syntax](https://w3c.github.io/shacl/shacl-compact-syntax/) -See [SHACL-JS](https://github.com/TopQuadrant/shacl-js) for a pure JavaScript implementation. +This [Online SHACL Shape Validator](https://www.itb.ec.europa.eu/shacl/shacl/upload) uses the TopBraid SHACL API internally. The same code is used in the TopBraid products (currently aligned with the TopBraid 6.3 release).
1
Update README.md
1
.md
md
apache-2.0
TopQuadrant/shacl
328
<NME> SH.java <BEF> /* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * See the NOTICE file distributed with this work for additional * information regarding copyright ownership. */ package org.topbraid.shacl.vocabulary; import org.apache.jena.rdf.model.Property; import org.apache.jena.rdf.model.Resource; import org.apache.jena.rdf.model.ResourceFactory; import org.apache.jena.sparql.core.Var; /** * Vocabulary for http://www.w3.org/ns/shacl# * * @author Holger Knublauch */ public class SH { public final static String BASE_URI = "http://www.w3.org/ns/shacl#"; public final static String NAME = "SHACL"; public final static String NS = BASE_URI; public final static String PREFIX = "sh"; public final static Resource AbstractResult = ResourceFactory.createResource(NS + "AbstractResult"); public final static Resource AndConstraintComponent = ResourceFactory.createResource(NS + "AndConstraintComponent"); public final static Resource BlankNode = ResourceFactory.createResource(NS + "BlankNode"); public final static Resource BlankNodeOrIRI = ResourceFactory.createResource(NS + "BlankNodeOrIRI"); public final static Resource BlankNodeOrLiteral = ResourceFactory.createResource(NS + "BlankNodeOrLiteral"); public final static Resource ClassConstraintComponent = ResourceFactory.createResource(NS + "ClassConstraintComponent"); public final static Resource ClosedConstraintComponent = ResourceFactory.createResource(NS + "ClosedConstraintComponent"); public final static Resource Constraint = ResourceFactory.createResource(NS + "Constraint"); public final static Resource ConstraintComponent = ResourceFactory.createResource(NS + "ConstraintComponent"); public final static Resource DatatypeConstraintComponent = ResourceFactory.createResource(NS + "DatatypeConstraintComponent"); public final static Resource DisjointConstraintComponent = ResourceFactory.createResource(NS + "DisjointConstraintComponent"); public final static Resource EqualsConstraintComponent = ResourceFactory.createResource(NS + "EqualsConstraintComponent"); public final static Resource HasValueConstraintComponent = ResourceFactory.createResource(NS + "HasValueConstraintComponent"); public final static Resource InConstraintComponent = ResourceFactory.createResource(NS + "InConstraintComponent"); public final static Resource Info = ResourceFactory.createResource(NS + "Info"); public final static Resource IRI = ResourceFactory.createResource(NS + "IRI"); public final static Resource IRIOrLiteral = ResourceFactory.createResource(NS + "IRIOrLiteral"); public final static Resource LanguageInConstraintComponent = ResourceFactory.createResource(NS + "LanguageInConstraintComponent"); public final static Resource LessThanConstraintComponent = ResourceFactory.createResource(NS + "LessThanConstraintComponent"); public final static Resource LessThanOrEqualsConstraintComponent = ResourceFactory.createResource(NS + "LessThanOrEqualsConstraintComponent"); public final static Resource Literal = ResourceFactory.createResource(NS + "Literal"); public final static Resource PrefixDeclaration = ResourceFactory.createResource(NS + "PrefixDeclaration"); public final static Resource PropertyShape = ResourceFactory.createResource(NS + "PropertyShape"); public final static Resource PropertyConstraintComponent = ResourceFactory.createResource(NS + "PropertyConstraintComponent"); public final static Resource MinCountConstraintComponent = ResourceFactory.createResource(NS + "MinCountConstraintComponent"); public final static Resource MinExclusiveConstraintComponent = ResourceFactory.createResource(NS + "MinExclusiveConstraintComponent"); public final static Resource MinInclusiveConstraintComponent = ResourceFactory.createResource(NS + "MinInclusiveConstraintComponent"); public final static Resource MinLengthConstraintComponent = ResourceFactory.createResource(NS + "MinLengthConstraintComponent"); public final static Resource NodeConstraintComponent = ResourceFactory.createResource(NS + "NodeConstraintComponent"); public final static Resource NodeKindConstraintComponent = ResourceFactory.createResource(NS + "NodeKindConstraintComponent"); public final static Resource NodeShape = ResourceFactory.createResource(NS + "NodeShape"); public final static Resource NotConstraintComponent = ResourceFactory.createResource(NS + "NotConstraintComponent"); public final static Resource OrConstraintComponent = ResourceFactory.createResource(NS + "OrConstraintComponent"); public final static Resource Parameter = ResourceFactory.createResource(NS + "Parameter"); public final static Resource Parameterizable = ResourceFactory.createResource(NS + "Parameterizable"); public final static Resource PatternConstraintComponent = ResourceFactory.createResource(NS + "PatternConstraintComponent"); public final static Resource PrefixDeclaration = ResourceFactory.createResource(NS + "PrefixDeclaration"); public final static Resource PropertyGroup = ResourceFactory.createResource(NS + "PropertyGroup"); public final static Resource PropertyShape = ResourceFactory.createResource(NS + "PropertyShape"); public final static Resource PropertyConstraintComponent = ResourceFactory.createResource(NS + "PropertyConstraintComponent"); public final static Resource QualifiedMaxCountConstraintComponent = ResourceFactory.createResource(NS + "QualifiedMaxCountConstraintComponent"); public final static Resource QualifiedMinCountConstraintComponent = ResourceFactory.createResource(NS + "QualifiedMinCountConstraintComponent"); public final static Resource ResultAnnotation = ResourceFactory.createResource(NS + "ResultAnnotation"); public final static Resource Shape = ResourceFactory.createResource(NS + "Shape"); public final static Resource SPARQLAskValidator = ResourceFactory.createResource(NS + "SPARQLAskValidator"); public final static Resource SPARQLConstraint = ResourceFactory.createResource(NS + "SPARQLConstraint"); public final static Resource SPARQLConstraintComponent = ResourceFactory.createResource(NS + "SPARQLConstraintComponent"); public final static Resource SPARQLConstructRule = ResourceFactory.createResource(NS + "SPARQLConstructRule"); public final static Resource SPARQLExecutable = ResourceFactory.createResource(NS + "SPARQLExecutable"); public final static Resource SPARQLFunction = ResourceFactory.createResource(NS + "SPARQLFunction"); public final static Resource SPARQLSelectValidator = ResourceFactory.createResource(NS + "SPARQLSelectValidator"); public final static Resource SPARQLTarget = ResourceFactory.createResource(NS + "SPARQLTarget"); public final static Resource SPARQLValuesDeriver = ResourceFactory.createResource(NS + "SPARQLValuesDeriver"); public final static Resource UniqueLangConstraintComponent = ResourceFactory.createResource(NS + "UniqueLangConstraintComponent"); public final static Resource ValidationReport = ResourceFactory.createResource(NS + "ValidationReport"); public final static Resource ValidationResult = ResourceFactory.createResource(NS + "ValidationResult"); public final static Resource Validator = ResourceFactory.createResource(NS + "Validator"); public final static Resource Violation = ResourceFactory.createResource(NS + "Violation"); public final static Resource Warning = ResourceFactory.createResource(NS + "Warning"); public final static Resource XoneConstraintComponent = ResourceFactory.createResource(NS + "XoneConstraintComponent"); public final static Property alternativePath = ResourceFactory.createProperty(NS + "alternativePath"); public final static Property and = ResourceFactory.createProperty(NS + "and"); public final static Property ask = ResourceFactory.createProperty(NS + "ask"); public final static Property class_ = ResourceFactory.createProperty(NS + "class"); public final static Property closed = ResourceFactory.createProperty(NS + "closed"); public final static Property condition = ResourceFactory.createProperty(NS + "condition"); public final static Property conforms = ResourceFactory.createProperty(NS + "conforms"); public final static Property construct = ResourceFactory.createProperty(NS + "construct"); public final static Property datatype = ResourceFactory.createProperty(NS + "datatype"); public final static Property deactivated = ResourceFactory.createProperty(NS + "deactivated"); public final static Property declare = ResourceFactory.createProperty(NS + "declare"); public final static Property defaultValue = ResourceFactory.createProperty(NS + "defaultValue"); public final static Property detail = ResourceFactory.createProperty(NS + "detail"); public final static Property description = ResourceFactory.createProperty(NS + "description"); public final static Property disjoint = ResourceFactory.createProperty(NS + "disjoint"); public final static Property entailment = ResourceFactory.createProperty(NS + "entailment"); public final static Property equals = ResourceFactory.createProperty(NS + "equals"); public final static Property flags = ResourceFactory.createProperty(NS + "flags"); public final static Property focusNode = ResourceFactory.createProperty(NS + "focusNode"); public final static Property group = ResourceFactory.createProperty(NS + "group"); public final static Property hasValue = ResourceFactory.createProperty(NS + "hasValue"); public final static Property ignoredProperties = ResourceFactory.createProperty(NS + "ignoredProperties"); public final static Property in = ResourceFactory.createProperty(NS + "in"); public final static Property inversePath = ResourceFactory.createProperty(NS + "inversePath"); public final static Property labelTemplate = ResourceFactory.createProperty(NS + "labelTemplate"); public final static Property languageIn = ResourceFactory.createProperty(NS + "languageIn"); public final static Property lessThan = ResourceFactory.createProperty(NS + "lessThan"); public final static Property lessThanOrEquals = ResourceFactory.createProperty(NS + "lessThanOrEquals"); public final static Property maxCount = ResourceFactory.createProperty(NS + "maxCount"); public final static Property maxExclusive = ResourceFactory.createProperty(NS + "maxExclusive"); public final static Property maxInclusive = ResourceFactory.createProperty(NS + "maxInclusive"); public final static Property maxLength = ResourceFactory.createProperty(NS + "maxLength"); public final static Property message = ResourceFactory.createProperty(NS + "message"); public final static Property minCount = ResourceFactory.createProperty(NS + "minCount"); public final static Property minExclusive = ResourceFactory.createProperty(NS + "minExclusive"); public final static Property minInclusive = ResourceFactory.createProperty(NS + "minInclusive"); public final static Property minLength = ResourceFactory.createProperty(NS + "minLength"); public final static Property name = ResourceFactory.createProperty(NS + "name"); public final static Property namespace = ResourceFactory.createProperty(NS + "namespace"); public final static Property node = ResourceFactory.createProperty(NS + "node"); public final static Property nodeKind = ResourceFactory.createProperty(NS + "nodeKind"); public final static Property nodeValidator = ResourceFactory.createProperty(NS + "nodeValidator"); public final static Property not = ResourceFactory.createProperty(NS + "not"); public final static Property oneOrMorePath = ResourceFactory.createProperty(NS + "oneOrMorePath"); public final static Property optional = ResourceFactory.createProperty(NS + "optional"); public final static Property or = ResourceFactory.createProperty(NS + "or"); public final static Property order = ResourceFactory.createProperty(NS + "order"); public final static Property parameter = ResourceFactory.createProperty(NS + "parameter"); public final static Property path = ResourceFactory.createProperty(NS + "path"); public final static Property pattern = ResourceFactory.createProperty(NS + "pattern"); public final static Property prefix = ResourceFactory.createProperty(NS + "prefix"); public final static Property prefixes = ResourceFactory.createProperty(NS + "prefixes"); public final static Property property = ResourceFactory.createProperty(NS + "property"); public final static Property propertyValidator = ResourceFactory.createProperty(NS + "propertyValidator"); public final static Property qualifiedMaxCount = ResourceFactory.createProperty(NS + "qualifiedMaxCount"); public final static Property qualifiedMinCount = ResourceFactory.createProperty(NS + "qualifiedMinCount"); public final static Property qualifiedValueShape = ResourceFactory.createProperty(NS + "qualifiedValueShape"); public final static Property qualifiedValueShapesDisjoint = ResourceFactory.createProperty(NS + "qualifiedValueShapesDisjoint"); public final static Property result = ResourceFactory.createProperty(NS + "result"); public final static Property resultMessage = ResourceFactory.createProperty(NS + "resultMessage"); public final static Property resultPath = ResourceFactory.createProperty(NS + "resultPath"); public final static Property resultSeverity = ResourceFactory.createProperty(NS + "resultSeverity"); public final static Property select = ResourceFactory.createProperty(NS + "select"); public final static Property severity = ResourceFactory.createProperty(NS + "severity"); public final static Property shapesGraph = ResourceFactory.createProperty(NS + "shapesGraph"); public final static Property sourceConstraint = ResourceFactory.createProperty(NS + "sourceConstraint"); public final static Property sourceConstraintComponent = ResourceFactory.createProperty(NS + "sourceConstraintComponent"); public final static Property sourceShape = ResourceFactory.createProperty(NS + "sourceShape"); public final static Property sparql = ResourceFactory.createProperty(NS + "sparql"); public final static Property targetClass = ResourceFactory.createProperty(NS + "targetClass"); public final static Property targetNode = ResourceFactory.createProperty(NS + "targetNode"); public final static Property targetObjectsOf = ResourceFactory.createProperty(NS + "targetObjectsOf"); public final static Property targetSubjectsOf = ResourceFactory.createProperty(NS + "targetSubjectsOf"); public final static Property uniqueLang = ResourceFactory.createProperty(NS + "uniqueLang"); public final static Property update = ResourceFactory.createProperty(NS + "update"); public final static Property validator = ResourceFactory.createProperty(NS + "validator"); public final static Property value = ResourceFactory.createProperty(NS + "value"); public final static Property zeroOrMorePath = ResourceFactory.createProperty(NS + "zeroOrMorePath"); public final static Property zeroOrOnePath = ResourceFactory.createProperty(NS + "zeroOrOnePath"); // Advanced features public final static Resource ExpressionConstraintComponent = ResourceFactory.createResource(NS + "ExpressionConstraintComponent"); public final static Resource Function = ResourceFactory.createResource(NS + "Function"); public final static Resource JSConstraint = ResourceFactory.createResource(NS + "JSConstraint"); public final static Resource JSConstraintComponent = ResourceFactory.createResource(NS + "JSConstraintComponent"); public final static Resource JSExecutable = ResourceFactory.createResource(NS + "JSExecutable"); public final static Resource JSFunction = ResourceFactory.createResource(NS + "JSFunction"); public final static Resource JSLibrary = ResourceFactory.createResource(NS + "JSLibrary"); public final static Resource JSRule = ResourceFactory.createResource(NS + "JSRule"); public final static Resource JSTarget = ResourceFactory.createResource(NS + "JSTarget"); public final static Resource JSTargetType = ResourceFactory.createResource(NS + "JSTargetType"); public final static Resource JSValidator = ResourceFactory.createResource(NS + "JSValidator"); public final static Resource Rule = ResourceFactory.createResource(NS + "Rule"); public final static Resource Rules = ResourceFactory.createResource(NS + "Rules"); public final static Resource SPARQLRule = ResourceFactory.createResource(NS + "SPARQLRule"); public final static Resource Target = ResourceFactory.createResource(NS + "Target"); public final static Resource this_ = ResourceFactory.createResource(NS + "this"); public final static Resource TripleRule = ResourceFactory.createResource(NS + "TripleRule"); public final static Property expression = ResourceFactory.createProperty(NS + "expression"); public final static Property filterShape = ResourceFactory.createProperty(NS + "filterShape"); public final static Property intersection = ResourceFactory.createProperty(NS + "intersection"); public final static Property js = ResourceFactory.createProperty(NS + "js"); public final static Property jsFunctionName = ResourceFactory.createProperty(NS + "jsFunctionName"); public final static Property jsLibrary = ResourceFactory.createProperty(NS + "jsLibrary"); public final static Property jsLibraryURL = ResourceFactory.createProperty(NS + "jsLibraryURL"); public final static Property member = ResourceFactory.createProperty(NS + "member"); public final static Property nodes = ResourceFactory.createProperty(NS + "nodes"); public final static Property object = ResourceFactory.createProperty(NS + "object"); public final static Property predicate = ResourceFactory.createProperty(NS + "predicate"); public final static Property returnType = ResourceFactory.createProperty(NS + "returnType"); public final static Property rule = ResourceFactory.createProperty(NS + "rule"); public final static Property subject = ResourceFactory.createProperty(NS + "subject"); public final static Property target = ResourceFactory.createProperty(NS + "target"); public final static Property union = ResourceFactory.createProperty(NS + "union"); // Features not in SHACL 1.0 but candidates for next release public final static Property count = ResourceFactory.createProperty(NS + "count"); public final static Property desc = ResourceFactory.createProperty(NS + "desc"); public final static Property distinct = ResourceFactory.createProperty(NS + "distinct"); public final static Property else_ = ResourceFactory.createProperty(NS + "else"); public final static Property exists = ResourceFactory.createProperty(NS + "exists"); public final static Property groupConcat = ResourceFactory.createProperty(NS + "groupConcat"); public final static Property if_ = ResourceFactory.createProperty(NS + "if"); public final static Property limit = ResourceFactory.createProperty(NS + "limit"); public final static Property max = ResourceFactory.createProperty(NS + "max"); public final static Property min = ResourceFactory.createProperty(NS + "min"); public final static Property minus = ResourceFactory.createProperty(NS + "minus"); public final static Property offset = ResourceFactory.createProperty(NS + "offset"); public final static Property orderBy = ResourceFactory.createProperty(NS + "orderBy"); public final static Property separator = ResourceFactory.createProperty(NS + "separator"); public final static Property sum = ResourceFactory.createProperty(NS + "sum"); public final static Property then = ResourceFactory.createProperty(NS + "then"); public final static Property values = ResourceFactory.createProperty(NS + "values"); public static final Var currentShapeVar = Var.alloc("currentShape"); public static final Var failureVar = Var.alloc("failure"); public static final Var PATHVar = Var.alloc("PATH"); public static final Var pathVar = Var.alloc(path.getLocalName()); public static final Var shapesGraphVar = Var.alloc("shapesGraph"); public static final Var thisVar = Var.alloc("this"); public static final Var valueVar = Var.alloc("value"); public final static String JS_DATA_VAR = "$data"; public final static String JS_SHAPES_VAR = "$shapes"; public static String getURI() { return NS; } } <MSG> RuleUtil now also applies entailments (and other updates) (#35) <DFF> @@ -81,6 +81,8 @@ public class SH { public final static Resource PrefixDeclaration = ResourceFactory.createResource(NS + "PrefixDeclaration"); + public final static Resource PropertyGroup = ResourceFactory.createResource(NS + "PropertyGroup"); + public final static Resource PropertyShape = ResourceFactory.createResource(NS + "PropertyShape"); public final static Resource PropertyConstraintComponent = ResourceFactory.createResource(NS + "PropertyConstraintComponent");
2
RuleUtil now also applies entailments (and other updates) (#35)
0
.java
java
apache-2.0
TopQuadrant/shacl
329
<NME> SH.java <BEF> /* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * See the NOTICE file distributed with this work for additional * information regarding copyright ownership. */ package org.topbraid.shacl.vocabulary; import org.apache.jena.rdf.model.Property; import org.apache.jena.rdf.model.Resource; import org.apache.jena.rdf.model.ResourceFactory; import org.apache.jena.sparql.core.Var; /** * Vocabulary for http://www.w3.org/ns/shacl# * * @author Holger Knublauch */ public class SH { public final static String BASE_URI = "http://www.w3.org/ns/shacl#"; public final static String NAME = "SHACL"; public final static String NS = BASE_URI; public final static String PREFIX = "sh"; public final static Resource AbstractResult = ResourceFactory.createResource(NS + "AbstractResult"); public final static Resource AndConstraintComponent = ResourceFactory.createResource(NS + "AndConstraintComponent"); public final static Resource BlankNode = ResourceFactory.createResource(NS + "BlankNode"); public final static Resource BlankNodeOrIRI = ResourceFactory.createResource(NS + "BlankNodeOrIRI"); public final static Resource BlankNodeOrLiteral = ResourceFactory.createResource(NS + "BlankNodeOrLiteral"); public final static Resource ClassConstraintComponent = ResourceFactory.createResource(NS + "ClassConstraintComponent"); public final static Resource ClosedConstraintComponent = ResourceFactory.createResource(NS + "ClosedConstraintComponent"); public final static Resource Constraint = ResourceFactory.createResource(NS + "Constraint"); public final static Resource ConstraintComponent = ResourceFactory.createResource(NS + "ConstraintComponent"); public final static Resource DatatypeConstraintComponent = ResourceFactory.createResource(NS + "DatatypeConstraintComponent"); public final static Resource DisjointConstraintComponent = ResourceFactory.createResource(NS + "DisjointConstraintComponent"); public final static Resource EqualsConstraintComponent = ResourceFactory.createResource(NS + "EqualsConstraintComponent"); public final static Resource HasValueConstraintComponent = ResourceFactory.createResource(NS + "HasValueConstraintComponent"); public final static Resource InConstraintComponent = ResourceFactory.createResource(NS + "InConstraintComponent"); public final static Resource Info = ResourceFactory.createResource(NS + "Info"); public final static Resource IRI = ResourceFactory.createResource(NS + "IRI"); public final static Resource IRIOrLiteral = ResourceFactory.createResource(NS + "IRIOrLiteral"); public final static Resource LanguageInConstraintComponent = ResourceFactory.createResource(NS + "LanguageInConstraintComponent"); public final static Resource LessThanConstraintComponent = ResourceFactory.createResource(NS + "LessThanConstraintComponent"); public final static Resource LessThanOrEqualsConstraintComponent = ResourceFactory.createResource(NS + "LessThanOrEqualsConstraintComponent"); public final static Resource Literal = ResourceFactory.createResource(NS + "Literal"); public final static Resource PrefixDeclaration = ResourceFactory.createResource(NS + "PrefixDeclaration"); public final static Resource PropertyShape = ResourceFactory.createResource(NS + "PropertyShape"); public final static Resource PropertyConstraintComponent = ResourceFactory.createResource(NS + "PropertyConstraintComponent"); public final static Resource MinCountConstraintComponent = ResourceFactory.createResource(NS + "MinCountConstraintComponent"); public final static Resource MinExclusiveConstraintComponent = ResourceFactory.createResource(NS + "MinExclusiveConstraintComponent"); public final static Resource MinInclusiveConstraintComponent = ResourceFactory.createResource(NS + "MinInclusiveConstraintComponent"); public final static Resource MinLengthConstraintComponent = ResourceFactory.createResource(NS + "MinLengthConstraintComponent"); public final static Resource NodeConstraintComponent = ResourceFactory.createResource(NS + "NodeConstraintComponent"); public final static Resource NodeKindConstraintComponent = ResourceFactory.createResource(NS + "NodeKindConstraintComponent"); public final static Resource NodeShape = ResourceFactory.createResource(NS + "NodeShape"); public final static Resource NotConstraintComponent = ResourceFactory.createResource(NS + "NotConstraintComponent"); public final static Resource OrConstraintComponent = ResourceFactory.createResource(NS + "OrConstraintComponent"); public final static Resource Parameter = ResourceFactory.createResource(NS + "Parameter"); public final static Resource Parameterizable = ResourceFactory.createResource(NS + "Parameterizable"); public final static Resource PatternConstraintComponent = ResourceFactory.createResource(NS + "PatternConstraintComponent"); public final static Resource PrefixDeclaration = ResourceFactory.createResource(NS + "PrefixDeclaration"); public final static Resource PropertyGroup = ResourceFactory.createResource(NS + "PropertyGroup"); public final static Resource PropertyShape = ResourceFactory.createResource(NS + "PropertyShape"); public final static Resource PropertyConstraintComponent = ResourceFactory.createResource(NS + "PropertyConstraintComponent"); public final static Resource QualifiedMaxCountConstraintComponent = ResourceFactory.createResource(NS + "QualifiedMaxCountConstraintComponent"); public final static Resource QualifiedMinCountConstraintComponent = ResourceFactory.createResource(NS + "QualifiedMinCountConstraintComponent"); public final static Resource ResultAnnotation = ResourceFactory.createResource(NS + "ResultAnnotation"); public final static Resource Shape = ResourceFactory.createResource(NS + "Shape"); public final static Resource SPARQLAskValidator = ResourceFactory.createResource(NS + "SPARQLAskValidator"); public final static Resource SPARQLConstraint = ResourceFactory.createResource(NS + "SPARQLConstraint"); public final static Resource SPARQLConstraintComponent = ResourceFactory.createResource(NS + "SPARQLConstraintComponent"); public final static Resource SPARQLConstructRule = ResourceFactory.createResource(NS + "SPARQLConstructRule"); public final static Resource SPARQLExecutable = ResourceFactory.createResource(NS + "SPARQLExecutable"); public final static Resource SPARQLFunction = ResourceFactory.createResource(NS + "SPARQLFunction"); public final static Resource SPARQLSelectValidator = ResourceFactory.createResource(NS + "SPARQLSelectValidator"); public final static Resource SPARQLTarget = ResourceFactory.createResource(NS + "SPARQLTarget"); public final static Resource SPARQLValuesDeriver = ResourceFactory.createResource(NS + "SPARQLValuesDeriver"); public final static Resource UniqueLangConstraintComponent = ResourceFactory.createResource(NS + "UniqueLangConstraintComponent"); public final static Resource ValidationReport = ResourceFactory.createResource(NS + "ValidationReport"); public final static Resource ValidationResult = ResourceFactory.createResource(NS + "ValidationResult"); public final static Resource Validator = ResourceFactory.createResource(NS + "Validator"); public final static Resource Violation = ResourceFactory.createResource(NS + "Violation"); public final static Resource Warning = ResourceFactory.createResource(NS + "Warning"); public final static Resource XoneConstraintComponent = ResourceFactory.createResource(NS + "XoneConstraintComponent"); public final static Property alternativePath = ResourceFactory.createProperty(NS + "alternativePath"); public final static Property and = ResourceFactory.createProperty(NS + "and"); public final static Property ask = ResourceFactory.createProperty(NS + "ask"); public final static Property class_ = ResourceFactory.createProperty(NS + "class"); public final static Property closed = ResourceFactory.createProperty(NS + "closed"); public final static Property condition = ResourceFactory.createProperty(NS + "condition"); public final static Property conforms = ResourceFactory.createProperty(NS + "conforms"); public final static Property construct = ResourceFactory.createProperty(NS + "construct"); public final static Property datatype = ResourceFactory.createProperty(NS + "datatype"); public final static Property deactivated = ResourceFactory.createProperty(NS + "deactivated"); public final static Property declare = ResourceFactory.createProperty(NS + "declare"); public final static Property defaultValue = ResourceFactory.createProperty(NS + "defaultValue"); public final static Property detail = ResourceFactory.createProperty(NS + "detail"); public final static Property description = ResourceFactory.createProperty(NS + "description"); public final static Property disjoint = ResourceFactory.createProperty(NS + "disjoint"); public final static Property entailment = ResourceFactory.createProperty(NS + "entailment"); public final static Property equals = ResourceFactory.createProperty(NS + "equals"); public final static Property flags = ResourceFactory.createProperty(NS + "flags"); public final static Property focusNode = ResourceFactory.createProperty(NS + "focusNode"); public final static Property group = ResourceFactory.createProperty(NS + "group"); public final static Property hasValue = ResourceFactory.createProperty(NS + "hasValue"); public final static Property ignoredProperties = ResourceFactory.createProperty(NS + "ignoredProperties"); public final static Property in = ResourceFactory.createProperty(NS + "in"); public final static Property inversePath = ResourceFactory.createProperty(NS + "inversePath"); public final static Property labelTemplate = ResourceFactory.createProperty(NS + "labelTemplate"); public final static Property languageIn = ResourceFactory.createProperty(NS + "languageIn"); public final static Property lessThan = ResourceFactory.createProperty(NS + "lessThan"); public final static Property lessThanOrEquals = ResourceFactory.createProperty(NS + "lessThanOrEquals"); public final static Property maxCount = ResourceFactory.createProperty(NS + "maxCount"); public final static Property maxExclusive = ResourceFactory.createProperty(NS + "maxExclusive"); public final static Property maxInclusive = ResourceFactory.createProperty(NS + "maxInclusive"); public final static Property maxLength = ResourceFactory.createProperty(NS + "maxLength"); public final static Property message = ResourceFactory.createProperty(NS + "message"); public final static Property minCount = ResourceFactory.createProperty(NS + "minCount"); public final static Property minExclusive = ResourceFactory.createProperty(NS + "minExclusive"); public final static Property minInclusive = ResourceFactory.createProperty(NS + "minInclusive"); public final static Property minLength = ResourceFactory.createProperty(NS + "minLength"); public final static Property name = ResourceFactory.createProperty(NS + "name"); public final static Property namespace = ResourceFactory.createProperty(NS + "namespace"); public final static Property node = ResourceFactory.createProperty(NS + "node"); public final static Property nodeKind = ResourceFactory.createProperty(NS + "nodeKind"); public final static Property nodeValidator = ResourceFactory.createProperty(NS + "nodeValidator"); public final static Property not = ResourceFactory.createProperty(NS + "not"); public final static Property oneOrMorePath = ResourceFactory.createProperty(NS + "oneOrMorePath"); public final static Property optional = ResourceFactory.createProperty(NS + "optional"); public final static Property or = ResourceFactory.createProperty(NS + "or"); public final static Property order = ResourceFactory.createProperty(NS + "order"); public final static Property parameter = ResourceFactory.createProperty(NS + "parameter"); public final static Property path = ResourceFactory.createProperty(NS + "path"); public final static Property pattern = ResourceFactory.createProperty(NS + "pattern"); public final static Property prefix = ResourceFactory.createProperty(NS + "prefix"); public final static Property prefixes = ResourceFactory.createProperty(NS + "prefixes"); public final static Property property = ResourceFactory.createProperty(NS + "property"); public final static Property propertyValidator = ResourceFactory.createProperty(NS + "propertyValidator"); public final static Property qualifiedMaxCount = ResourceFactory.createProperty(NS + "qualifiedMaxCount"); public final static Property qualifiedMinCount = ResourceFactory.createProperty(NS + "qualifiedMinCount"); public final static Property qualifiedValueShape = ResourceFactory.createProperty(NS + "qualifiedValueShape"); public final static Property qualifiedValueShapesDisjoint = ResourceFactory.createProperty(NS + "qualifiedValueShapesDisjoint"); public final static Property result = ResourceFactory.createProperty(NS + "result"); public final static Property resultMessage = ResourceFactory.createProperty(NS + "resultMessage"); public final static Property resultPath = ResourceFactory.createProperty(NS + "resultPath"); public final static Property resultSeverity = ResourceFactory.createProperty(NS + "resultSeverity"); public final static Property select = ResourceFactory.createProperty(NS + "select"); public final static Property severity = ResourceFactory.createProperty(NS + "severity"); public final static Property shapesGraph = ResourceFactory.createProperty(NS + "shapesGraph"); public final static Property sourceConstraint = ResourceFactory.createProperty(NS + "sourceConstraint"); public final static Property sourceConstraintComponent = ResourceFactory.createProperty(NS + "sourceConstraintComponent"); public final static Property sourceShape = ResourceFactory.createProperty(NS + "sourceShape"); public final static Property sparql = ResourceFactory.createProperty(NS + "sparql"); public final static Property targetClass = ResourceFactory.createProperty(NS + "targetClass"); public final static Property targetNode = ResourceFactory.createProperty(NS + "targetNode"); public final static Property targetObjectsOf = ResourceFactory.createProperty(NS + "targetObjectsOf"); public final static Property targetSubjectsOf = ResourceFactory.createProperty(NS + "targetSubjectsOf"); public final static Property uniqueLang = ResourceFactory.createProperty(NS + "uniqueLang"); public final static Property update = ResourceFactory.createProperty(NS + "update"); public final static Property validator = ResourceFactory.createProperty(NS + "validator"); public final static Property value = ResourceFactory.createProperty(NS + "value"); public final static Property zeroOrMorePath = ResourceFactory.createProperty(NS + "zeroOrMorePath"); public final static Property zeroOrOnePath = ResourceFactory.createProperty(NS + "zeroOrOnePath"); // Advanced features public final static Resource ExpressionConstraintComponent = ResourceFactory.createResource(NS + "ExpressionConstraintComponent"); public final static Resource Function = ResourceFactory.createResource(NS + "Function"); public final static Resource JSConstraint = ResourceFactory.createResource(NS + "JSConstraint"); public final static Resource JSConstraintComponent = ResourceFactory.createResource(NS + "JSConstraintComponent"); public final static Resource JSExecutable = ResourceFactory.createResource(NS + "JSExecutable"); public final static Resource JSFunction = ResourceFactory.createResource(NS + "JSFunction"); public final static Resource JSLibrary = ResourceFactory.createResource(NS + "JSLibrary"); public final static Resource JSRule = ResourceFactory.createResource(NS + "JSRule"); public final static Resource JSTarget = ResourceFactory.createResource(NS + "JSTarget"); public final static Resource JSTargetType = ResourceFactory.createResource(NS + "JSTargetType"); public final static Resource JSValidator = ResourceFactory.createResource(NS + "JSValidator"); public final static Resource Rule = ResourceFactory.createResource(NS + "Rule"); public final static Resource Rules = ResourceFactory.createResource(NS + "Rules"); public final static Resource SPARQLRule = ResourceFactory.createResource(NS + "SPARQLRule"); public final static Resource Target = ResourceFactory.createResource(NS + "Target"); public final static Resource this_ = ResourceFactory.createResource(NS + "this"); public final static Resource TripleRule = ResourceFactory.createResource(NS + "TripleRule"); public final static Property expression = ResourceFactory.createProperty(NS + "expression"); public final static Property filterShape = ResourceFactory.createProperty(NS + "filterShape"); public final static Property intersection = ResourceFactory.createProperty(NS + "intersection"); public final static Property js = ResourceFactory.createProperty(NS + "js"); public final static Property jsFunctionName = ResourceFactory.createProperty(NS + "jsFunctionName"); public final static Property jsLibrary = ResourceFactory.createProperty(NS + "jsLibrary"); public final static Property jsLibraryURL = ResourceFactory.createProperty(NS + "jsLibraryURL"); public final static Property member = ResourceFactory.createProperty(NS + "member"); public final static Property nodes = ResourceFactory.createProperty(NS + "nodes"); public final static Property object = ResourceFactory.createProperty(NS + "object"); public final static Property predicate = ResourceFactory.createProperty(NS + "predicate"); public final static Property returnType = ResourceFactory.createProperty(NS + "returnType"); public final static Property rule = ResourceFactory.createProperty(NS + "rule"); public final static Property subject = ResourceFactory.createProperty(NS + "subject"); public final static Property target = ResourceFactory.createProperty(NS + "target"); public final static Property union = ResourceFactory.createProperty(NS + "union"); // Features not in SHACL 1.0 but candidates for next release public final static Property count = ResourceFactory.createProperty(NS + "count"); public final static Property desc = ResourceFactory.createProperty(NS + "desc"); public final static Property distinct = ResourceFactory.createProperty(NS + "distinct"); public final static Property else_ = ResourceFactory.createProperty(NS + "else"); public final static Property exists = ResourceFactory.createProperty(NS + "exists"); public final static Property groupConcat = ResourceFactory.createProperty(NS + "groupConcat"); public final static Property if_ = ResourceFactory.createProperty(NS + "if"); public final static Property limit = ResourceFactory.createProperty(NS + "limit"); public final static Property max = ResourceFactory.createProperty(NS + "max"); public final static Property min = ResourceFactory.createProperty(NS + "min"); public final static Property minus = ResourceFactory.createProperty(NS + "minus"); public final static Property offset = ResourceFactory.createProperty(NS + "offset"); public final static Property orderBy = ResourceFactory.createProperty(NS + "orderBy"); public final static Property separator = ResourceFactory.createProperty(NS + "separator"); public final static Property sum = ResourceFactory.createProperty(NS + "sum"); public final static Property then = ResourceFactory.createProperty(NS + "then"); public final static Property values = ResourceFactory.createProperty(NS + "values"); public static final Var currentShapeVar = Var.alloc("currentShape"); public static final Var failureVar = Var.alloc("failure"); public static final Var PATHVar = Var.alloc("PATH"); public static final Var pathVar = Var.alloc(path.getLocalName()); public static final Var shapesGraphVar = Var.alloc("shapesGraph"); public static final Var thisVar = Var.alloc("this"); public static final Var valueVar = Var.alloc("value"); public final static String JS_DATA_VAR = "$data"; public final static String JS_SHAPES_VAR = "$shapes"; public static String getURI() { return NS; } } <MSG> RuleUtil now also applies entailments (and other updates) (#35) <DFF> @@ -81,6 +81,8 @@ public class SH { public final static Resource PrefixDeclaration = ResourceFactory.createResource(NS + "PrefixDeclaration"); + public final static Resource PropertyGroup = ResourceFactory.createResource(NS + "PropertyGroup"); + public final static Resource PropertyShape = ResourceFactory.createResource(NS + "PropertyShape"); public final static Resource PropertyConstraintComponent = ResourceFactory.createResource(NS + "PropertyConstraintComponent");
2
RuleUtil now also applies entailments (and other updates) (#35)
0
.java
java
apache-2.0
TopQuadrant/shacl
330
<NME> README.md <BEF> # TopBraid SHACL API **An open source implementation of the W3C Shapes Constraint Language (SHACL) based on Apache Jena.** Contact: Holger Knublauch ([email protected]) Can be used to perform SHACL constraint checking and rule inferencing in any Jena-based Java application. This API also serves as a reference implementation of the SHACL spec. Coverage: * [SHACL Core and SHACL-SPARQL validation](https://www.w3.org/TR/shacl/) * [SHACL Advanced Features (Rules etc)](https://www.w3.org/TR/shacl-af/) Former Coverage until version 1.4.0 * [SHACL Compact Syntax](https://w3c.github.io/shacl/shacl-compact-syntax/) Former Coverage until version 1.3.2 * [SHACL JavaScript Extensions](https://www.w3.org/TR/shacl-js/) The TopBraid SHACL API is internally used by the European Commission's generic [SHACL-based RDF validator](https://www.itb.ec.europa.eu/shacl/any/upload) (used to validate RDF content against SHACL shapes) and [SHACL shape validator](https://www.itb.ec.europa.eu/shacl/shacl/upload) (used to validate SHACL shapes themselves). The same code is used in the TopBraid products (currently aligned with the TopBraid 7.1 release). Feedback and questions should become GitHub issues or sent to TopBraid Users mailing list: https://groups.google.com/forum/#!forum/topbraid-users Please prefix your messages with [SHACL API] To get started, look at the class ValidationUtil in the package org.topbraid.shacl.validation. There is also an [Example Test Case](../master/src/test/java/org/topbraid/shacl/ValidationExample.java) ## Application dependency Releases are available in the central maven repository: For example, on Windows: SET JENAROOT=C:\Users\Holger\Desktop\shacl-1.0.0-bin SET PATH=%PATH%;%JENAROOT%\bin Both tools take the following parameters, for example: ## Command Line Usage Download the latest release from: `https://repo1.maven.org/maven2/org/topbraid/shacl/` The binary distribution is: `https://repo1.maven.org/maven2/org/topbraid/shacl/*VER*/shacl-*VER*-bin.zip`. Two command line utilities are included: shaclvalidate (performs constraint validation) and shaclinfer (performs SHACL rule inferencing). To use them, set up your environment similar to https://jena.apache.org/documentation/tools/ (note that the SHACL download includes Jena). For example, on Windows: ``` SET SHACLROOT=C:\Users\Holger\Desktop\shacl-1.4.1-bin SET PATH=%PATH%;%SHACLROOT%\bin ``` As another example, for Linux, add to .bashrc these lines: ``` # for shacl export SHACLROOT=/home/holger/shacl/shacl-1.4.1-bin/shacl-1.4.1/bin export PATH=$SHACLROOT:$PATH ``` Both tools take the following parameters, for example: `shaclvalidate.bat -datafile myfile.ttl -shapesfile myshapes.ttl` where `-shapesfile` is optional and falls back to using the data graph as shapes graph. Add -validateShapes in case you want to include the metashapes (from the tosh namespace in particular). Currently only Turtle (.ttl) files are supported. The tools print the validation report or the inferences graph to the output screen. <MSG> Fixed line break <DFF> @@ -37,6 +37,7 @@ To use them, set up your environment similar to https://jena.apache.org/document For example, on Windows: SET JENAROOT=C:\Users\Holger\Desktop\shacl-1.0.0-bin + SET PATH=%PATH%;%JENAROOT%\bin Both tools take the following parameters, for example:
1
Fixed line break
0
.md
md
apache-2.0
TopQuadrant/shacl
331
<NME> README.md <BEF> # TopBraid SHACL API **An open source implementation of the W3C Shapes Constraint Language (SHACL) based on Apache Jena.** Contact: Holger Knublauch ([email protected]) Can be used to perform SHACL constraint checking and rule inferencing in any Jena-based Java application. This API also serves as a reference implementation of the SHACL spec. Coverage: * [SHACL Core and SHACL-SPARQL validation](https://www.w3.org/TR/shacl/) * [SHACL Advanced Features (Rules etc)](https://www.w3.org/TR/shacl-af/) Former Coverage until version 1.4.0 * [SHACL Compact Syntax](https://w3c.github.io/shacl/shacl-compact-syntax/) Former Coverage until version 1.3.2 * [SHACL JavaScript Extensions](https://www.w3.org/TR/shacl-js/) The TopBraid SHACL API is internally used by the European Commission's generic [SHACL-based RDF validator](https://www.itb.ec.europa.eu/shacl/any/upload) (used to validate RDF content against SHACL shapes) and [SHACL shape validator](https://www.itb.ec.europa.eu/shacl/shacl/upload) (used to validate SHACL shapes themselves). The same code is used in the TopBraid products (currently aligned with the TopBraid 7.1 release). Feedback and questions should become GitHub issues or sent to TopBraid Users mailing list: https://groups.google.com/forum/#!forum/topbraid-users Please prefix your messages with [SHACL API] To get started, look at the class ValidationUtil in the package org.topbraid.shacl.validation. There is also an [Example Test Case](../master/src/test/java/org/topbraid/shacl/ValidationExample.java) ## Application dependency Releases are available in the central maven repository: For example, on Windows: SET JENAROOT=C:\Users\Holger\Desktop\shacl-1.0.0-bin SET PATH=%PATH%;%JENAROOT%\bin Both tools take the following parameters, for example: ## Command Line Usage Download the latest release from: `https://repo1.maven.org/maven2/org/topbraid/shacl/` The binary distribution is: `https://repo1.maven.org/maven2/org/topbraid/shacl/*VER*/shacl-*VER*-bin.zip`. Two command line utilities are included: shaclvalidate (performs constraint validation) and shaclinfer (performs SHACL rule inferencing). To use them, set up your environment similar to https://jena.apache.org/documentation/tools/ (note that the SHACL download includes Jena). For example, on Windows: ``` SET SHACLROOT=C:\Users\Holger\Desktop\shacl-1.4.1-bin SET PATH=%PATH%;%SHACLROOT%\bin ``` As another example, for Linux, add to .bashrc these lines: ``` # for shacl export SHACLROOT=/home/holger/shacl/shacl-1.4.1-bin/shacl-1.4.1/bin export PATH=$SHACLROOT:$PATH ``` Both tools take the following parameters, for example: `shaclvalidate.bat -datafile myfile.ttl -shapesfile myshapes.ttl` where `-shapesfile` is optional and falls back to using the data graph as shapes graph. Add -validateShapes in case you want to include the metashapes (from the tosh namespace in particular). Currently only Turtle (.ttl) files are supported. The tools print the validation report or the inferences graph to the output screen. <MSG> Fixed line break <DFF> @@ -37,6 +37,7 @@ To use them, set up your environment similar to https://jena.apache.org/document For example, on Windows: SET JENAROOT=C:\Users\Holger\Desktop\shacl-1.0.0-bin + SET PATH=%PATH%;%JENAROOT%\bin Both tools take the following parameters, for example:
1
Fixed line break
0
.md
md
apache-2.0
TopQuadrant/shacl
332
<NME> SHACLFunctionsCache.java <BEF> /* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * See the NOTICE file distributed with this work for additional * information regarding copyright ownership. */ package org.topbraid.shacl.arq; import java.util.Collections; import java.util.LinkedHashMap; import java.util.Map; import org.apache.jena.graph.Node; import org.apache.jena.query.Dataset; import org.apache.jena.query.QuerySolution; import org.apache.jena.rdf.model.Model; import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; /** * A cache that remembers previous calls to SHACL functions marked with sh:cachable. * * @author Holger Knublauch */ public class SHACLFunctionsCache { private static SHACLFunctionsCache singleton = new SHACLFunctionsCache(); public static SHACLFunctionsCache get() { return singleton; } public static void set(SHACLFunctionsCache value) { SHACLFunctionsCache.singleton = value; } private static final int capacity = 10000; @SuppressWarnings("serial") private static class MyCache extends LinkedHashMap<Key,Result> { MyCache() { super(capacity + 1, 1.1f, true); } @Override protected boolean removeEldestEntry(Entry<Key, Result> eldest) { if(size() > capacity) { return true; } else { return false; } } }; private Map<Key,Result> cache = Collections.synchronizedMap(new MyCache()); public void clear() { cache.clear(); } public NodeValue execute(SHACLARQFunction function, Dataset dataset, Model defaultModel, QuerySolution bindings, Node[] args) { Key key = new Key(function.getSHACLFunction().getURI(), args); Result result = cache.get(key); if(result == null) { result = new Result(); try { result.nodeValue = function.executeBody(dataset, defaultModel, bindings); } catch(ExprEvalException ex) { result.ex = ex; } cache.put(key, result); } if(result.ex != null) { throw new ExprEvalException(result.ex.getMessage()); } else { return result.nodeValue; } } private static class Key { private int hashCode; private Node[] args; private String functionURI; Key(String functionURI, Node[] args) { this.args = args; this.functionURI = functionURI; hashCode = functionURI.hashCode(); for(Node arg : args) { if(arg != null) { hashCode += arg.hashCode(); } } } private boolean argEquals(Node arg1, Node arg2) { if(arg1 == null) { return arg2 == null; } else if(arg2 == null) { return false; } else { return arg1.equals(arg2); } } @Override public boolean equals(Object obj) { if(!(obj instanceof Key)) { return false; } Key other = (Key) obj; if(!functionURI.equals(other.functionURI)) { return false; } if(args.length != other.args.length) { return false; } for(int i = 0; i < args.length; i++) { if(!argEquals(args[i], other.args[i])) { return false; } } return true; } @Override public int hashCode() { return hashCode; } } private static class Result { ExprEvalException ex; NodeValue nodeValue; } } <MSG> Corrected established pattern for newly added @Override methods and added back a missing import <DFF> @@ -19,6 +19,7 @@ package org.topbraid.shacl.arq; import java.util.Collections; import java.util.LinkedHashMap; import java.util.Map; +import java.util.Map.Entry; import org.apache.jena.graph.Node; import org.apache.jena.query.Dataset; @@ -47,10 +48,9 @@ public class SHACLFunctionsCache { private static final int capacity = 10000; - @SuppressWarnings("serial") private static class MyCache extends LinkedHashMap<Key,Result> { - MyCache() { + MyCache() { super(capacity + 1, 1.1f, true); }
2
Corrected established pattern for newly added @Override methods and added back a missing import
2
.java
java
apache-2.0
TopQuadrant/shacl
333
<NME> SHACLFunctionsCache.java <BEF> /* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * See the NOTICE file distributed with this work for additional * information regarding copyright ownership. */ package org.topbraid.shacl.arq; import java.util.Collections; import java.util.LinkedHashMap; import java.util.Map; import org.apache.jena.graph.Node; import org.apache.jena.query.Dataset; import org.apache.jena.query.QuerySolution; import org.apache.jena.rdf.model.Model; import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; /** * A cache that remembers previous calls to SHACL functions marked with sh:cachable. * * @author Holger Knublauch */ public class SHACLFunctionsCache { private static SHACLFunctionsCache singleton = new SHACLFunctionsCache(); public static SHACLFunctionsCache get() { return singleton; } public static void set(SHACLFunctionsCache value) { SHACLFunctionsCache.singleton = value; } private static final int capacity = 10000; @SuppressWarnings("serial") private static class MyCache extends LinkedHashMap<Key,Result> { MyCache() { super(capacity + 1, 1.1f, true); } @Override protected boolean removeEldestEntry(Entry<Key, Result> eldest) { if(size() > capacity) { return true; } else { return false; } } }; private Map<Key,Result> cache = Collections.synchronizedMap(new MyCache()); public void clear() { cache.clear(); } public NodeValue execute(SHACLARQFunction function, Dataset dataset, Model defaultModel, QuerySolution bindings, Node[] args) { Key key = new Key(function.getSHACLFunction().getURI(), args); Result result = cache.get(key); if(result == null) { result = new Result(); try { result.nodeValue = function.executeBody(dataset, defaultModel, bindings); } catch(ExprEvalException ex) { result.ex = ex; } cache.put(key, result); } if(result.ex != null) { throw new ExprEvalException(result.ex.getMessage()); } else { return result.nodeValue; } } private static class Key { private int hashCode; private Node[] args; private String functionURI; Key(String functionURI, Node[] args) { this.args = args; this.functionURI = functionURI; hashCode = functionURI.hashCode(); for(Node arg : args) { if(arg != null) { hashCode += arg.hashCode(); } } } private boolean argEquals(Node arg1, Node arg2) { if(arg1 == null) { return arg2 == null; } else if(arg2 == null) { return false; } else { return arg1.equals(arg2); } } @Override public boolean equals(Object obj) { if(!(obj instanceof Key)) { return false; } Key other = (Key) obj; if(!functionURI.equals(other.functionURI)) { return false; } if(args.length != other.args.length) { return false; } for(int i = 0; i < args.length; i++) { if(!argEquals(args[i], other.args[i])) { return false; } } return true; } @Override public int hashCode() { return hashCode; } } private static class Result { ExprEvalException ex; NodeValue nodeValue; } } <MSG> Corrected established pattern for newly added @Override methods and added back a missing import <DFF> @@ -19,6 +19,7 @@ package org.topbraid.shacl.arq; import java.util.Collections; import java.util.LinkedHashMap; import java.util.Map; +import java.util.Map.Entry; import org.apache.jena.graph.Node; import org.apache.jena.query.Dataset; @@ -47,10 +48,9 @@ public class SHACLFunctionsCache { private static final int capacity = 10000; - @SuppressWarnings("serial") private static class MyCache extends LinkedHashMap<Key,Result> { - MyCache() { + MyCache() { super(capacity + 1, 1.1f, true); }
2
Corrected established pattern for newly added @Override methods and added back a missing import
2
.java
java
apache-2.0
TopQuadrant/shacl
334
<NME> LICENSE <BEF> ADDFILE <MSG> Switched to Apache License using GitHub template <DFF> @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License.
201
Switched to Apache License using GitHub template
0
LICENSE
apache-2.0
TopQuadrant/shacl
335
<NME> LICENSE <BEF> ADDFILE <MSG> Switched to Apache License using GitHub template <DFF> @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License.
201
Switched to Apache License using GitHub template
0
LICENSE
apache-2.0
TopQuadrant/shacl
336
<NME> AbstractSPARQLExecutor.java <BEF> /* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * See the NOTICE file distributed with this work for additional * information regarding copyright ownership. */ package org.topbraid.shacl.validation.sparql; import java.net.URI; import java.util.Collection; import java.util.Collections; import java.util.Iterator; import org.apache.jena.query.Query; import org.apache.jena.query.QueryExecution; import org.apache.jena.query.QueryParseException; import org.apache.jena.query.QuerySolution; import org.apache.jena.query.QuerySolutionMap; import org.apache.jena.query.ResultSet; import org.apache.jena.rdf.model.Model; import org.apache.jena.rdf.model.RDFNode; import org.apache.jena.rdf.model.Resource; import org.apache.jena.rdf.model.ResourceFactory; import org.apache.jena.rdf.model.Statement; import org.apache.jena.vocabulary.RDF; import org.topbraid.jenax.statistics.ExecStatistics; import org.topbraid.jenax.statistics.ExecStatisticsManager; import org.topbraid.jenax.util.ARQFactory; import org.topbraid.jenax.util.JenaDatatypes; import org.topbraid.jenax.util.JenaUtil; import org.topbraid.jenax.util.RDFLabels; import org.topbraid.shacl.arq.SHACLPaths; import org.topbraid.shacl.arq.functions.HasShapeFunction; import org.topbraid.shacl.engine.Constraint; import org.topbraid.shacl.engine.ShapesGraph; import org.topbraid.shacl.util.FailureLog; import org.topbraid.shacl.util.SHACLUtil; import org.topbraid.shacl.validation.ConstraintExecutor; import org.topbraid.shacl.validation.SHACLException; import org.topbraid.shacl.validation.ValidationEngine; import org.topbraid.shacl.vocabulary.DASH; import org.topbraid.shacl.vocabulary.SH; public abstract class AbstractSPARQLExecutor implements ConstraintExecutor { // Flag to generate sh:details for all violations. public static boolean createDetails = false; private Query query; private String queryString; protected AbstractSPARQLExecutor(Constraint constraint) { this.queryString = getSPARQL(constraint); try { this.query = ARQFactory.get().createQuery(queryString); Resource path = constraint.getShapeResource().getPath(); if(path != null && path.isAnon()) { String pathString = SHACLPaths.getPathString(constraint.getShapeResource().getPropertyResourceValue(SH.path)); query = SPARQLSubstitutions.substitutePaths(query, pathString, constraint.getShapeResource().getModel()); } } catch(QueryParseException ex) { throw new SHACLException("Invalid SPARQL constraint (" + ex.getLocalizedMessage() + "):\n" + queryString); } if(!query.isSelectType()) { throw new IllegalArgumentException("SHACL constraints must be SELECT queries"); } } @Override public void executeConstraint(Constraint constraint, ValidationEngine engine, Collection<RDFNode> focusNodes) { QuerySolutionMap bindings = new QuerySolutionMap(); addBindings(constraint, bindings); bindings.add(SH.currentShapeVar.getVarName(), constraint.getShapeResource()); bindings.add(SH.shapesGraphVar.getVarName(), ResourceFactory.createResource(engine.getShapesGraphURI().toString())); Resource path = constraint.getShapeResource().getPath(); if(path != null && path.isURIResource()) { bindings.add(SH.PATHVar.getName(), path); } URI oldShapesGraphURI = HasShapeFunction.getShapesGraphURI(); ShapesGraph oldShapesGraph = HasShapeFunction.getShapesGraph(); if(!engine.getShapesGraphURI().equals(oldShapesGraphURI)) { HasShapeFunction.setShapesGraph(engine.getShapesGraph(), engine.getShapesGraphURI()); } Model oldNestedResults = HasShapeFunction.getResultsModel(); Model nestedResults = JenaUtil.createMemoryModel(); HasShapeFunction.setResultsModel(nestedResults); try { long startTime = System.currentTimeMillis(); Resource messageHolder = getSPARQLExecutable(constraint); for(RDFNode focusNode : focusNodes) { bindings.add(SH.thisVar.getVarName(), focusNode); // Overwrite any previous binding QueryExecution qexec = SPARQLSubstitutions.createQueryExecution(query, engine.getDataset(), bindings); executeSelectQuery(engine, constraint, messageHolder, nestedResults, focusNode, qexec, bindings); engine.checkCanceled(); } if(ExecStatisticsManager.get().isRecording()) { long endTime = System.currentTimeMillis(); long duration = endTime - startTime; String label = getLabel(constraint); Iterator<String> varNames = bindings.varNames(); if(varNames.hasNext()) { queryString += "\nBindings:"; while(varNames.hasNext()) { String varName = varNames.next(); queryString += "\n- ?" + varName + ": " + bindings.get(varName); } } ExecStatistics stats = new ExecStatistics(label, queryString, duration, startTime, constraint.getComponent().asNode()); ExecStatisticsManager.get().add(Collections.singletonList(stats)); } } finally { HasShapeFunction.setShapesGraph(oldShapesGraph, oldShapesGraphURI); HasShapeFunction.setResultsModel(oldNestedResults); } } protected abstract void addBindings(Constraint constraint, QuerySolutionMap bindings); protected abstract Resource getSPARQLExecutable(Constraint constraint); protected abstract String getLabel(Constraint constraint); protected Query getQuery() { return query; } protected abstract String getSPARQL(Constraint constraint); private void executeSelectQuery(ValidationEngine engine, Constraint constraint, Resource messageHolder, Model nestedResults, RDFNode focusNode, QueryExecution qexec, QuerySolution bindings) { ResultSet rs = qexec.execSelect(); if(!rs.getResultVars().contains("this")) { qexec.close(); throw new IllegalArgumentException("SELECT constraints must return $this"); } try { if(rs.hasNext()) { while(rs.hasNext()) { QuerySolution sol = rs.next(); RDFNode thisValue = sol.get(SH.thisVar.getVarName()); if(thisValue != null) { Resource resultType = SH.ValidationResult; RDFNode selectMessage = sol.get(SH.message.getLocalName()); if(JenaDatatypes.TRUE.equals(sol.get(SH.failureVar.getName()))) { resultType = DASH.FailureResult; String message = getLabel(constraint); message += " has produced ?" + SH.failureVar.getName(); if(focusNode != null) { message += " for focus node "; if(focusNode.isLiteral()) { message += focusNode; } else { message += RDFLabels.get().getLabel((Resource)focusNode); } } FailureLog.get().logFailure(message); selectMessage = ResourceFactory.createTypedLiteral("Validation Failure: Could not validate shape"); } Resource result = engine.createResult(resultType, constraint, thisValue); if(SH.SPARQLConstraintComponent.equals(constraint.getComponent())) { result.addProperty(SH.sourceConstraint, constraint.getParameterValue()); } if(selectMessage != null) { result.addProperty(SH.resultMessage, selectMessage); } else if(constraint.getShapeResource().hasProperty(SH.message)) { for(Statement s : constraint.getShapeResource().listProperties(SH.message).toList()) { result.addProperty(SH.resultMessage, s.getObject()); } } else { addDefaultMessages(engine, messageHolder, constraint.getComponent(), result, bindings, sol); } RDFNode pathValue = sol.get(SH.pathVar.getVarName()); if(pathValue != null && pathValue.isURIResource()) { result.addProperty(SH.resultPath, pathValue); } else if(constraint.getShapeResource().isPropertyShape()) { Resource basePath = constraint.getShapeResource().getPropertyResourceValue(SH.path); result.addProperty(SH.resultPath, SHACLPaths.clonePath(basePath, result.getModel())); } if(!SH.HasValueConstraintComponent.equals(constraint.getComponent())) { // See https://github.com/w3c/data-shapes/issues/111 RDFNode selectValue = sol.get(SH.valueVar.getVarName()); if(selectValue != null) { result.addProperty(SH.value, selectValue); } else if(SH.NodeShape.equals(constraint.getContext())) { result.addProperty(SH.value, focusNode); } } } } } else if(createDetails) { Resource success = engine.createResult(DASH.SuccessResult, constraint, focusNode); if(SH.SPARQLConstraintComponent.equals(constraint.getComponent())) { success.addProperty(SH.sourceConstraint, constraint.getParameterValue()); } addDetails(success, nestedResults); } } finally { } } finally { qexec.close(); } } private void addDefaultMessages(ValidationEngine engine, Resource messageHolder, Resource fallback, Resource result, QuerySolution bindings, QuerySolution solution) { boolean found = false; for(Statement s : messageHolder.listProperties(SH.message).toList()) { if(s.getObject().isLiteral()) { QuerySolutionMap map = new QuerySolutionMap(); map.addAll(bindings); map.addAll(solution); engine.addResultMessage(result, s.getLiteral(), map); found = true; } } if(!found && fallback != null) { addDefaultMessages(engine, fallback, null, result, bindings, solution); } } public static void addDetails(Resource parentResult, Model nestedResults) { if(!nestedResults.isEmpty()) { parentResult.getModel().add(nestedResults); for(Resource type : SHACLUtil.RESULT_TYPES) { for(Resource nestedResult : nestedResults.listSubjectsWithProperty(RDF.type, type).toList()) { if(!parentResult.getModel().contains(null, SH.detail, nestedResult)) { parentResult.addProperty(SH.detail, nestedResult); } } } } } } <MSG> Latest TopBraid code base snapshot, including license headers, fixes to sh:equals in JS mode, and more options to generate sh:detail <DFF> @@ -55,6 +55,9 @@ public abstract class AbstractSPARQLExecutor implements ConstraintExecutor { // Flag to generate sh:details for all violations. public static boolean createDetails = false; + // Flag to generate dash:SuccessResults for all violations. + public static boolean createSuccessResults = false; + private Query query; private String queryString; @@ -224,12 +227,14 @@ public abstract class AbstractSPARQLExecutor implements ConstraintExecutor { } } } - else if(createDetails) { + else if(createSuccessResults) { Resource success = engine.createResult(DASH.SuccessResult, constraint, focusNode); if(SH.SPARQLConstraintComponent.equals(constraint.getComponent())) { success.addProperty(SH.sourceConstraint, constraint.getParameterValue()); } - addDetails(success, nestedResults); + if(createDetails) { + addDetails(success, nestedResults); + } } } finally {
7
Latest TopBraid code base snapshot, including license headers, fixes to sh:equals in JS mode, and more options to generate sh:detail
2
.java
java
apache-2.0
TopQuadrant/shacl
337
<NME> AbstractSPARQLExecutor.java <BEF> /* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * See the NOTICE file distributed with this work for additional * information regarding copyright ownership. */ package org.topbraid.shacl.validation.sparql; import java.net.URI; import java.util.Collection; import java.util.Collections; import java.util.Iterator; import org.apache.jena.query.Query; import org.apache.jena.query.QueryExecution; import org.apache.jena.query.QueryParseException; import org.apache.jena.query.QuerySolution; import org.apache.jena.query.QuerySolutionMap; import org.apache.jena.query.ResultSet; import org.apache.jena.rdf.model.Model; import org.apache.jena.rdf.model.RDFNode; import org.apache.jena.rdf.model.Resource; import org.apache.jena.rdf.model.ResourceFactory; import org.apache.jena.rdf.model.Statement; import org.apache.jena.vocabulary.RDF; import org.topbraid.jenax.statistics.ExecStatistics; import org.topbraid.jenax.statistics.ExecStatisticsManager; import org.topbraid.jenax.util.ARQFactory; import org.topbraid.jenax.util.JenaDatatypes; import org.topbraid.jenax.util.JenaUtil; import org.topbraid.jenax.util.RDFLabels; import org.topbraid.shacl.arq.SHACLPaths; import org.topbraid.shacl.arq.functions.HasShapeFunction; import org.topbraid.shacl.engine.Constraint; import org.topbraid.shacl.engine.ShapesGraph; import org.topbraid.shacl.util.FailureLog; import org.topbraid.shacl.util.SHACLUtil; import org.topbraid.shacl.validation.ConstraintExecutor; import org.topbraid.shacl.validation.SHACLException; import org.topbraid.shacl.validation.ValidationEngine; import org.topbraid.shacl.vocabulary.DASH; import org.topbraid.shacl.vocabulary.SH; public abstract class AbstractSPARQLExecutor implements ConstraintExecutor { // Flag to generate sh:details for all violations. public static boolean createDetails = false; private Query query; private String queryString; protected AbstractSPARQLExecutor(Constraint constraint) { this.queryString = getSPARQL(constraint); try { this.query = ARQFactory.get().createQuery(queryString); Resource path = constraint.getShapeResource().getPath(); if(path != null && path.isAnon()) { String pathString = SHACLPaths.getPathString(constraint.getShapeResource().getPropertyResourceValue(SH.path)); query = SPARQLSubstitutions.substitutePaths(query, pathString, constraint.getShapeResource().getModel()); } } catch(QueryParseException ex) { throw new SHACLException("Invalid SPARQL constraint (" + ex.getLocalizedMessage() + "):\n" + queryString); } if(!query.isSelectType()) { throw new IllegalArgumentException("SHACL constraints must be SELECT queries"); } } @Override public void executeConstraint(Constraint constraint, ValidationEngine engine, Collection<RDFNode> focusNodes) { QuerySolutionMap bindings = new QuerySolutionMap(); addBindings(constraint, bindings); bindings.add(SH.currentShapeVar.getVarName(), constraint.getShapeResource()); bindings.add(SH.shapesGraphVar.getVarName(), ResourceFactory.createResource(engine.getShapesGraphURI().toString())); Resource path = constraint.getShapeResource().getPath(); if(path != null && path.isURIResource()) { bindings.add(SH.PATHVar.getName(), path); } URI oldShapesGraphURI = HasShapeFunction.getShapesGraphURI(); ShapesGraph oldShapesGraph = HasShapeFunction.getShapesGraph(); if(!engine.getShapesGraphURI().equals(oldShapesGraphURI)) { HasShapeFunction.setShapesGraph(engine.getShapesGraph(), engine.getShapesGraphURI()); } Model oldNestedResults = HasShapeFunction.getResultsModel(); Model nestedResults = JenaUtil.createMemoryModel(); HasShapeFunction.setResultsModel(nestedResults); try { long startTime = System.currentTimeMillis(); Resource messageHolder = getSPARQLExecutable(constraint); for(RDFNode focusNode : focusNodes) { bindings.add(SH.thisVar.getVarName(), focusNode); // Overwrite any previous binding QueryExecution qexec = SPARQLSubstitutions.createQueryExecution(query, engine.getDataset(), bindings); executeSelectQuery(engine, constraint, messageHolder, nestedResults, focusNode, qexec, bindings); engine.checkCanceled(); } if(ExecStatisticsManager.get().isRecording()) { long endTime = System.currentTimeMillis(); long duration = endTime - startTime; String label = getLabel(constraint); Iterator<String> varNames = bindings.varNames(); if(varNames.hasNext()) { queryString += "\nBindings:"; while(varNames.hasNext()) { String varName = varNames.next(); queryString += "\n- ?" + varName + ": " + bindings.get(varName); } } ExecStatistics stats = new ExecStatistics(label, queryString, duration, startTime, constraint.getComponent().asNode()); ExecStatisticsManager.get().add(Collections.singletonList(stats)); } } finally { HasShapeFunction.setShapesGraph(oldShapesGraph, oldShapesGraphURI); HasShapeFunction.setResultsModel(oldNestedResults); } } protected abstract void addBindings(Constraint constraint, QuerySolutionMap bindings); protected abstract Resource getSPARQLExecutable(Constraint constraint); protected abstract String getLabel(Constraint constraint); protected Query getQuery() { return query; } protected abstract String getSPARQL(Constraint constraint); private void executeSelectQuery(ValidationEngine engine, Constraint constraint, Resource messageHolder, Model nestedResults, RDFNode focusNode, QueryExecution qexec, QuerySolution bindings) { ResultSet rs = qexec.execSelect(); if(!rs.getResultVars().contains("this")) { qexec.close(); throw new IllegalArgumentException("SELECT constraints must return $this"); } try { if(rs.hasNext()) { while(rs.hasNext()) { QuerySolution sol = rs.next(); RDFNode thisValue = sol.get(SH.thisVar.getVarName()); if(thisValue != null) { Resource resultType = SH.ValidationResult; RDFNode selectMessage = sol.get(SH.message.getLocalName()); if(JenaDatatypes.TRUE.equals(sol.get(SH.failureVar.getName()))) { resultType = DASH.FailureResult; String message = getLabel(constraint); message += " has produced ?" + SH.failureVar.getName(); if(focusNode != null) { message += " for focus node "; if(focusNode.isLiteral()) { message += focusNode; } else { message += RDFLabels.get().getLabel((Resource)focusNode); } } FailureLog.get().logFailure(message); selectMessage = ResourceFactory.createTypedLiteral("Validation Failure: Could not validate shape"); } Resource result = engine.createResult(resultType, constraint, thisValue); if(SH.SPARQLConstraintComponent.equals(constraint.getComponent())) { result.addProperty(SH.sourceConstraint, constraint.getParameterValue()); } if(selectMessage != null) { result.addProperty(SH.resultMessage, selectMessage); } else if(constraint.getShapeResource().hasProperty(SH.message)) { for(Statement s : constraint.getShapeResource().listProperties(SH.message).toList()) { result.addProperty(SH.resultMessage, s.getObject()); } } else { addDefaultMessages(engine, messageHolder, constraint.getComponent(), result, bindings, sol); } RDFNode pathValue = sol.get(SH.pathVar.getVarName()); if(pathValue != null && pathValue.isURIResource()) { result.addProperty(SH.resultPath, pathValue); } else if(constraint.getShapeResource().isPropertyShape()) { Resource basePath = constraint.getShapeResource().getPropertyResourceValue(SH.path); result.addProperty(SH.resultPath, SHACLPaths.clonePath(basePath, result.getModel())); } if(!SH.HasValueConstraintComponent.equals(constraint.getComponent())) { // See https://github.com/w3c/data-shapes/issues/111 RDFNode selectValue = sol.get(SH.valueVar.getVarName()); if(selectValue != null) { result.addProperty(SH.value, selectValue); } else if(SH.NodeShape.equals(constraint.getContext())) { result.addProperty(SH.value, focusNode); } } } } } else if(createDetails) { Resource success = engine.createResult(DASH.SuccessResult, constraint, focusNode); if(SH.SPARQLConstraintComponent.equals(constraint.getComponent())) { success.addProperty(SH.sourceConstraint, constraint.getParameterValue()); } addDetails(success, nestedResults); } } finally { } } finally { qexec.close(); } } private void addDefaultMessages(ValidationEngine engine, Resource messageHolder, Resource fallback, Resource result, QuerySolution bindings, QuerySolution solution) { boolean found = false; for(Statement s : messageHolder.listProperties(SH.message).toList()) { if(s.getObject().isLiteral()) { QuerySolutionMap map = new QuerySolutionMap(); map.addAll(bindings); map.addAll(solution); engine.addResultMessage(result, s.getLiteral(), map); found = true; } } if(!found && fallback != null) { addDefaultMessages(engine, fallback, null, result, bindings, solution); } } public static void addDetails(Resource parentResult, Model nestedResults) { if(!nestedResults.isEmpty()) { parentResult.getModel().add(nestedResults); for(Resource type : SHACLUtil.RESULT_TYPES) { for(Resource nestedResult : nestedResults.listSubjectsWithProperty(RDF.type, type).toList()) { if(!parentResult.getModel().contains(null, SH.detail, nestedResult)) { parentResult.addProperty(SH.detail, nestedResult); } } } } } } <MSG> Latest TopBraid code base snapshot, including license headers, fixes to sh:equals in JS mode, and more options to generate sh:detail <DFF> @@ -55,6 +55,9 @@ public abstract class AbstractSPARQLExecutor implements ConstraintExecutor { // Flag to generate sh:details for all violations. public static boolean createDetails = false; + // Flag to generate dash:SuccessResults for all violations. + public static boolean createSuccessResults = false; + private Query query; private String queryString; @@ -224,12 +227,14 @@ public abstract class AbstractSPARQLExecutor implements ConstraintExecutor { } } } - else if(createDetails) { + else if(createSuccessResults) { Resource success = engine.createResult(DASH.SuccessResult, constraint, focusNode); if(SH.SPARQLConstraintComponent.equals(constraint.getComponent())) { success.addProperty(SH.sourceConstraint, constraint.getParameterValue()); } - addDetails(success, nestedResults); + if(createDetails) { + addDetails(success, nestedResults); + } } } finally {
7
Latest TopBraid code base snapshot, including license headers, fixes to sh:equals in JS mode, and more options to generate sh:detail
2
.java
java
apache-2.0
TopQuadrant/shacl
338
<NME> README.md <BEF> # TopBraid SHACL API **An open source implementation of the W3C Shapes Constraint Language (SHACL) based on Apache Jena.** Contact: Holger Knublauch ([email protected]) Can be used to perform SHACL constraint checking and rule inferencing in any Jena-based Java application. This API also serves as a reference implementation developed in parallel to the SHACL spec. **The code is totally not optimized for performance, just for correctness. And there are unfinished gaps!** The same code is used in the TopBraid products - which is also why we use this particular Jena version. For interoperability with TopBraid, and during the transition period from SPIN to SHACL, this library uses code from org.topbraid.spin packages. These will eventually be refactored. Meanwhile, please don't rely on any class from the org.topbraid.spin packages directly. * [SHACL Compact Syntax](https://w3c.github.io/shacl/shacl-compact-syntax/) Former Coverage until version 1.3.2 * [SHACL JavaScript Extensions](https://www.w3.org/TR/shacl-js/) The TopBraid SHACL API is internally used by the European Commission's generic [SHACL-based RDF validator](https://www.itb.ec.europa.eu/shacl/any/upload) (used to validate RDF content against SHACL shapes) and [SHACL shape validator](https://www.itb.ec.europa.eu/shacl/shacl/upload) (used to validate SHACL shapes themselves). The same code is used in the TopBraid products (currently aligned with the TopBraid 7.1 release). Feedback and questions should become GitHub issues or sent to TopBraid Users mailing list: https://groups.google.com/forum/#!forum/topbraid-users Please prefix your messages with [SHACL API] To get started, look at the class ValidationUtil in the package org.topbraid.shacl.validation. There is also an [Example Test Case](../master/src/test/java/org/topbraid/shacl/ValidationExample.java) ## Application dependency Releases are available in the central maven repository: ``` <dependency> <groupId>org.topbraid</groupId> <artifactId>shacl</artifactId> <version>*VER*</version> </dependency> ``` ## Command Line Usage Download the latest release from: `https://repo1.maven.org/maven2/org/topbraid/shacl/` The binary distribution is: `https://repo1.maven.org/maven2/org/topbraid/shacl/*VER*/shacl-*VER*-bin.zip`. Two command line utilities are included: shaclvalidate (performs constraint validation) and shaclinfer (performs SHACL rule inferencing). To use them, set up your environment similar to https://jena.apache.org/documentation/tools/ (note that the SHACL download includes Jena). For example, on Windows: ``` SET SHACLROOT=C:\Users\Holger\Desktop\shacl-1.4.1-bin SET PATH=%PATH%;%SHACLROOT%\bin ``` As another example, for Linux, add to .bashrc these lines: ``` # for shacl export SHACLROOT=/home/holger/shacl/shacl-1.4.1-bin/shacl-1.4.1/bin export PATH=$SHACLROOT:$PATH ``` Both tools take the following parameters, for example: `shaclvalidate.bat -datafile myfile.ttl -shapesfile myshapes.ttl` where `-shapesfile` is optional and falls back to using the data graph as shapes graph. Add -validateShapes in case you want to include the metashapes (from the tosh namespace in particular). Currently only Turtle (.ttl) files are supported. The tools print the validation report or the inferences graph to the output screen. <MSG> Merge branch 'master' of https://github.com/TopQuadrant/shacl <DFF> @@ -8,7 +8,7 @@ Can be used to perform SHACL constraint checking in any Jena-based Java applicat This API also serves as a reference implementation developed in parallel to the SHACL spec. **The code is totally not optimized for performance, just for correctness. And there are unfinished gaps!** -The same code is used in the TopBraid products - which is also why we use this particular Jena version. +The same code is used in the TopBraid products (currently ahead of the release cycle, TopBraid 5.2 will catch up). For interoperability with TopBraid, and during the transition period from SPIN to SHACL, this library uses code from org.topbraid.spin packages. These will eventually be refactored. Meanwhile, please don't rely on any class from the org.topbraid.spin packages directly.
1
Merge branch 'master' of https://github.com/TopQuadrant/shacl
1
.md
md
apache-2.0
TopQuadrant/shacl
339
<NME> README.md <BEF> # TopBraid SHACL API **An open source implementation of the W3C Shapes Constraint Language (SHACL) based on Apache Jena.** Contact: Holger Knublauch ([email protected]) Can be used to perform SHACL constraint checking and rule inferencing in any Jena-based Java application. This API also serves as a reference implementation developed in parallel to the SHACL spec. **The code is totally not optimized for performance, just for correctness. And there are unfinished gaps!** The same code is used in the TopBraid products - which is also why we use this particular Jena version. For interoperability with TopBraid, and during the transition period from SPIN to SHACL, this library uses code from org.topbraid.spin packages. These will eventually be refactored. Meanwhile, please don't rely on any class from the org.topbraid.spin packages directly. * [SHACL Compact Syntax](https://w3c.github.io/shacl/shacl-compact-syntax/) Former Coverage until version 1.3.2 * [SHACL JavaScript Extensions](https://www.w3.org/TR/shacl-js/) The TopBraid SHACL API is internally used by the European Commission's generic [SHACL-based RDF validator](https://www.itb.ec.europa.eu/shacl/any/upload) (used to validate RDF content against SHACL shapes) and [SHACL shape validator](https://www.itb.ec.europa.eu/shacl/shacl/upload) (used to validate SHACL shapes themselves). The same code is used in the TopBraid products (currently aligned with the TopBraid 7.1 release). Feedback and questions should become GitHub issues or sent to TopBraid Users mailing list: https://groups.google.com/forum/#!forum/topbraid-users Please prefix your messages with [SHACL API] To get started, look at the class ValidationUtil in the package org.topbraid.shacl.validation. There is also an [Example Test Case](../master/src/test/java/org/topbraid/shacl/ValidationExample.java) ## Application dependency Releases are available in the central maven repository: ``` <dependency> <groupId>org.topbraid</groupId> <artifactId>shacl</artifactId> <version>*VER*</version> </dependency> ``` ## Command Line Usage Download the latest release from: `https://repo1.maven.org/maven2/org/topbraid/shacl/` The binary distribution is: `https://repo1.maven.org/maven2/org/topbraid/shacl/*VER*/shacl-*VER*-bin.zip`. Two command line utilities are included: shaclvalidate (performs constraint validation) and shaclinfer (performs SHACL rule inferencing). To use them, set up your environment similar to https://jena.apache.org/documentation/tools/ (note that the SHACL download includes Jena). For example, on Windows: ``` SET SHACLROOT=C:\Users\Holger\Desktop\shacl-1.4.1-bin SET PATH=%PATH%;%SHACLROOT%\bin ``` As another example, for Linux, add to .bashrc these lines: ``` # for shacl export SHACLROOT=/home/holger/shacl/shacl-1.4.1-bin/shacl-1.4.1/bin export PATH=$SHACLROOT:$PATH ``` Both tools take the following parameters, for example: `shaclvalidate.bat -datafile myfile.ttl -shapesfile myshapes.ttl` where `-shapesfile` is optional and falls back to using the data graph as shapes graph. Add -validateShapes in case you want to include the metashapes (from the tosh namespace in particular). Currently only Turtle (.ttl) files are supported. The tools print the validation report or the inferences graph to the output screen. <MSG> Merge branch 'master' of https://github.com/TopQuadrant/shacl <DFF> @@ -8,7 +8,7 @@ Can be used to perform SHACL constraint checking in any Jena-based Java applicat This API also serves as a reference implementation developed in parallel to the SHACL spec. **The code is totally not optimized for performance, just for correctness. And there are unfinished gaps!** -The same code is used in the TopBraid products - which is also why we use this particular Jena version. +The same code is used in the TopBraid products (currently ahead of the release cycle, TopBraid 5.2 will catch up). For interoperability with TopBraid, and during the transition period from SPIN to SHACL, this library uses code from org.topbraid.spin packages. These will eventually be refactored. Meanwhile, please don't rely on any class from the org.topbraid.spin packages directly.
1
Merge branch 'master' of https://github.com/TopQuadrant/shacl
1
.md
md
apache-2.0
TopQuadrant/shacl
340
<NME> shapes.js <BEF> ADDFILE <MSG> Creating NPM package <DFF> @@ -0,0 +1,524 @@ +/** + * Created by antoniogarrote on 08/05/2017. + */ +$rdf = require("rdflib"); +//$rdf = require("./playgroundrdflib"); +require("./rdfquery"); + +TermFactory.impl = $rdf; + +var exLiteral = $rdf.literal("a", "de"); +Object.defineProperty(Object.getPrototypeOf(exLiteral), "lex", { get: function () { return this.value } }); +Object.getPrototypeOf(exLiteral).isBlankNode = function () { return false }; +Object.getPrototypeOf(exLiteral).isLiteral = function () { return true }; +Object.getPrototypeOf(exLiteral).isURI = function () { return false }; + +var exBlankNode = $rdf.blankNode(); +Object.getPrototypeOf(exBlankNode).isBlankNode = function () { return true }; +Object.getPrototypeOf(exBlankNode).isLiteral = function () { return false }; +Object.getPrototypeOf(exBlankNode).isURI = function () { return false }; + +var exNamedNode = $rdf.namedNode("urn:x-dummy"); +Object.getPrototypeOf(exNamedNode).isBlankNode = function () { return false }; +Object.getPrototypeOf(exNamedNode).isLiteral = function () { return false }; +Object.getPrototypeOf(exNamedNode).isURI = function () { return true }; + +RDFLibGraph = function (store) { + this.store = store; +} + +RDFLibGraph.prototype.find = function (s, p, o) { + return new RDFLibGraphIterator(this.store, s, p, o); +} + +RDFLibGraph.prototype.query = function () { + return RDFQuery(this); +} + +RDFLibGraphIterator = function (store, s, p, o) { + this.index = 0; + this.ss = store.statementsMatching(s, p, o); +} + +RDFLibGraphIterator.prototype.close = function () { + // Do nothing +} + +RDFLibGraphIterator.prototype.next = function () { + if (this.index >= this.ss.length) { + return null; + } + else { + return this.ss[this.index++]; + } +} + +require("./dash"); +require("./shacl-validator"); + +var fs = require("fs"); + +console.log("Loaded!"); + +/********************************/ +/* Examples */ +/********************************/ +var examples = { + + amf1: { + dataFormat: "application/ld+json", + data: '{"http://raml.org/vocabularies/shapes#toValidate": {\ + "http://raml.org/vocabularies/shapes/anon#title": ["hey","ho"],\ + "http://raml.org/vocabularies/shapes/anon#artist": "Antonio Carlos Brasileiro de Almeida Jobim"\ + } }', + shapesFormat: "application/ld+json", + shapes: '{\ + "@context": {\ + "raml-doc": "http://raml.org/vocabularies/document#",\ + "raml-http": "http://raml.org/vocabularies/http#",\ + "raml-shapes": "http://raml.org/vocabularies/shapes#",\ + "hydra": "http://www.w3.org/ns/hydra/core#",\ + "shacl": "http://www.w3.org/ns/shacl#",\ + "schema-org": "http://schema.org/",\ + "xsd": "http://www.w3.org/2001/XMLSchema#"\ + },\ + "@id": "https://mulesoft-labs.github.io/amf-playground/raml/world-music-api/api.raml#/definitions/Entry/items/0",\ + "@type": [\ + "shacl:NodeShape",\ + "shacl:Shape"\ + ],\ + "shacl:targetObjectsOf": {"@id": "raml-shapes:toValidate"},\ + "shacl:property": [\ + {\ + "@id": "https://mulesoft-labs.github.io/amf-playground/raml/world-music-api/api.raml#/definitions/Entry/items/0/property/title",\ + "@type": [\ + "shacl:PropertyShape",\ + "shacl:Shape"\ + ],\ + "raml-shapes:propertyLabel": "title",\ + "shacl:dataType": {\ + "@id": "xsd:string"\ + },\ + "shacl:maxCount": 1,\ + "shacl:minCount": 0,\ + "shacl:path": {\ + "@id": "http://raml.org/vocabularies/shapes/anon#title"\ + }\ + },\ + {\ + "@id": "https://mulesoft-labs.github.io/amf-playground/raml/world-music-api/api.raml#/definitions/Entry/items/0/property/artist",\ + "@type": [\ + "shacl:PropertyShape",\ + "shacl:Shape"\ + ],\ + "raml-shapes:propertyLabel": "artist",\ + "shacl:dataType": {\ + "@id": "xsd:string"\ + },\ + "shacl:maxCount": 1,\ + "shacl:minCount": 0,\ + "shacl:path": {\ + "@id": "http://raml.org/vocabularies/shapes/anon#artist"\ + }\ + }\ + ]\ + }' + }, + + personsTTL: { + dataFormat: "text/turtle", + data: '@prefix ex: <http://example.org/ns#> .\n\ +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\n\ +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .\n\ +@prefix schema: <http://schema.org/> .\n\ +@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .\n\ +\n\ +ex:Bob\n\ + a schema:Person ;\n\ + schema:givenName "Robert" ;\n\ + schema:familyName "Junior" ;\n\ + schema:birthDate "1971-07-07"^^xsd:date ;\n\ + schema:deathDate "1968-09-10"^^xsd:date ;\n\ + schema:address ex:BobsAddress .\n\ +\n\ +ex:BobsAddress\n\ + schema:streetAddress "1600 Amphitheatre Pkway" ;\n\ + schema:postalCode 9404 .', + shapesFormat: "text/turtle", + shapes: '@prefix dash: <http://datashapes.org/dash#> .\n\ +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\n\ +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .\n\ +@prefix schema: <http://schema.org/> .\n\ +@prefix sh: <http://www.w3.org/ns/shacl#> .\n\ +@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .\n\ +\n\ +schema:PersonShape\n\ + a sh:NodeShape ;\n\ + sh:targetClass schema:Person ;\n\ + sh:property [\n\ + sh:path schema:givenName ;\n\ + sh:datatype xsd:string ;\n\ + sh:name "given name" ;\n\ + ] ;\n\ + sh:property [\n\ + sh:path schema:birthDate ;\n\ + sh:lessThan schema:deathDate ;\n\ + sh:maxCount 1 ;\n\ + ] ;\n\ + sh:property [\n\ + sh:path schema:gender ;\n\ + sh:in ( "female" "male" ) ;\n\ + ] ;\n\ + sh:property [\n\ + sh:path schema:address ;\n\ + sh:node schema:AddressShape ;\n\ + ] .\n\ +\n\ +schema:AddressShape\n\ + a sh:NodeShape ;\n\ + sh:closed true ;\n\ + sh:property [\n\ + sh:path schema:streetAddress ;\n\ + sh:datatype xsd:string ;\n\ + ] ;\n\ + sh:property [\n\ + sh:path schema:postalCode ;\n\ + sh:or ( [ sh:datatype xsd:string ] [ sh:datatype xsd:integer ] ) ;\n\ + sh:minInclusive 10000 ;\n\ + sh:maxInclusive 99999 ;\n\ + ] .' + }, + + personsJSON: { + + data: '{\n\ + "@context": { "@vocab": "http://schema.org/" },\n\ +\n\ + "@id": "http://example.org/ns#Bob",\n\ + "@type": "Person",\n\ + "givenName": "Robert",\n\ + "familyName": "Junior",\n\ + "birthDate": "1971-07-07",\n\ + "deathDate": "1968-09-10",\n\ + "address": {\n\ + "@id": "http://example.org/ns#BobsAddress",\n\ + "streetAddress": "1600 Amphitheatre Pkway",\n\ + "postalCode": 9404\n\ + }\n\ +}', + dataFormat: "application/ld+json", + shapes: '', + shapesFormat: "text/turtle" + } +}; +examples.personsJSON.shapes = examples.personsTTL.shapes; +/********************************/ +/********************************/ + +/********************************/ +/* Vocabularies */ +/********************************/ +shapesGraphURI = "urn:x-shacl:shapesGraph"; +dataGraphURI = "urn:x-shacl:dataGraph"; +shaclFile = fs.readFileSync("./shacl.ttl").toString(); +dashFile = fs.readFileSync("./dash.ttl").toString(); +/********************************/ +/********************************/ + +results = null; +shapesStore = $rdf.graph(); +dataStore = $rdf.graph(); +shapesGraph = null; +validationEngine = null; +validationError = null; +sequence = null; + +$shapes = new RDFLibGraph(shapesStore); +shapesGraph = new ShapesGraph(); + + +function postProcessGraph(store, graphURI, newStore) { + + var ss = newStore.statementsMatching(undefined, undefined, undefined); + for (var i = 0; i < ss.length; i++) { + var object = ss[i].object; + if (T("xsd:boolean").equals(object.datatype)) { + if ("0" == object.value || "false" === object.value) { + store.add(ss[i].subject, ss[i].predicate, T("false"), graphURI); + } + else { + store.add(ss[i].subject, ss[i].predicate, T("true"), graphURI); + } + } + else if (object.termType === 'collection') { + var items = object.elements; + store.add(ss[i].subject, ss[i].predicate, createRDFListNode(store, items, 0)); + } + else { + store.add(ss[i].subject, ss[i].predicate, ss[i].object, graphURI); + } + } + + for (var prefix in newStore.namespaces) { + var ns = newStore.namespaces[prefix]; + store.namespaces[prefix] = ns; + } +} + +var defaultHandleError = function (ex) { + console.log("ERROR " + ex); + console.log(ex); +} + +function loadGraph(str, store, graphURI, mimeType, andThen, handleError) { + var newStore = $rdf.graph(); + handleError = handleError || defaultHandleError; + if (mimeType === "application/ld+json") { + var error = false; + $rdf.parse(str, newStore, graphURI, mimeType, function (err, kb) { + if (err) { + error = true; + handleError(err) + } + else if (!error) { + postProcessGraph(store, graphURI, newStore); + andThen(); + } + }); + } + else { + try { + $rdf.parse(str, newStore, graphURI, mimeType); + postProcessGraph(store, graphURI, newStore); + andThen(); + } + catch (ex) { + handleError(ex); + } + } +} + +function parseDataGraph(text, mediaType, andThen) { + var newStore = $rdf.graph(); + loadGraph(text, newStore, dataGraphURI, mediaType, function () { + dataStore = newStore; + $data = new RDFLibGraph(dataStore); + andThen(); + }, function (ex) { + showError(ex); + }); +} + +function updateValidationEngine() { + results = []; + validationEngine = new ValidationEngine(shapesGraph); + try { + validationError = null; + if (sequence) { + sequence = []; + } + validationEngine.validateAll(); + } + catch (ex) { + validationError = ex; + } +} + +function showStatus(s) { console.log(s); } +function showError(s) { console.log(s); } + +nodeLabel = function(node, store) { + if (node.isURI()) { + for (prefix in store.namespaces) { + var ns = store.namespaces[prefix]; + if (node.value.indexOf(ns) == 0) { + return prefix + ":" + node.value.substring(ns.length); + } + } + return "<" + node.value + ">"; + } + else if (node.isBlankNode()) { + return "Blank node " + node.toString(); + } + else { + return "" + node; + } +} + +function showValidationResults() { + if (validationError) { + console.log("(Failure)"); + console.log("VALIDATION FAILURE: " + validationError); + } + else { + console.log("(Valid)"); + console.log("Found " + results.length + " results"); + var str = ""; + for (var i = 0; i < results.length; i++) { + str += results[i].str; + str += "\n] .\n"; + } + console.log(str); + + if (sequence) { + for (var i = 0; i < sequence.length; i++) { + var s = sequence[i]; + var text = ""; + text += s.f.funcName + "("; + for (var a = 0; a < s.args.length; a++) { + if (a > 0) { + text += ", "; + } + var arg = s.args[a]; + if (!arg) { + text += "null"; + } + else { + text += nodeLabel(arg, dataStore); + } + } + text += ")"; + console.log(text); + if (s.count) { + var span = " -> " + s.count + " violations"; + console.log(span); + } + } + } + } +} + +function parseShapesGraph(text, mediaType, andThen) { + var handleError = function (ex) { + console.log("ERROR " + ex); + console.log(ex); + } + var newShapesStore = $rdf.graph(); + loadGraph(text, newShapesStore, shapesGraphURI, mediaType, function () { + loadGraph(shaclFile, newShapesStore, "http://shacl.org", "text/turtle", function () { + loadGraph(dashFile, newShapesStore, "http://datashapes.org/dash", "text/turtle", function () { + shapesStore = newShapesStore; + $shapes = new RDFLibGraph(shapesStore); + andThen(); + }); + }, handleError); + }, handleError); +} + + +function updateDataGraph(text, mediaType, cb) { + var startTime = new Date().getTime(); + parseDataGraph(text, mediaType, function () { + var midTime = new Date().getTime(); + updateValidationEngine(); + var endTime = new Date().getTime(); + showStatus("Parsing took " + (midTime - startTime) + " ms. Validating the data took " + (endTime - midTime) + " ms."); + showValidationResults(); + if (cb) { + cb(); + } + }); +} + + +function updateShapesGraph(shapes, mediaType, cb) { + var startTime = new Date().getTime(); + parseShapesGraph(shapes, mediaType, function () { + var midTime = new Date().getTime(); + shapesGraph = new ShapesGraph(); + var midTime2 = new Date().getTime(); + updateValidationEngine(); + var endTime = new Date().getTime(); + showStatus("Parsing took " + (midTime - startTime) + " ms. Preparing the shapes took " + (midTime2 - midTime) + " ms. Validation the data took " + (endTime - midTime2) + " ms."); + showValidationResults(); + if (cb) { + cb(); + } + }); +} +function createRDFListNode(store, items, index) { + if (index >= items.length) { + return T("rdf:nil"); + } + else { + var bnode = TermFactory.blankNode(); + store.add(bnode, T("rdf:first"), items[index]); + store.add(bnode, T("rdf:rest"), createRDFListNode(store, items, index + 1)); + return bnode; + } +} + +function validate(data, dataMediaType, shapes, shapesMediaType, cb) { + updateDataGraph(data, dataMediaType, function () { + updateShapesGraph(shapes, shapesMediaType, function () { + console.log("DONE!"); + cb(); + }); + }); +} + +ValidationEngine.prototype.addResultProperty = function(result, predicate, object) { + result.str += "\n\t"; + if(T("rdf:type").equals(predicate)) { + result.str += "a "; + } + else { + result.str += nodeLabel(predicate, shapesStore) + " "; + } + if(object.isURI()) { + result.str += nodeLabel(object, shapesStore); + } + else if(object.isBlankNode()) { + result.str += object.toString(); + } + else { + if(T("xsd:boolean").equals(object.datatype) || T("xsd:integer").equals(object.datatype)) { + result.str += object.lex; + } + else { + result.str += '"' + object.lex + '"'; + if(object.language) { + result.str += '@' + object.language; + } + else if(!T("xsd:string").equals(object.datatype)) { + result.str += '^^' + nodeLabel(object.datatype, shapesStore); + } + } + } + result.str += " ;"; +} + +ValidationEngine.prototype.createResultObject = function() { + var result = { str : "[" }; + results.push(result); + return result; +} + +ValidationFunction.prototype.doExecute = function(args) { + if(sequence) { + var s = {f : this, args : args, depth : SHACL.depth }; + sequence.push(s); + var result = this.func.apply(global, args); + if(result === false || typeof result === 'string' || typeof result === 'object') { + s.count = 1; + } + else if(Array.isArray(result)) { + s.count = result.length; + } + return result; + } + else { + return this.func.apply(global, args); + } +} + +console.log("TESTING THE THING"); +console.log(examples.amf1.shapes); +validate( + examples.amf1.data, + examples.amf1.dataFormat, + examples.amf1.shapes, + examples.amf1.shapesFormat, + function () { + console.log("AND BACK AGAIN"); + });
524
Creating NPM package
0
.js
js
apache-2.0
TopQuadrant/shacl
341
<NME> shapes.js <BEF> ADDFILE <MSG> Creating NPM package <DFF> @@ -0,0 +1,524 @@ +/** + * Created by antoniogarrote on 08/05/2017. + */ +$rdf = require("rdflib"); +//$rdf = require("./playgroundrdflib"); +require("./rdfquery"); + +TermFactory.impl = $rdf; + +var exLiteral = $rdf.literal("a", "de"); +Object.defineProperty(Object.getPrototypeOf(exLiteral), "lex", { get: function () { return this.value } }); +Object.getPrototypeOf(exLiteral).isBlankNode = function () { return false }; +Object.getPrototypeOf(exLiteral).isLiteral = function () { return true }; +Object.getPrototypeOf(exLiteral).isURI = function () { return false }; + +var exBlankNode = $rdf.blankNode(); +Object.getPrototypeOf(exBlankNode).isBlankNode = function () { return true }; +Object.getPrototypeOf(exBlankNode).isLiteral = function () { return false }; +Object.getPrototypeOf(exBlankNode).isURI = function () { return false }; + +var exNamedNode = $rdf.namedNode("urn:x-dummy"); +Object.getPrototypeOf(exNamedNode).isBlankNode = function () { return false }; +Object.getPrototypeOf(exNamedNode).isLiteral = function () { return false }; +Object.getPrototypeOf(exNamedNode).isURI = function () { return true }; + +RDFLibGraph = function (store) { + this.store = store; +} + +RDFLibGraph.prototype.find = function (s, p, o) { + return new RDFLibGraphIterator(this.store, s, p, o); +} + +RDFLibGraph.prototype.query = function () { + return RDFQuery(this); +} + +RDFLibGraphIterator = function (store, s, p, o) { + this.index = 0; + this.ss = store.statementsMatching(s, p, o); +} + +RDFLibGraphIterator.prototype.close = function () { + // Do nothing +} + +RDFLibGraphIterator.prototype.next = function () { + if (this.index >= this.ss.length) { + return null; + } + else { + return this.ss[this.index++]; + } +} + +require("./dash"); +require("./shacl-validator"); + +var fs = require("fs"); + +console.log("Loaded!"); + +/********************************/ +/* Examples */ +/********************************/ +var examples = { + + amf1: { + dataFormat: "application/ld+json", + data: '{"http://raml.org/vocabularies/shapes#toValidate": {\ + "http://raml.org/vocabularies/shapes/anon#title": ["hey","ho"],\ + "http://raml.org/vocabularies/shapes/anon#artist": "Antonio Carlos Brasileiro de Almeida Jobim"\ + } }', + shapesFormat: "application/ld+json", + shapes: '{\ + "@context": {\ + "raml-doc": "http://raml.org/vocabularies/document#",\ + "raml-http": "http://raml.org/vocabularies/http#",\ + "raml-shapes": "http://raml.org/vocabularies/shapes#",\ + "hydra": "http://www.w3.org/ns/hydra/core#",\ + "shacl": "http://www.w3.org/ns/shacl#",\ + "schema-org": "http://schema.org/",\ + "xsd": "http://www.w3.org/2001/XMLSchema#"\ + },\ + "@id": "https://mulesoft-labs.github.io/amf-playground/raml/world-music-api/api.raml#/definitions/Entry/items/0",\ + "@type": [\ + "shacl:NodeShape",\ + "shacl:Shape"\ + ],\ + "shacl:targetObjectsOf": {"@id": "raml-shapes:toValidate"},\ + "shacl:property": [\ + {\ + "@id": "https://mulesoft-labs.github.io/amf-playground/raml/world-music-api/api.raml#/definitions/Entry/items/0/property/title",\ + "@type": [\ + "shacl:PropertyShape",\ + "shacl:Shape"\ + ],\ + "raml-shapes:propertyLabel": "title",\ + "shacl:dataType": {\ + "@id": "xsd:string"\ + },\ + "shacl:maxCount": 1,\ + "shacl:minCount": 0,\ + "shacl:path": {\ + "@id": "http://raml.org/vocabularies/shapes/anon#title"\ + }\ + },\ + {\ + "@id": "https://mulesoft-labs.github.io/amf-playground/raml/world-music-api/api.raml#/definitions/Entry/items/0/property/artist",\ + "@type": [\ + "shacl:PropertyShape",\ + "shacl:Shape"\ + ],\ + "raml-shapes:propertyLabel": "artist",\ + "shacl:dataType": {\ + "@id": "xsd:string"\ + },\ + "shacl:maxCount": 1,\ + "shacl:minCount": 0,\ + "shacl:path": {\ + "@id": "http://raml.org/vocabularies/shapes/anon#artist"\ + }\ + }\ + ]\ + }' + }, + + personsTTL: { + dataFormat: "text/turtle", + data: '@prefix ex: <http://example.org/ns#> .\n\ +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\n\ +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .\n\ +@prefix schema: <http://schema.org/> .\n\ +@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .\n\ +\n\ +ex:Bob\n\ + a schema:Person ;\n\ + schema:givenName "Robert" ;\n\ + schema:familyName "Junior" ;\n\ + schema:birthDate "1971-07-07"^^xsd:date ;\n\ + schema:deathDate "1968-09-10"^^xsd:date ;\n\ + schema:address ex:BobsAddress .\n\ +\n\ +ex:BobsAddress\n\ + schema:streetAddress "1600 Amphitheatre Pkway" ;\n\ + schema:postalCode 9404 .', + shapesFormat: "text/turtle", + shapes: '@prefix dash: <http://datashapes.org/dash#> .\n\ +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\n\ +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .\n\ +@prefix schema: <http://schema.org/> .\n\ +@prefix sh: <http://www.w3.org/ns/shacl#> .\n\ +@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .\n\ +\n\ +schema:PersonShape\n\ + a sh:NodeShape ;\n\ + sh:targetClass schema:Person ;\n\ + sh:property [\n\ + sh:path schema:givenName ;\n\ + sh:datatype xsd:string ;\n\ + sh:name "given name" ;\n\ + ] ;\n\ + sh:property [\n\ + sh:path schema:birthDate ;\n\ + sh:lessThan schema:deathDate ;\n\ + sh:maxCount 1 ;\n\ + ] ;\n\ + sh:property [\n\ + sh:path schema:gender ;\n\ + sh:in ( "female" "male" ) ;\n\ + ] ;\n\ + sh:property [\n\ + sh:path schema:address ;\n\ + sh:node schema:AddressShape ;\n\ + ] .\n\ +\n\ +schema:AddressShape\n\ + a sh:NodeShape ;\n\ + sh:closed true ;\n\ + sh:property [\n\ + sh:path schema:streetAddress ;\n\ + sh:datatype xsd:string ;\n\ + ] ;\n\ + sh:property [\n\ + sh:path schema:postalCode ;\n\ + sh:or ( [ sh:datatype xsd:string ] [ sh:datatype xsd:integer ] ) ;\n\ + sh:minInclusive 10000 ;\n\ + sh:maxInclusive 99999 ;\n\ + ] .' + }, + + personsJSON: { + + data: '{\n\ + "@context": { "@vocab": "http://schema.org/" },\n\ +\n\ + "@id": "http://example.org/ns#Bob",\n\ + "@type": "Person",\n\ + "givenName": "Robert",\n\ + "familyName": "Junior",\n\ + "birthDate": "1971-07-07",\n\ + "deathDate": "1968-09-10",\n\ + "address": {\n\ + "@id": "http://example.org/ns#BobsAddress",\n\ + "streetAddress": "1600 Amphitheatre Pkway",\n\ + "postalCode": 9404\n\ + }\n\ +}', + dataFormat: "application/ld+json", + shapes: '', + shapesFormat: "text/turtle" + } +}; +examples.personsJSON.shapes = examples.personsTTL.shapes; +/********************************/ +/********************************/ + +/********************************/ +/* Vocabularies */ +/********************************/ +shapesGraphURI = "urn:x-shacl:shapesGraph"; +dataGraphURI = "urn:x-shacl:dataGraph"; +shaclFile = fs.readFileSync("./shacl.ttl").toString(); +dashFile = fs.readFileSync("./dash.ttl").toString(); +/********************************/ +/********************************/ + +results = null; +shapesStore = $rdf.graph(); +dataStore = $rdf.graph(); +shapesGraph = null; +validationEngine = null; +validationError = null; +sequence = null; + +$shapes = new RDFLibGraph(shapesStore); +shapesGraph = new ShapesGraph(); + + +function postProcessGraph(store, graphURI, newStore) { + + var ss = newStore.statementsMatching(undefined, undefined, undefined); + for (var i = 0; i < ss.length; i++) { + var object = ss[i].object; + if (T("xsd:boolean").equals(object.datatype)) { + if ("0" == object.value || "false" === object.value) { + store.add(ss[i].subject, ss[i].predicate, T("false"), graphURI); + } + else { + store.add(ss[i].subject, ss[i].predicate, T("true"), graphURI); + } + } + else if (object.termType === 'collection') { + var items = object.elements; + store.add(ss[i].subject, ss[i].predicate, createRDFListNode(store, items, 0)); + } + else { + store.add(ss[i].subject, ss[i].predicate, ss[i].object, graphURI); + } + } + + for (var prefix in newStore.namespaces) { + var ns = newStore.namespaces[prefix]; + store.namespaces[prefix] = ns; + } +} + +var defaultHandleError = function (ex) { + console.log("ERROR " + ex); + console.log(ex); +} + +function loadGraph(str, store, graphURI, mimeType, andThen, handleError) { + var newStore = $rdf.graph(); + handleError = handleError || defaultHandleError; + if (mimeType === "application/ld+json") { + var error = false; + $rdf.parse(str, newStore, graphURI, mimeType, function (err, kb) { + if (err) { + error = true; + handleError(err) + } + else if (!error) { + postProcessGraph(store, graphURI, newStore); + andThen(); + } + }); + } + else { + try { + $rdf.parse(str, newStore, graphURI, mimeType); + postProcessGraph(store, graphURI, newStore); + andThen(); + } + catch (ex) { + handleError(ex); + } + } +} + +function parseDataGraph(text, mediaType, andThen) { + var newStore = $rdf.graph(); + loadGraph(text, newStore, dataGraphURI, mediaType, function () { + dataStore = newStore; + $data = new RDFLibGraph(dataStore); + andThen(); + }, function (ex) { + showError(ex); + }); +} + +function updateValidationEngine() { + results = []; + validationEngine = new ValidationEngine(shapesGraph); + try { + validationError = null; + if (sequence) { + sequence = []; + } + validationEngine.validateAll(); + } + catch (ex) { + validationError = ex; + } +} + +function showStatus(s) { console.log(s); } +function showError(s) { console.log(s); } + +nodeLabel = function(node, store) { + if (node.isURI()) { + for (prefix in store.namespaces) { + var ns = store.namespaces[prefix]; + if (node.value.indexOf(ns) == 0) { + return prefix + ":" + node.value.substring(ns.length); + } + } + return "<" + node.value + ">"; + } + else if (node.isBlankNode()) { + return "Blank node " + node.toString(); + } + else { + return "" + node; + } +} + +function showValidationResults() { + if (validationError) { + console.log("(Failure)"); + console.log("VALIDATION FAILURE: " + validationError); + } + else { + console.log("(Valid)"); + console.log("Found " + results.length + " results"); + var str = ""; + for (var i = 0; i < results.length; i++) { + str += results[i].str; + str += "\n] .\n"; + } + console.log(str); + + if (sequence) { + for (var i = 0; i < sequence.length; i++) { + var s = sequence[i]; + var text = ""; + text += s.f.funcName + "("; + for (var a = 0; a < s.args.length; a++) { + if (a > 0) { + text += ", "; + } + var arg = s.args[a]; + if (!arg) { + text += "null"; + } + else { + text += nodeLabel(arg, dataStore); + } + } + text += ")"; + console.log(text); + if (s.count) { + var span = " -> " + s.count + " violations"; + console.log(span); + } + } + } + } +} + +function parseShapesGraph(text, mediaType, andThen) { + var handleError = function (ex) { + console.log("ERROR " + ex); + console.log(ex); + } + var newShapesStore = $rdf.graph(); + loadGraph(text, newShapesStore, shapesGraphURI, mediaType, function () { + loadGraph(shaclFile, newShapesStore, "http://shacl.org", "text/turtle", function () { + loadGraph(dashFile, newShapesStore, "http://datashapes.org/dash", "text/turtle", function () { + shapesStore = newShapesStore; + $shapes = new RDFLibGraph(shapesStore); + andThen(); + }); + }, handleError); + }, handleError); +} + + +function updateDataGraph(text, mediaType, cb) { + var startTime = new Date().getTime(); + parseDataGraph(text, mediaType, function () { + var midTime = new Date().getTime(); + updateValidationEngine(); + var endTime = new Date().getTime(); + showStatus("Parsing took " + (midTime - startTime) + " ms. Validating the data took " + (endTime - midTime) + " ms."); + showValidationResults(); + if (cb) { + cb(); + } + }); +} + + +function updateShapesGraph(shapes, mediaType, cb) { + var startTime = new Date().getTime(); + parseShapesGraph(shapes, mediaType, function () { + var midTime = new Date().getTime(); + shapesGraph = new ShapesGraph(); + var midTime2 = new Date().getTime(); + updateValidationEngine(); + var endTime = new Date().getTime(); + showStatus("Parsing took " + (midTime - startTime) + " ms. Preparing the shapes took " + (midTime2 - midTime) + " ms. Validation the data took " + (endTime - midTime2) + " ms."); + showValidationResults(); + if (cb) { + cb(); + } + }); +} +function createRDFListNode(store, items, index) { + if (index >= items.length) { + return T("rdf:nil"); + } + else { + var bnode = TermFactory.blankNode(); + store.add(bnode, T("rdf:first"), items[index]); + store.add(bnode, T("rdf:rest"), createRDFListNode(store, items, index + 1)); + return bnode; + } +} + +function validate(data, dataMediaType, shapes, shapesMediaType, cb) { + updateDataGraph(data, dataMediaType, function () { + updateShapesGraph(shapes, shapesMediaType, function () { + console.log("DONE!"); + cb(); + }); + }); +} + +ValidationEngine.prototype.addResultProperty = function(result, predicate, object) { + result.str += "\n\t"; + if(T("rdf:type").equals(predicate)) { + result.str += "a "; + } + else { + result.str += nodeLabel(predicate, shapesStore) + " "; + } + if(object.isURI()) { + result.str += nodeLabel(object, shapesStore); + } + else if(object.isBlankNode()) { + result.str += object.toString(); + } + else { + if(T("xsd:boolean").equals(object.datatype) || T("xsd:integer").equals(object.datatype)) { + result.str += object.lex; + } + else { + result.str += '"' + object.lex + '"'; + if(object.language) { + result.str += '@' + object.language; + } + else if(!T("xsd:string").equals(object.datatype)) { + result.str += '^^' + nodeLabel(object.datatype, shapesStore); + } + } + } + result.str += " ;"; +} + +ValidationEngine.prototype.createResultObject = function() { + var result = { str : "[" }; + results.push(result); + return result; +} + +ValidationFunction.prototype.doExecute = function(args) { + if(sequence) { + var s = {f : this, args : args, depth : SHACL.depth }; + sequence.push(s); + var result = this.func.apply(global, args); + if(result === false || typeof result === 'string' || typeof result === 'object') { + s.count = 1; + } + else if(Array.isArray(result)) { + s.count = result.length; + } + return result; + } + else { + return this.func.apply(global, args); + } +} + +console.log("TESTING THE THING"); +console.log(examples.amf1.shapes); +validate( + examples.amf1.data, + examples.amf1.dataFormat, + examples.amf1.shapes, + examples.amf1.shapesFormat, + function () { + console.log("AND BACK AGAIN"); + });
524
Creating NPM package
0
.js
js
apache-2.0
TopQuadrant/shacl
342
<NME> SH.java <BEF> /* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * See the NOTICE file distributed with this work for additional * information regarding copyright ownership. */ package org.topbraid.shacl.vocabulary; import org.apache.jena.rdf.model.Property; import org.apache.jena.rdf.model.Resource; import org.apache.jena.rdf.model.ResourceFactory; import org.apache.jena.sparql.core.Var; /** * Vocabulary for http://www.w3.org/ns/shacl# * * @author Holger Knublauch */ public class SH { public final static String BASE_URI = "http://www.w3.org/ns/shacl#"; public final static String NAME = "SHACL"; public final static String NS = BASE_URI; public final static String PREFIX = "sh"; public final static Resource AbstractResult = ResourceFactory.createResource(NS + "AbstractResult"); public final static Resource AndConstraintComponent = ResourceFactory.createResource(NS + "AndConstraintComponent"); public final static Resource BlankNode = ResourceFactory.createResource(NS + "BlankNode"); public final static Resource BlankNodeOrIRI = ResourceFactory.createResource(NS + "BlankNodeOrIRI"); public final static Resource BlankNodeOrLiteral = ResourceFactory.createResource(NS + "BlankNodeOrLiteral"); public final static Resource ClassConstraintComponent = ResourceFactory.createResource(NS + "ClassConstraintComponent"); public final static Resource ClosedConstraintComponent = ResourceFactory.createResource(NS + "ClosedConstraintComponent"); public final static Resource Constraint = ResourceFactory.createResource(NS + "Constraint"); public final static Resource ConstraintComponent = ResourceFactory.createResource(NS + "ConstraintComponent"); public final static Resource DatatypeConstraintComponent = ResourceFactory.createResource(NS + "DatatypeConstraintComponent"); public final static Resource DisjointConstraintComponent = ResourceFactory.createResource(NS + "DisjointConstraintComponent"); public final static Resource EqualsConstraintComponent = ResourceFactory.createResource(NS + "EqualsConstraintComponent"); public final static Resource NativeScope = ResourceFactory.createResource(NS + "NativeScope"); public final static Resource NodeConstraintTemplate = ResourceFactory.createResource(NS + "NodeConstraintTemplate"); public final static Resource OrConstraint = ResourceFactory.createResource(NS + "OrConstraint"); public final static Resource IRIOrLiteral = ResourceFactory.createResource(NS + "IRIOrLiteral"); public final static Resource LanguageInConstraintComponent = ResourceFactory.createResource(NS + "LanguageInConstraintComponent"); public final static Resource LessThanConstraintComponent = ResourceFactory.createResource(NS + "LessThanConstraintComponent"); public final static Resource LessThanOrEqualsConstraintComponent = ResourceFactory.createResource(NS + "LessThanOrEqualsConstraintComponent"); public final static Resource Shape = ResourceFactory.createResource(NS + "Shape"); public final static Resource ShapeClass = ResourceFactory.createResource(NS + "ShapeClass"); public final static Resource Template = ResourceFactory.createResource(NS + "Template"); public final static Resource MinCountConstraintComponent = ResourceFactory.createResource(NS + "MinCountConstraintComponent"); public final static Resource MinExclusiveConstraintComponent = ResourceFactory.createResource(NS + "MinExclusiveConstraintComponent"); public final static Resource MinInclusiveConstraintComponent = ResourceFactory.createResource(NS + "MinInclusiveConstraintComponent"); public final static Resource MinLengthConstraintComponent = ResourceFactory.createResource(NS + "MinLengthConstraintComponent"); public final static Resource NodeConstraintComponent = ResourceFactory.createResource(NS + "NodeConstraintComponent"); public final static Resource NodeKindConstraintComponent = ResourceFactory.createResource(NS + "NodeKindConstraintComponent"); public final static Resource NodeShape = ResourceFactory.createResource(NS + "NodeShape"); public final static Resource NotConstraintComponent = ResourceFactory.createResource(NS + "NotConstraintComponent"); public final static Resource OrConstraintComponent = ResourceFactory.createResource(NS + "OrConstraintComponent"); public final static Resource Parameter = ResourceFactory.createResource(NS + "Parameter"); public final static Resource Parameterizable = ResourceFactory.createResource(NS + "Parameterizable"); public final static Resource PatternConstraintComponent = ResourceFactory.createResource(NS + "PatternConstraintComponent"); public final static Resource PrefixDeclaration = ResourceFactory.createResource(NS + "PrefixDeclaration"); public final static Resource PropertyGroup = ResourceFactory.createResource(NS + "PropertyGroup"); public final static Resource PropertyShape = ResourceFactory.createResource(NS + "PropertyShape"); public final static Resource PropertyConstraintComponent = ResourceFactory.createResource(NS + "PropertyConstraintComponent"); public final static Resource QualifiedMaxCountConstraintComponent = ResourceFactory.createResource(NS + "QualifiedMaxCountConstraintComponent"); public final static Resource QualifiedMinCountConstraintComponent = ResourceFactory.createResource(NS + "QualifiedMinCountConstraintComponent"); public final static Resource ResultAnnotation = ResourceFactory.createResource(NS + "ResultAnnotation"); public final static Resource Shape = ResourceFactory.createResource(NS + "Shape"); public final static Resource SPARQLAskValidator = ResourceFactory.createResource(NS + "SPARQLAskValidator"); public final static Resource SPARQLConstraint = ResourceFactory.createResource(NS + "SPARQLConstraint"); public final static Resource SPARQLConstraintComponent = ResourceFactory.createResource(NS + "SPARQLConstraintComponent"); public final static Resource SPARQLConstructRule = ResourceFactory.createResource(NS + "SPARQLConstructRule"); public final static Resource SPARQLExecutable = ResourceFactory.createResource(NS + "SPARQLExecutable"); public final static Resource SPARQLFunction = ResourceFactory.createResource(NS + "SPARQLFunction"); public final static Resource SPARQLSelectValidator = ResourceFactory.createResource(NS + "SPARQLSelectValidator"); public final static Resource SPARQLTarget = ResourceFactory.createResource(NS + "SPARQLTarget"); public final static Resource SPARQLValuesDeriver = ResourceFactory.createResource(NS + "SPARQLValuesDeriver"); public final static Resource UniqueLangConstraintComponent = ResourceFactory.createResource(NS + "UniqueLangConstraintComponent"); public final static Resource ValidationReport = ResourceFactory.createResource(NS + "ValidationReport"); public final static Resource ValidationResult = ResourceFactory.createResource(NS + "ValidationResult"); public final static Resource Validator = ResourceFactory.createResource(NS + "Validator"); public final static Resource Violation = ResourceFactory.createResource(NS + "Violation"); public final static Resource Warning = ResourceFactory.createResource(NS + "Warning"); public final static Resource XoneConstraintComponent = ResourceFactory.createResource(NS + "XoneConstraintComponent"); public final static Property alternativePath = ResourceFactory.createProperty(NS + "alternativePath"); public final static Property and = ResourceFactory.createProperty(NS + "and"); public final static Property ask = ResourceFactory.createProperty(NS + "ask"); public final static Property class_ = ResourceFactory.createProperty(NS + "class"); public final static Property closed = ResourceFactory.createProperty(NS + "closed"); public final static Property condition = ResourceFactory.createProperty(NS + "condition"); public final static Property conforms = ResourceFactory.createProperty(NS + "conforms"); public final static Property construct = ResourceFactory.createProperty(NS + "construct"); public final static Property datatype = ResourceFactory.createProperty(NS + "datatype"); public final static Property deactivated = ResourceFactory.createProperty(NS + "deactivated"); public final static Property declare = ResourceFactory.createProperty(NS + "declare"); public final static Property defaultValue = ResourceFactory.createProperty(NS + "defaultValue"); public final static Property detail = ResourceFactory.createProperty(NS + "detail"); public final static Property description = ResourceFactory.createProperty(NS + "description"); public final static Property disjoint = ResourceFactory.createProperty(NS + "disjoint"); public final static Property entailment = ResourceFactory.createProperty(NS + "entailment"); public final static Property equals = ResourceFactory.createProperty(NS + "equals"); public final static Property flags = ResourceFactory.createProperty(NS + "flags"); public final static Property focusNode = ResourceFactory.createProperty(NS + "focusNode"); public final static Property group = ResourceFactory.createProperty(NS + "group"); public final static Property hasValue = ResourceFactory.createProperty(NS + "hasValue"); public final static Property ignoredProperties = ResourceFactory.createProperty(NS + "ignoredProperties"); public final static Property in = ResourceFactory.createProperty(NS + "in"); public final static Property inversePath = ResourceFactory.createProperty(NS + "inversePath"); public final static Property labelTemplate = ResourceFactory.createProperty(NS + "labelTemplate"); public final static Property languageIn = ResourceFactory.createProperty(NS + "languageIn"); public final static Property lessThan = ResourceFactory.createProperty(NS + "lessThan"); public final static Property lessThanOrEquals = ResourceFactory.createProperty(NS + "lessThanOrEquals"); public final static Property maxCount = ResourceFactory.createProperty(NS + "maxCount"); public final static Property maxExclusive = ResourceFactory.createProperty(NS + "maxExclusive"); public final static Property maxInclusive = ResourceFactory.createProperty(NS + "maxInclusive"); public final static Property maxLength = ResourceFactory.createProperty(NS + "maxLength"); public final static Property message = ResourceFactory.createProperty(NS + "message"); public final static Property minCount = ResourceFactory.createProperty(NS + "minCount"); public final static Property minExclusive = ResourceFactory.createProperty(NS + "minExclusive"); public final static Property minInclusive = ResourceFactory.createProperty(NS + "minInclusive"); public final static Property minLength = ResourceFactory.createProperty(NS + "minLength"); public final static Property name = ResourceFactory.createProperty(NS + "name"); public final static Property namespace = ResourceFactory.createProperty(NS + "namespace"); public final static Property node = ResourceFactory.createProperty(NS + "node"); public final static Property nodeKind = ResourceFactory.createProperty(NS + "nodeKind"); public final static Property nodeValidator = ResourceFactory.createProperty(NS + "nodeValidator"); public final static Property not = ResourceFactory.createProperty(NS + "not"); public final static Property oneOrMorePath = ResourceFactory.createProperty(NS + "oneOrMorePath"); public final static Property optional = ResourceFactory.createProperty(NS + "optional"); public final static Property or = ResourceFactory.createProperty(NS + "or"); public final static Property order = ResourceFactory.createProperty(NS + "order"); public final static Property parameter = ResourceFactory.createProperty(NS + "parameter"); public final static Property path = ResourceFactory.createProperty(NS + "path"); public final static Property pattern = ResourceFactory.createProperty(NS + "pattern"); public final static Property prefix = ResourceFactory.createProperty(NS + "prefix"); public final static Property prefixes = ResourceFactory.createProperty(NS + "prefixes"); public final static Property property = ResourceFactory.createProperty(NS + "property"); public final static Property propertyValidator = ResourceFactory.createProperty(NS + "propertyValidator"); public final static Property qualifiedMaxCount = ResourceFactory.createProperty(NS + "qualifiedMaxCount"); public final static Property qualifiedMinCount = ResourceFactory.createProperty(NS + "qualifiedMinCount"); public final static Property qualifiedValueShape = ResourceFactory.createProperty(NS + "qualifiedValueShape"); public final static Property qualifiedValueShapesDisjoint = ResourceFactory.createProperty(NS + "qualifiedValueShapesDisjoint"); public final static Property result = ResourceFactory.createProperty(NS + "result"); public final static Property resultMessage = ResourceFactory.createProperty(NS + "resultMessage"); public final static Property resultPath = ResourceFactory.createProperty(NS + "resultPath"); public final static Property resultSeverity = ResourceFactory.createProperty(NS + "resultSeverity"); public final static Property select = ResourceFactory.createProperty(NS + "select"); public final static Property severity = ResourceFactory.createProperty(NS + "severity"); public final static Property shapesGraph = ResourceFactory.createProperty(NS + "shapesGraph"); public final static Property sourceConstraint = ResourceFactory.createProperty(NS + "sourceConstraint"); public final static Property sourceConstraintComponent = ResourceFactory.createProperty(NS + "sourceConstraintComponent"); public final static Property sourceShape = ResourceFactory.createProperty(NS + "sourceShape"); public final static Property sparql = ResourceFactory.createProperty(NS + "sparql"); public final static Property targetClass = ResourceFactory.createProperty(NS + "targetClass"); public final static Property targetNode = ResourceFactory.createProperty(NS + "targetNode"); public final static Property targetObjectsOf = ResourceFactory.createProperty(NS + "targetObjectsOf"); public final static Property targetSubjectsOf = ResourceFactory.createProperty(NS + "targetSubjectsOf"); public final static Property uniqueLang = ResourceFactory.createProperty(NS + "uniqueLang"); public final static Property update = ResourceFactory.createProperty(NS + "update"); public final static Property validator = ResourceFactory.createProperty(NS + "validator"); public final static Property value = ResourceFactory.createProperty(NS + "value"); public final static Property zeroOrMorePath = ResourceFactory.createProperty(NS + "zeroOrMorePath"); public final static Property zeroOrOnePath = ResourceFactory.createProperty(NS + "zeroOrOnePath"); // Advanced features public final static Resource ExpressionConstraintComponent = ResourceFactory.createResource(NS + "ExpressionConstraintComponent"); public final static Resource Function = ResourceFactory.createResource(NS + "Function"); public final static Resource JSConstraint = ResourceFactory.createResource(NS + "JSConstraint"); public final static Resource JSConstraintComponent = ResourceFactory.createResource(NS + "JSConstraintComponent"); public final static Resource JSExecutable = ResourceFactory.createResource(NS + "JSExecutable"); public final static Resource JSFunction = ResourceFactory.createResource(NS + "JSFunction"); public final static Resource JSLibrary = ResourceFactory.createResource(NS + "JSLibrary"); public final static Resource JSRule = ResourceFactory.createResource(NS + "JSRule"); public final static Resource JSTarget = ResourceFactory.createResource(NS + "JSTarget"); public final static Resource JSTargetType = ResourceFactory.createResource(NS + "JSTargetType"); public final static Resource JSValidator = ResourceFactory.createResource(NS + "JSValidator"); public final static Resource Rule = ResourceFactory.createResource(NS + "Rule"); public final static Resource Rules = ResourceFactory.createResource(NS + "Rules"); public final static Resource SPARQLRule = ResourceFactory.createResource(NS + "SPARQLRule"); public final static Resource Target = ResourceFactory.createResource(NS + "Target"); public final static Resource this_ = ResourceFactory.createResource(NS + "this"); public final static Resource TripleRule = ResourceFactory.createResource(NS + "TripleRule"); public final static Property expression = ResourceFactory.createProperty(NS + "expression"); public final static Property filterShape = ResourceFactory.createProperty(NS + "filterShape"); public final static Property intersection = ResourceFactory.createProperty(NS + "intersection"); public final static Property js = ResourceFactory.createProperty(NS + "js"); public final static Property jsFunctionName = ResourceFactory.createProperty(NS + "jsFunctionName"); public final static Property jsLibrary = ResourceFactory.createProperty(NS + "jsLibrary"); public final static Property jsLibraryURL = ResourceFactory.createProperty(NS + "jsLibraryURL"); public final static Property member = ResourceFactory.createProperty(NS + "member"); public final static Property nodes = ResourceFactory.createProperty(NS + "nodes"); public final static Property object = ResourceFactory.createProperty(NS + "object"); public final static Property predicate = ResourceFactory.createProperty(NS + "predicate"); public final static Property returnType = ResourceFactory.createProperty(NS + "returnType"); public final static Property rule = ResourceFactory.createProperty(NS + "rule"); public final static Property subject = ResourceFactory.createProperty(NS + "subject"); public final static Property target = ResourceFactory.createProperty(NS + "target"); public final static Property union = ResourceFactory.createProperty(NS + "union"); // Features not in SHACL 1.0 but candidates for next release public final static Property count = ResourceFactory.createProperty(NS + "count"); public final static Property desc = ResourceFactory.createProperty(NS + "desc"); public final static Property distinct = ResourceFactory.createProperty(NS + "distinct"); public final static Property else_ = ResourceFactory.createProperty(NS + "else"); public final static Property exists = ResourceFactory.createProperty(NS + "exists"); public final static Property groupConcat = ResourceFactory.createProperty(NS + "groupConcat"); public final static Property if_ = ResourceFactory.createProperty(NS + "if"); public final static Property limit = ResourceFactory.createProperty(NS + "limit"); public final static Property max = ResourceFactory.createProperty(NS + "max"); public final static Property min = ResourceFactory.createProperty(NS + "min"); public final static Property minus = ResourceFactory.createProperty(NS + "minus"); public final static Property offset = ResourceFactory.createProperty(NS + "offset"); public final static Property orderBy = ResourceFactory.createProperty(NS + "orderBy"); public final static Property separator = ResourceFactory.createProperty(NS + "separator"); public final static Property sum = ResourceFactory.createProperty(NS + "sum"); public final static Property then = ResourceFactory.createProperty(NS + "then"); public final static Property values = ResourceFactory.createProperty(NS + "values"); public static final Var currentShapeVar = Var.alloc("currentShape"); public static final Var failureVar = Var.alloc("failure"); public static final Var PATHVar = Var.alloc("PATH"); public static final Var pathVar = Var.alloc(path.getLocalName()); public static final Var shapesGraphVar = Var.alloc("shapesGraph"); public static final Var thisVar = Var.alloc("this"); public static final Var valueVar = Var.alloc("value"); public final static String JS_DATA_VAR = "$data"; public final static String JS_SHAPES_VAR = "$shapes"; public static String getURI() { return NS; } } <MSG> Switched to sh:SPARQLConstraint and sh:SPARQLScope <DFF> @@ -63,6 +63,8 @@ public class SH { public final static Resource NativeScope = ResourceFactory.createResource(NS + "NativeScope"); + public final static Resource NodeConstraint = ResourceFactory.createResource(NS + "NodeConstraint"); + public final static Resource NodeConstraintTemplate = ResourceFactory.createResource(NS + "NodeConstraintTemplate"); public final static Resource OrConstraint = ResourceFactory.createResource(NS + "OrConstraint"); @@ -78,6 +80,10 @@ public class SH { public final static Resource Shape = ResourceFactory.createResource(NS + "Shape"); public final static Resource ShapeClass = ResourceFactory.createResource(NS + "ShapeClass"); + + public final static Resource SPARQLConstraint = ResourceFactory.createResource(NS + "SPARQLConstraint"); + + public final static Resource SPARQLScope = ResourceFactory.createResource(NS + "SPARQLScope"); public final static Resource Template = ResourceFactory.createResource(NS + "Template");
6
Switched to sh:SPARQLConstraint and sh:SPARQLScope
0
.java
java
apache-2.0
TopQuadrant/shacl
343
<NME> SH.java <BEF> /* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * See the NOTICE file distributed with this work for additional * information regarding copyright ownership. */ package org.topbraid.shacl.vocabulary; import org.apache.jena.rdf.model.Property; import org.apache.jena.rdf.model.Resource; import org.apache.jena.rdf.model.ResourceFactory; import org.apache.jena.sparql.core.Var; /** * Vocabulary for http://www.w3.org/ns/shacl# * * @author Holger Knublauch */ public class SH { public final static String BASE_URI = "http://www.w3.org/ns/shacl#"; public final static String NAME = "SHACL"; public final static String NS = BASE_URI; public final static String PREFIX = "sh"; public final static Resource AbstractResult = ResourceFactory.createResource(NS + "AbstractResult"); public final static Resource AndConstraintComponent = ResourceFactory.createResource(NS + "AndConstraintComponent"); public final static Resource BlankNode = ResourceFactory.createResource(NS + "BlankNode"); public final static Resource BlankNodeOrIRI = ResourceFactory.createResource(NS + "BlankNodeOrIRI"); public final static Resource BlankNodeOrLiteral = ResourceFactory.createResource(NS + "BlankNodeOrLiteral"); public final static Resource ClassConstraintComponent = ResourceFactory.createResource(NS + "ClassConstraintComponent"); public final static Resource ClosedConstraintComponent = ResourceFactory.createResource(NS + "ClosedConstraintComponent"); public final static Resource Constraint = ResourceFactory.createResource(NS + "Constraint"); public final static Resource ConstraintComponent = ResourceFactory.createResource(NS + "ConstraintComponent"); public final static Resource DatatypeConstraintComponent = ResourceFactory.createResource(NS + "DatatypeConstraintComponent"); public final static Resource DisjointConstraintComponent = ResourceFactory.createResource(NS + "DisjointConstraintComponent"); public final static Resource EqualsConstraintComponent = ResourceFactory.createResource(NS + "EqualsConstraintComponent"); public final static Resource NativeScope = ResourceFactory.createResource(NS + "NativeScope"); public final static Resource NodeConstraintTemplate = ResourceFactory.createResource(NS + "NodeConstraintTemplate"); public final static Resource OrConstraint = ResourceFactory.createResource(NS + "OrConstraint"); public final static Resource IRIOrLiteral = ResourceFactory.createResource(NS + "IRIOrLiteral"); public final static Resource LanguageInConstraintComponent = ResourceFactory.createResource(NS + "LanguageInConstraintComponent"); public final static Resource LessThanConstraintComponent = ResourceFactory.createResource(NS + "LessThanConstraintComponent"); public final static Resource LessThanOrEqualsConstraintComponent = ResourceFactory.createResource(NS + "LessThanOrEqualsConstraintComponent"); public final static Resource Shape = ResourceFactory.createResource(NS + "Shape"); public final static Resource ShapeClass = ResourceFactory.createResource(NS + "ShapeClass"); public final static Resource Template = ResourceFactory.createResource(NS + "Template"); public final static Resource MinCountConstraintComponent = ResourceFactory.createResource(NS + "MinCountConstraintComponent"); public final static Resource MinExclusiveConstraintComponent = ResourceFactory.createResource(NS + "MinExclusiveConstraintComponent"); public final static Resource MinInclusiveConstraintComponent = ResourceFactory.createResource(NS + "MinInclusiveConstraintComponent"); public final static Resource MinLengthConstraintComponent = ResourceFactory.createResource(NS + "MinLengthConstraintComponent"); public final static Resource NodeConstraintComponent = ResourceFactory.createResource(NS + "NodeConstraintComponent"); public final static Resource NodeKindConstraintComponent = ResourceFactory.createResource(NS + "NodeKindConstraintComponent"); public final static Resource NodeShape = ResourceFactory.createResource(NS + "NodeShape"); public final static Resource NotConstraintComponent = ResourceFactory.createResource(NS + "NotConstraintComponent"); public final static Resource OrConstraintComponent = ResourceFactory.createResource(NS + "OrConstraintComponent"); public final static Resource Parameter = ResourceFactory.createResource(NS + "Parameter"); public final static Resource Parameterizable = ResourceFactory.createResource(NS + "Parameterizable"); public final static Resource PatternConstraintComponent = ResourceFactory.createResource(NS + "PatternConstraintComponent"); public final static Resource PrefixDeclaration = ResourceFactory.createResource(NS + "PrefixDeclaration"); public final static Resource PropertyGroup = ResourceFactory.createResource(NS + "PropertyGroup"); public final static Resource PropertyShape = ResourceFactory.createResource(NS + "PropertyShape"); public final static Resource PropertyConstraintComponent = ResourceFactory.createResource(NS + "PropertyConstraintComponent"); public final static Resource QualifiedMaxCountConstraintComponent = ResourceFactory.createResource(NS + "QualifiedMaxCountConstraintComponent"); public final static Resource QualifiedMinCountConstraintComponent = ResourceFactory.createResource(NS + "QualifiedMinCountConstraintComponent"); public final static Resource ResultAnnotation = ResourceFactory.createResource(NS + "ResultAnnotation"); public final static Resource Shape = ResourceFactory.createResource(NS + "Shape"); public final static Resource SPARQLAskValidator = ResourceFactory.createResource(NS + "SPARQLAskValidator"); public final static Resource SPARQLConstraint = ResourceFactory.createResource(NS + "SPARQLConstraint"); public final static Resource SPARQLConstraintComponent = ResourceFactory.createResource(NS + "SPARQLConstraintComponent"); public final static Resource SPARQLConstructRule = ResourceFactory.createResource(NS + "SPARQLConstructRule"); public final static Resource SPARQLExecutable = ResourceFactory.createResource(NS + "SPARQLExecutable"); public final static Resource SPARQLFunction = ResourceFactory.createResource(NS + "SPARQLFunction"); public final static Resource SPARQLSelectValidator = ResourceFactory.createResource(NS + "SPARQLSelectValidator"); public final static Resource SPARQLTarget = ResourceFactory.createResource(NS + "SPARQLTarget"); public final static Resource SPARQLValuesDeriver = ResourceFactory.createResource(NS + "SPARQLValuesDeriver"); public final static Resource UniqueLangConstraintComponent = ResourceFactory.createResource(NS + "UniqueLangConstraintComponent"); public final static Resource ValidationReport = ResourceFactory.createResource(NS + "ValidationReport"); public final static Resource ValidationResult = ResourceFactory.createResource(NS + "ValidationResult"); public final static Resource Validator = ResourceFactory.createResource(NS + "Validator"); public final static Resource Violation = ResourceFactory.createResource(NS + "Violation"); public final static Resource Warning = ResourceFactory.createResource(NS + "Warning"); public final static Resource XoneConstraintComponent = ResourceFactory.createResource(NS + "XoneConstraintComponent"); public final static Property alternativePath = ResourceFactory.createProperty(NS + "alternativePath"); public final static Property and = ResourceFactory.createProperty(NS + "and"); public final static Property ask = ResourceFactory.createProperty(NS + "ask"); public final static Property class_ = ResourceFactory.createProperty(NS + "class"); public final static Property closed = ResourceFactory.createProperty(NS + "closed"); public final static Property condition = ResourceFactory.createProperty(NS + "condition"); public final static Property conforms = ResourceFactory.createProperty(NS + "conforms"); public final static Property construct = ResourceFactory.createProperty(NS + "construct"); public final static Property datatype = ResourceFactory.createProperty(NS + "datatype"); public final static Property deactivated = ResourceFactory.createProperty(NS + "deactivated"); public final static Property declare = ResourceFactory.createProperty(NS + "declare"); public final static Property defaultValue = ResourceFactory.createProperty(NS + "defaultValue"); public final static Property detail = ResourceFactory.createProperty(NS + "detail"); public final static Property description = ResourceFactory.createProperty(NS + "description"); public final static Property disjoint = ResourceFactory.createProperty(NS + "disjoint"); public final static Property entailment = ResourceFactory.createProperty(NS + "entailment"); public final static Property equals = ResourceFactory.createProperty(NS + "equals"); public final static Property flags = ResourceFactory.createProperty(NS + "flags"); public final static Property focusNode = ResourceFactory.createProperty(NS + "focusNode"); public final static Property group = ResourceFactory.createProperty(NS + "group"); public final static Property hasValue = ResourceFactory.createProperty(NS + "hasValue"); public final static Property ignoredProperties = ResourceFactory.createProperty(NS + "ignoredProperties"); public final static Property in = ResourceFactory.createProperty(NS + "in"); public final static Property inversePath = ResourceFactory.createProperty(NS + "inversePath"); public final static Property labelTemplate = ResourceFactory.createProperty(NS + "labelTemplate"); public final static Property languageIn = ResourceFactory.createProperty(NS + "languageIn"); public final static Property lessThan = ResourceFactory.createProperty(NS + "lessThan"); public final static Property lessThanOrEquals = ResourceFactory.createProperty(NS + "lessThanOrEquals"); public final static Property maxCount = ResourceFactory.createProperty(NS + "maxCount"); public final static Property maxExclusive = ResourceFactory.createProperty(NS + "maxExclusive"); public final static Property maxInclusive = ResourceFactory.createProperty(NS + "maxInclusive"); public final static Property maxLength = ResourceFactory.createProperty(NS + "maxLength"); public final static Property message = ResourceFactory.createProperty(NS + "message"); public final static Property minCount = ResourceFactory.createProperty(NS + "minCount"); public final static Property minExclusive = ResourceFactory.createProperty(NS + "minExclusive"); public final static Property minInclusive = ResourceFactory.createProperty(NS + "minInclusive"); public final static Property minLength = ResourceFactory.createProperty(NS + "minLength"); public final static Property name = ResourceFactory.createProperty(NS + "name"); public final static Property namespace = ResourceFactory.createProperty(NS + "namespace"); public final static Property node = ResourceFactory.createProperty(NS + "node"); public final static Property nodeKind = ResourceFactory.createProperty(NS + "nodeKind"); public final static Property nodeValidator = ResourceFactory.createProperty(NS + "nodeValidator"); public final static Property not = ResourceFactory.createProperty(NS + "not"); public final static Property oneOrMorePath = ResourceFactory.createProperty(NS + "oneOrMorePath"); public final static Property optional = ResourceFactory.createProperty(NS + "optional"); public final static Property or = ResourceFactory.createProperty(NS + "or"); public final static Property order = ResourceFactory.createProperty(NS + "order"); public final static Property parameter = ResourceFactory.createProperty(NS + "parameter"); public final static Property path = ResourceFactory.createProperty(NS + "path"); public final static Property pattern = ResourceFactory.createProperty(NS + "pattern"); public final static Property prefix = ResourceFactory.createProperty(NS + "prefix"); public final static Property prefixes = ResourceFactory.createProperty(NS + "prefixes"); public final static Property property = ResourceFactory.createProperty(NS + "property"); public final static Property propertyValidator = ResourceFactory.createProperty(NS + "propertyValidator"); public final static Property qualifiedMaxCount = ResourceFactory.createProperty(NS + "qualifiedMaxCount"); public final static Property qualifiedMinCount = ResourceFactory.createProperty(NS + "qualifiedMinCount"); public final static Property qualifiedValueShape = ResourceFactory.createProperty(NS + "qualifiedValueShape"); public final static Property qualifiedValueShapesDisjoint = ResourceFactory.createProperty(NS + "qualifiedValueShapesDisjoint"); public final static Property result = ResourceFactory.createProperty(NS + "result"); public final static Property resultMessage = ResourceFactory.createProperty(NS + "resultMessage"); public final static Property resultPath = ResourceFactory.createProperty(NS + "resultPath"); public final static Property resultSeverity = ResourceFactory.createProperty(NS + "resultSeverity"); public final static Property select = ResourceFactory.createProperty(NS + "select"); public final static Property severity = ResourceFactory.createProperty(NS + "severity"); public final static Property shapesGraph = ResourceFactory.createProperty(NS + "shapesGraph"); public final static Property sourceConstraint = ResourceFactory.createProperty(NS + "sourceConstraint"); public final static Property sourceConstraintComponent = ResourceFactory.createProperty(NS + "sourceConstraintComponent"); public final static Property sourceShape = ResourceFactory.createProperty(NS + "sourceShape"); public final static Property sparql = ResourceFactory.createProperty(NS + "sparql"); public final static Property targetClass = ResourceFactory.createProperty(NS + "targetClass"); public final static Property targetNode = ResourceFactory.createProperty(NS + "targetNode"); public final static Property targetObjectsOf = ResourceFactory.createProperty(NS + "targetObjectsOf"); public final static Property targetSubjectsOf = ResourceFactory.createProperty(NS + "targetSubjectsOf"); public final static Property uniqueLang = ResourceFactory.createProperty(NS + "uniqueLang"); public final static Property update = ResourceFactory.createProperty(NS + "update"); public final static Property validator = ResourceFactory.createProperty(NS + "validator"); public final static Property value = ResourceFactory.createProperty(NS + "value"); public final static Property zeroOrMorePath = ResourceFactory.createProperty(NS + "zeroOrMorePath"); public final static Property zeroOrOnePath = ResourceFactory.createProperty(NS + "zeroOrOnePath"); // Advanced features public final static Resource ExpressionConstraintComponent = ResourceFactory.createResource(NS + "ExpressionConstraintComponent"); public final static Resource Function = ResourceFactory.createResource(NS + "Function"); public final static Resource JSConstraint = ResourceFactory.createResource(NS + "JSConstraint"); public final static Resource JSConstraintComponent = ResourceFactory.createResource(NS + "JSConstraintComponent"); public final static Resource JSExecutable = ResourceFactory.createResource(NS + "JSExecutable"); public final static Resource JSFunction = ResourceFactory.createResource(NS + "JSFunction"); public final static Resource JSLibrary = ResourceFactory.createResource(NS + "JSLibrary"); public final static Resource JSRule = ResourceFactory.createResource(NS + "JSRule"); public final static Resource JSTarget = ResourceFactory.createResource(NS + "JSTarget"); public final static Resource JSTargetType = ResourceFactory.createResource(NS + "JSTargetType"); public final static Resource JSValidator = ResourceFactory.createResource(NS + "JSValidator"); public final static Resource Rule = ResourceFactory.createResource(NS + "Rule"); public final static Resource Rules = ResourceFactory.createResource(NS + "Rules"); public final static Resource SPARQLRule = ResourceFactory.createResource(NS + "SPARQLRule"); public final static Resource Target = ResourceFactory.createResource(NS + "Target"); public final static Resource this_ = ResourceFactory.createResource(NS + "this"); public final static Resource TripleRule = ResourceFactory.createResource(NS + "TripleRule"); public final static Property expression = ResourceFactory.createProperty(NS + "expression"); public final static Property filterShape = ResourceFactory.createProperty(NS + "filterShape"); public final static Property intersection = ResourceFactory.createProperty(NS + "intersection"); public final static Property js = ResourceFactory.createProperty(NS + "js"); public final static Property jsFunctionName = ResourceFactory.createProperty(NS + "jsFunctionName"); public final static Property jsLibrary = ResourceFactory.createProperty(NS + "jsLibrary"); public final static Property jsLibraryURL = ResourceFactory.createProperty(NS + "jsLibraryURL"); public final static Property member = ResourceFactory.createProperty(NS + "member"); public final static Property nodes = ResourceFactory.createProperty(NS + "nodes"); public final static Property object = ResourceFactory.createProperty(NS + "object"); public final static Property predicate = ResourceFactory.createProperty(NS + "predicate"); public final static Property returnType = ResourceFactory.createProperty(NS + "returnType"); public final static Property rule = ResourceFactory.createProperty(NS + "rule"); public final static Property subject = ResourceFactory.createProperty(NS + "subject"); public final static Property target = ResourceFactory.createProperty(NS + "target"); public final static Property union = ResourceFactory.createProperty(NS + "union"); // Features not in SHACL 1.0 but candidates for next release public final static Property count = ResourceFactory.createProperty(NS + "count"); public final static Property desc = ResourceFactory.createProperty(NS + "desc"); public final static Property distinct = ResourceFactory.createProperty(NS + "distinct"); public final static Property else_ = ResourceFactory.createProperty(NS + "else"); public final static Property exists = ResourceFactory.createProperty(NS + "exists"); public final static Property groupConcat = ResourceFactory.createProperty(NS + "groupConcat"); public final static Property if_ = ResourceFactory.createProperty(NS + "if"); public final static Property limit = ResourceFactory.createProperty(NS + "limit"); public final static Property max = ResourceFactory.createProperty(NS + "max"); public final static Property min = ResourceFactory.createProperty(NS + "min"); public final static Property minus = ResourceFactory.createProperty(NS + "minus"); public final static Property offset = ResourceFactory.createProperty(NS + "offset"); public final static Property orderBy = ResourceFactory.createProperty(NS + "orderBy"); public final static Property separator = ResourceFactory.createProperty(NS + "separator"); public final static Property sum = ResourceFactory.createProperty(NS + "sum"); public final static Property then = ResourceFactory.createProperty(NS + "then"); public final static Property values = ResourceFactory.createProperty(NS + "values"); public static final Var currentShapeVar = Var.alloc("currentShape"); public static final Var failureVar = Var.alloc("failure"); public static final Var PATHVar = Var.alloc("PATH"); public static final Var pathVar = Var.alloc(path.getLocalName()); public static final Var shapesGraphVar = Var.alloc("shapesGraph"); public static final Var thisVar = Var.alloc("this"); public static final Var valueVar = Var.alloc("value"); public final static String JS_DATA_VAR = "$data"; public final static String JS_SHAPES_VAR = "$shapes"; public static String getURI() { return NS; } } <MSG> Switched to sh:SPARQLConstraint and sh:SPARQLScope <DFF> @@ -63,6 +63,8 @@ public class SH { public final static Resource NativeScope = ResourceFactory.createResource(NS + "NativeScope"); + public final static Resource NodeConstraint = ResourceFactory.createResource(NS + "NodeConstraint"); + public final static Resource NodeConstraintTemplate = ResourceFactory.createResource(NS + "NodeConstraintTemplate"); public final static Resource OrConstraint = ResourceFactory.createResource(NS + "OrConstraint"); @@ -78,6 +80,10 @@ public class SH { public final static Resource Shape = ResourceFactory.createResource(NS + "Shape"); public final static Resource ShapeClass = ResourceFactory.createResource(NS + "ShapeClass"); + + public final static Resource SPARQLConstraint = ResourceFactory.createResource(NS + "SPARQLConstraint"); + + public final static Resource SPARQLScope = ResourceFactory.createResource(NS + "SPARQLScope"); public final static Resource Template = ResourceFactory.createResource(NS + "Template");
6
Switched to sh:SPARQLConstraint and sh:SPARQLScope
0
.java
java
apache-2.0
TopQuadrant/shacl
344
<NME> personexample.test.ttl <BEF> # baseURI: http://datashapes.org/sh/tests/core/complex/personexample.test # imports: http://datashapes.org/dash # prefix: ex @prefix dash: <http://datashapes.org/dash#> . @prefix ex: <http://datashapes.org/sh/tests/core/complex/personexample.test#> . @prefix owl: <http://www.w3.org/2002/07/owl#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix sh: <http://www.w3.org/ns/shacl#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . <http://datashapes.org/sh/tests/core/complex/personexample.test> rdf:type owl:Ontology ; rdfs:label "Test of personexample" ; owl:imports <http://datashapes.org/dash> ; owl:versionInfo "Created with TopBraid Composer" ; . ex:Alice rdf:type ex:Person ; ex:ssn "987-65-432A" ; . ex:Bob rdf:type ex:Person ; ex:ssn "123-45-6789" ; ex:ssn "124-35-6789" ; . ex:Calvin rdf:type ex:Person ; ex:birthDate "1999-09-09"^^xsd:date ; ex:worksFor ex:UntypedCompany ; . ex:GraphValidationTestCase rdf:type dash:GraphValidationTestCase ; dash:expectedResult [ rdf:type sh:ValidationReport ; sh:conforms "false"^^xsd:boolean ; sh:result [ rdf:type sh:ValidationResult ; sh:focusNode ex:Alice ; sh:resultPath ex:ssn ; sh:resultSeverity sh:Violation ; sh:sourceConstraintComponent sh:PatternConstraintComponent ; sh:sourceShape _:b1 ; sh:value "987-65-432A" ; ] ; sh:result [ rdf:type sh:ValidationResult ; sh:focusNode ex:Bob ; sh:resultPath ex:ssn ; sh:resultSeverity sh:Violation ; sh:sourceConstraintComponent sh:MaxCountConstraintComponent ; sh:sourceShape _:b1 ; ] ; sh:result [ rdf:type sh:ValidationResult ; sh:focusNode ex:Calvin ; sh:resultPath ex:birthDate ; sh:resultSeverity sh:Violation ; sh:sourceConstraintComponent sh:ClosedConstraintComponent ; sh:value "1999-09-09"^^xsd:date ; sh:sourceShape ex:PersonShape ; ] ; sh:result [ rdf:type sh:ValidationResult ; sh:focusNode ex:Calvin ; sh:resultPath ex:worksFor ; sh:resultSeverity sh:Violation ; sh:sourceConstraintComponent sh:ClassConstraintComponent ; sh:sourceShape [] ; sh:value ex:UntypedCompany ; ] ; ] ; . ex:PersonShape rdf:type sh:NodeShape ; sh:closed "true"^^xsd:boolean ; sh:ignoredProperties ( rdf:type ) ; sh:property [ sh:path ex:ssn ; sh:datatype xsd:string ; sh:maxCount 1 ; sh:pattern "^\\d{3}-\\d{2}-\\d{4}$" ; ] ; sh:property [ sh:path ex:worksFor ; sh:class ex:Company ; sh:nodeKind sh:IRI ; ] ; sh:property [ sh:path [ sh:inversePath ex:worksFor ; ] ; sh:name "employee" ; ] ; sh:targetClass ex:Person ; . <MSG> fix personexample.test.ttl same issue as this: https://github.com/w3c/data-shapes/issues/102 <DFF> @@ -67,7 +67,7 @@ ex:GraphValidationTestCase sh:resultPath ex:worksFor ; sh:resultSeverity sh:Violation ; sh:sourceConstraintComponent sh:ClassConstraintComponent ; - sh:sourceShape [] ; + sh:sourceShape _:b2 ; sh:value ex:UntypedCompany ; ] ; ] ; @@ -78,17 +78,8 @@ ex:PersonShape sh:ignoredProperties ( rdf:type ) ; - sh:property [ - sh:path ex:ssn ; - sh:datatype xsd:string ; - sh:maxCount 1 ; - sh:pattern "^\\d{3}-\\d{2}-\\d{4}$" ; - ] ; - sh:property [ - sh:path ex:worksFor ; - sh:class ex:Company ; - sh:nodeKind sh:IRI ; - ] ; + sh:property _:b1 ; + sh:property _:b2 ; sh:property [ sh:path [ sh:inversePath ex:worksFor ; @@ -97,3 +88,16 @@ ex:PersonShape ] ; sh:targetClass ex:Person ; . +_:b1 + sh:path ex:ssn ; + sh:datatype xsd:string ; + sh:maxCount 1 ; + sh:pattern "^\\d{3}-\\d{2}-\\d{4}$" ; + sh:message "SSN must be 3 digits - 2 digits - 4 digits." +. + +_:b2 + sh:path ex:worksFor ; + sh:class ex:Company ; + sh:nodeKind sh:IRI +.
16
fix personexample.test.ttl
12
.ttl
test
apache-2.0
TopQuadrant/shacl
345
<NME> personexample.test.ttl <BEF> # baseURI: http://datashapes.org/sh/tests/core/complex/personexample.test # imports: http://datashapes.org/dash # prefix: ex @prefix dash: <http://datashapes.org/dash#> . @prefix ex: <http://datashapes.org/sh/tests/core/complex/personexample.test#> . @prefix owl: <http://www.w3.org/2002/07/owl#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix sh: <http://www.w3.org/ns/shacl#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . <http://datashapes.org/sh/tests/core/complex/personexample.test> rdf:type owl:Ontology ; rdfs:label "Test of personexample" ; owl:imports <http://datashapes.org/dash> ; owl:versionInfo "Created with TopBraid Composer" ; . ex:Alice rdf:type ex:Person ; ex:ssn "987-65-432A" ; . ex:Bob rdf:type ex:Person ; ex:ssn "123-45-6789" ; ex:ssn "124-35-6789" ; . ex:Calvin rdf:type ex:Person ; ex:birthDate "1999-09-09"^^xsd:date ; ex:worksFor ex:UntypedCompany ; . ex:GraphValidationTestCase rdf:type dash:GraphValidationTestCase ; dash:expectedResult [ rdf:type sh:ValidationReport ; sh:conforms "false"^^xsd:boolean ; sh:result [ rdf:type sh:ValidationResult ; sh:focusNode ex:Alice ; sh:resultPath ex:ssn ; sh:resultSeverity sh:Violation ; sh:sourceConstraintComponent sh:PatternConstraintComponent ; sh:sourceShape _:b1 ; sh:value "987-65-432A" ; ] ; sh:result [ rdf:type sh:ValidationResult ; sh:focusNode ex:Bob ; sh:resultPath ex:ssn ; sh:resultSeverity sh:Violation ; sh:sourceConstraintComponent sh:MaxCountConstraintComponent ; sh:sourceShape _:b1 ; ] ; sh:result [ rdf:type sh:ValidationResult ; sh:focusNode ex:Calvin ; sh:resultPath ex:birthDate ; sh:resultSeverity sh:Violation ; sh:sourceConstraintComponent sh:ClosedConstraintComponent ; sh:value "1999-09-09"^^xsd:date ; sh:sourceShape ex:PersonShape ; ] ; sh:result [ rdf:type sh:ValidationResult ; sh:focusNode ex:Calvin ; sh:resultPath ex:worksFor ; sh:resultSeverity sh:Violation ; sh:sourceConstraintComponent sh:ClassConstraintComponent ; sh:sourceShape [] ; sh:value ex:UntypedCompany ; ] ; ] ; . ex:PersonShape rdf:type sh:NodeShape ; sh:closed "true"^^xsd:boolean ; sh:ignoredProperties ( rdf:type ) ; sh:property [ sh:path ex:ssn ; sh:datatype xsd:string ; sh:maxCount 1 ; sh:pattern "^\\d{3}-\\d{2}-\\d{4}$" ; ] ; sh:property [ sh:path ex:worksFor ; sh:class ex:Company ; sh:nodeKind sh:IRI ; ] ; sh:property [ sh:path [ sh:inversePath ex:worksFor ; ] ; sh:name "employee" ; ] ; sh:targetClass ex:Person ; . <MSG> fix personexample.test.ttl same issue as this: https://github.com/w3c/data-shapes/issues/102 <DFF> @@ -67,7 +67,7 @@ ex:GraphValidationTestCase sh:resultPath ex:worksFor ; sh:resultSeverity sh:Violation ; sh:sourceConstraintComponent sh:ClassConstraintComponent ; - sh:sourceShape [] ; + sh:sourceShape _:b2 ; sh:value ex:UntypedCompany ; ] ; ] ; @@ -78,17 +78,8 @@ ex:PersonShape sh:ignoredProperties ( rdf:type ) ; - sh:property [ - sh:path ex:ssn ; - sh:datatype xsd:string ; - sh:maxCount 1 ; - sh:pattern "^\\d{3}-\\d{2}-\\d{4}$" ; - ] ; - sh:property [ - sh:path ex:worksFor ; - sh:class ex:Company ; - sh:nodeKind sh:IRI ; - ] ; + sh:property _:b1 ; + sh:property _:b2 ; sh:property [ sh:path [ sh:inversePath ex:worksFor ; @@ -97,3 +88,16 @@ ex:PersonShape ] ; sh:targetClass ex:Person ; . +_:b1 + sh:path ex:ssn ; + sh:datatype xsd:string ; + sh:maxCount 1 ; + sh:pattern "^\\d{3}-\\d{2}-\\d{4}$" ; + sh:message "SSN must be 3 digits - 2 digits - 4 digits." +. + +_:b2 + sh:path ex:worksFor ; + sh:class ex:Company ; + sh:nodeKind sh:IRI +.
16
fix personexample.test.ttl
12
.ttl
test
apache-2.0
TopQuadrant/shacl
346
<NME> AbstractSPARQLExecutor.java <BEF> /* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * See the NOTICE file distributed with this work for additional * information regarding copyright ownership. */ package org.topbraid.shacl.validation.sparql; import java.net.URI; import java.util.Collection; import java.util.Collections; import java.util.Iterator; import org.apache.jena.query.Query; import org.apache.jena.query.QueryExecution; import org.apache.jena.query.QueryParseException; import org.apache.jena.query.QuerySolution; import org.apache.jena.query.QuerySolutionMap; import org.apache.jena.query.ResultSet; import org.apache.jena.rdf.model.Model; import org.apache.jena.rdf.model.RDFNode; import org.apache.jena.rdf.model.Resource; import org.apache.jena.rdf.model.ResourceFactory; import org.apache.jena.rdf.model.Statement; import org.apache.jena.vocabulary.RDF; import org.topbraid.jenax.statistics.ExecStatistics; import org.topbraid.jenax.statistics.ExecStatisticsManager; import org.topbraid.jenax.util.ARQFactory; import org.topbraid.jenax.util.JenaDatatypes; import org.topbraid.jenax.util.JenaUtil; import org.topbraid.jenax.util.RDFLabels; import org.topbraid.shacl.arq.SHACLPaths; import org.topbraid.shacl.arq.functions.HasShapeFunction; import org.topbraid.shacl.engine.Constraint; import org.topbraid.shacl.engine.ShapesGraph; import org.topbraid.shacl.util.FailureLog; import org.topbraid.shacl.util.SHACLUtil; import org.topbraid.shacl.validation.ConstraintExecutor; import org.topbraid.shacl.validation.SHACLException; import org.topbraid.shacl.validation.ValidationEngine; import org.topbraid.shacl.vocabulary.DASH; import org.topbraid.shacl.vocabulary.SH; public abstract class AbstractSPARQLExecutor implements ConstraintExecutor { // Flag to generate dash:SuccessResults for all violations. public static boolean createSuccessResults = false; private Query query; private String queryString; protected AbstractSPARQLExecutor(Constraint constraint) { this.queryString = getSPARQL(constraint); try { bindings.add(SH.currentShapeVar.getVarName(), constraint.getShapeResource()); bindings.add(SH.shapesGraphVar.getVarName(), ResourceFactory.createResource(engine.getShapesGraphURI().toString())); if(constraint.getShapeResource().isPropertyShape()) { String path = SHACLPaths.getPathString(JenaUtil.getResourceProperty(constraint.getShapeResource(), SH.path)); query = SPARQLSubstitutions.substitutePaths(query, path, constraint.getShapeResource().getModel()); } URI oldShapesGraphURI = HasShapeFunction.getShapesGraph(); @Override public void executeConstraint(Constraint constraint, ValidationEngine engine, Collection<RDFNode> focusNodes) { QuerySolutionMap bindings = new QuerySolutionMap(); addBindings(constraint, bindings); bindings.add(SH.currentShapeVar.getVarName(), constraint.getShapeResource()); bindings.add(SH.shapesGraphVar.getVarName(), ResourceFactory.createResource(engine.getShapesGraphURI().toString())); Resource path = constraint.getShapeResource().getPath(); if(path != null && path.isURIResource()) { bindings.add(SH.PATHVar.getName(), path); } URI oldShapesGraphURI = HasShapeFunction.getShapesGraphURI(); ShapesGraph oldShapesGraph = HasShapeFunction.getShapesGraph(); if(!engine.getShapesGraphURI().equals(oldShapesGraphURI)) { HasShapeFunction.setShapesGraph(engine.getShapesGraph(), engine.getShapesGraphURI()); } Model oldNestedResults = HasShapeFunction.getResultsModel(); Model nestedResults = JenaUtil.createMemoryModel(); HasShapeFunction.setResultsModel(nestedResults); try { long startTime = System.currentTimeMillis(); Resource messageHolder = getSPARQLExecutable(constraint); for(RDFNode focusNode : focusNodes) { bindings.add(SH.thisVar.getVarName(), focusNode); // Overwrite any previous binding QueryExecution qexec = SPARQLSubstitutions.createQueryExecution(query, engine.getDataset(), bindings); executeSelectQuery(engine, constraint, messageHolder, nestedResults, focusNode, qexec, bindings); engine.checkCanceled(); } if(ExecStatisticsManager.get().isRecording()) { long endTime = System.currentTimeMillis(); long duration = endTime - startTime; String label = getLabel(constraint); Iterator<String> varNames = bindings.varNames(); if(varNames.hasNext()) { queryString += "\nBindings:"; while(varNames.hasNext()) { String varName = varNames.next(); queryString += "\n- ?" + varName + ": " + bindings.get(varName); } } ExecStatistics stats = new ExecStatistics(label, queryString, duration, startTime, constraint.getComponent().asNode()); ExecStatisticsManager.get().add(Collections.singletonList(stats)); } } finally { HasShapeFunction.setShapesGraph(oldShapesGraph, oldShapesGraphURI); HasShapeFunction.setResultsModel(oldNestedResults); } } protected abstract void addBindings(Constraint constraint, QuerySolutionMap bindings); protected abstract Resource getSPARQLExecutable(Constraint constraint); protected abstract String getLabel(Constraint constraint); protected Query getQuery() { return query; } protected abstract String getSPARQL(Constraint constraint); private void executeSelectQuery(ValidationEngine engine, Constraint constraint, Resource messageHolder, Model nestedResults, RDFNode focusNode, QueryExecution qexec, QuerySolution bindings) { ResultSet rs = qexec.execSelect(); if(!rs.getResultVars().contains("this")) { qexec.close(); throw new IllegalArgumentException("SELECT constraints must return $this"); } try { if(rs.hasNext()) { while(rs.hasNext()) { QuerySolution sol = rs.next(); RDFNode thisValue = sol.get(SH.thisVar.getVarName()); if(thisValue != null) { Resource resultType = SH.ValidationResult; RDFNode selectMessage = sol.get(SH.message.getLocalName()); if(JenaDatatypes.TRUE.equals(sol.get(SH.failureVar.getName()))) { resultType = DASH.FailureResult; String message = getLabel(constraint); message += " has produced ?" + SH.failureVar.getName(); if(focusNode != null) { message += " for focus node "; if(focusNode.isLiteral()) { message += focusNode; } else { message += RDFLabels.get().getLabel((Resource)focusNode); } } FailureLog.get().logFailure(message); selectMessage = ResourceFactory.createTypedLiteral("Validation Failure: Could not validate shape"); } Resource result = engine.createResult(resultType, constraint, thisValue); if(SH.SPARQLConstraintComponent.equals(constraint.getComponent())) { result.addProperty(SH.sourceConstraint, constraint.getParameterValue()); } if(selectMessage != null) { result.addProperty(SH.resultMessage, selectMessage); } else if(constraint.getShapeResource().hasProperty(SH.message)) { for(Statement s : constraint.getShapeResource().listProperties(SH.message).toList()) { result.addProperty(SH.resultMessage, s.getObject()); } } else { addDefaultMessages(engine, messageHolder, constraint.getComponent(), result, bindings, sol); } RDFNode pathValue = sol.get(SH.pathVar.getVarName()); if(pathValue != null && pathValue.isURIResource()) { result.addProperty(SH.resultPath, pathValue); } else if(constraint.getShapeResource().isPropertyShape()) { Resource basePath = constraint.getShapeResource().getPropertyResourceValue(SH.path); result.addProperty(SH.resultPath, SHACLPaths.clonePath(basePath, result.getModel())); } if(!SH.HasValueConstraintComponent.equals(constraint.getComponent())) { // See https://github.com/w3c/data-shapes/issues/111 RDFNode selectValue = sol.get(SH.valueVar.getVarName()); if(selectValue != null) { result.addProperty(SH.value, selectValue); } else if(SH.NodeShape.equals(constraint.getContext())) { result.addProperty(SH.value, focusNode); } } if(engine.getConfiguration().getReportDetails()) { addDetails(result, nestedResults); } } } } else if(createSuccessResults) { Resource success = engine.createResult(DASH.SuccessResult, constraint, focusNode); if(SH.SPARQLConstraintComponent.equals(constraint.getComponent())) { success.addProperty(SH.sourceConstraint, constraint.getParameterValue()); } if(engine.getConfiguration().getReportDetails()) { addDetails(success, nestedResults); } } } finally { qexec.close(); } } private void addDefaultMessages(ValidationEngine engine, Resource messageHolder, Resource fallback, Resource result, QuerySolution bindings, QuerySolution solution) { boolean found = false; for(Statement s : messageHolder.listProperties(SH.message).toList()) { if(s.getObject().isLiteral()) { QuerySolutionMap map = new QuerySolutionMap(); map.addAll(bindings); map.addAll(solution); engine.addResultMessage(result, s.getLiteral(), map); found = true; } } if(!found && fallback != null) { addDefaultMessages(engine, fallback, null, result, bindings, solution); } } public static void addDetails(Resource parentResult, Model nestedResults) { if(!nestedResults.isEmpty()) { parentResult.getModel().add(nestedResults); for(Resource type : SHACLUtil.RESULT_TYPES) { for(Resource nestedResult : nestedResults.listSubjectsWithProperty(RDF.type, type).toList()) { if(!parentResult.getModel().contains(null, SH.detail, nestedResult)) { parentResult.addProperty(SH.detail, nestedResult); } } } } } } <MSG> SPARQL path speed optimization <DFF> @@ -67,9 +67,15 @@ public abstract class AbstractSPARQLExecutor implements ConstraintExecutor { bindings.add(SH.currentShapeVar.getVarName(), constraint.getShapeResource()); bindings.add(SH.shapesGraphVar.getVarName(), ResourceFactory.createResource(engine.getShapesGraphURI().toString())); - if(constraint.getShapeResource().isPropertyShape()) { - String path = SHACLPaths.getPathString(JenaUtil.getResourceProperty(constraint.getShapeResource(), SH.path)); - query = SPARQLSubstitutions.substitutePaths(query, path, constraint.getShapeResource().getModel()); + Resource path = constraint.getShapeResource().getPath(); + if(path != null) { + if(path.isAnon()) { + String pathString = SHACLPaths.getPathString(JenaUtil.getResourceProperty(constraint.getShapeResource(), SH.path)); + query = SPARQLSubstitutions.substitutePaths(query, pathString, constraint.getShapeResource().getModel()); + } + else { + bindings.add(SH.PATHVar.getName(), path); + } } URI oldShapesGraphURI = HasShapeFunction.getShapesGraph();
9
SPARQL path speed optimization
3
.java
java
apache-2.0
TopQuadrant/shacl
347
<NME> AbstractSPARQLExecutor.java <BEF> /* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * See the NOTICE file distributed with this work for additional * information regarding copyright ownership. */ package org.topbraid.shacl.validation.sparql; import java.net.URI; import java.util.Collection; import java.util.Collections; import java.util.Iterator; import org.apache.jena.query.Query; import org.apache.jena.query.QueryExecution; import org.apache.jena.query.QueryParseException; import org.apache.jena.query.QuerySolution; import org.apache.jena.query.QuerySolutionMap; import org.apache.jena.query.ResultSet; import org.apache.jena.rdf.model.Model; import org.apache.jena.rdf.model.RDFNode; import org.apache.jena.rdf.model.Resource; import org.apache.jena.rdf.model.ResourceFactory; import org.apache.jena.rdf.model.Statement; import org.apache.jena.vocabulary.RDF; import org.topbraid.jenax.statistics.ExecStatistics; import org.topbraid.jenax.statistics.ExecStatisticsManager; import org.topbraid.jenax.util.ARQFactory; import org.topbraid.jenax.util.JenaDatatypes; import org.topbraid.jenax.util.JenaUtil; import org.topbraid.jenax.util.RDFLabels; import org.topbraid.shacl.arq.SHACLPaths; import org.topbraid.shacl.arq.functions.HasShapeFunction; import org.topbraid.shacl.engine.Constraint; import org.topbraid.shacl.engine.ShapesGraph; import org.topbraid.shacl.util.FailureLog; import org.topbraid.shacl.util.SHACLUtil; import org.topbraid.shacl.validation.ConstraintExecutor; import org.topbraid.shacl.validation.SHACLException; import org.topbraid.shacl.validation.ValidationEngine; import org.topbraid.shacl.vocabulary.DASH; import org.topbraid.shacl.vocabulary.SH; public abstract class AbstractSPARQLExecutor implements ConstraintExecutor { // Flag to generate dash:SuccessResults for all violations. public static boolean createSuccessResults = false; private Query query; private String queryString; protected AbstractSPARQLExecutor(Constraint constraint) { this.queryString = getSPARQL(constraint); try { bindings.add(SH.currentShapeVar.getVarName(), constraint.getShapeResource()); bindings.add(SH.shapesGraphVar.getVarName(), ResourceFactory.createResource(engine.getShapesGraphURI().toString())); if(constraint.getShapeResource().isPropertyShape()) { String path = SHACLPaths.getPathString(JenaUtil.getResourceProperty(constraint.getShapeResource(), SH.path)); query = SPARQLSubstitutions.substitutePaths(query, path, constraint.getShapeResource().getModel()); } URI oldShapesGraphURI = HasShapeFunction.getShapesGraph(); @Override public void executeConstraint(Constraint constraint, ValidationEngine engine, Collection<RDFNode> focusNodes) { QuerySolutionMap bindings = new QuerySolutionMap(); addBindings(constraint, bindings); bindings.add(SH.currentShapeVar.getVarName(), constraint.getShapeResource()); bindings.add(SH.shapesGraphVar.getVarName(), ResourceFactory.createResource(engine.getShapesGraphURI().toString())); Resource path = constraint.getShapeResource().getPath(); if(path != null && path.isURIResource()) { bindings.add(SH.PATHVar.getName(), path); } URI oldShapesGraphURI = HasShapeFunction.getShapesGraphURI(); ShapesGraph oldShapesGraph = HasShapeFunction.getShapesGraph(); if(!engine.getShapesGraphURI().equals(oldShapesGraphURI)) { HasShapeFunction.setShapesGraph(engine.getShapesGraph(), engine.getShapesGraphURI()); } Model oldNestedResults = HasShapeFunction.getResultsModel(); Model nestedResults = JenaUtil.createMemoryModel(); HasShapeFunction.setResultsModel(nestedResults); try { long startTime = System.currentTimeMillis(); Resource messageHolder = getSPARQLExecutable(constraint); for(RDFNode focusNode : focusNodes) { bindings.add(SH.thisVar.getVarName(), focusNode); // Overwrite any previous binding QueryExecution qexec = SPARQLSubstitutions.createQueryExecution(query, engine.getDataset(), bindings); executeSelectQuery(engine, constraint, messageHolder, nestedResults, focusNode, qexec, bindings); engine.checkCanceled(); } if(ExecStatisticsManager.get().isRecording()) { long endTime = System.currentTimeMillis(); long duration = endTime - startTime; String label = getLabel(constraint); Iterator<String> varNames = bindings.varNames(); if(varNames.hasNext()) { queryString += "\nBindings:"; while(varNames.hasNext()) { String varName = varNames.next(); queryString += "\n- ?" + varName + ": " + bindings.get(varName); } } ExecStatistics stats = new ExecStatistics(label, queryString, duration, startTime, constraint.getComponent().asNode()); ExecStatisticsManager.get().add(Collections.singletonList(stats)); } } finally { HasShapeFunction.setShapesGraph(oldShapesGraph, oldShapesGraphURI); HasShapeFunction.setResultsModel(oldNestedResults); } } protected abstract void addBindings(Constraint constraint, QuerySolutionMap bindings); protected abstract Resource getSPARQLExecutable(Constraint constraint); protected abstract String getLabel(Constraint constraint); protected Query getQuery() { return query; } protected abstract String getSPARQL(Constraint constraint); private void executeSelectQuery(ValidationEngine engine, Constraint constraint, Resource messageHolder, Model nestedResults, RDFNode focusNode, QueryExecution qexec, QuerySolution bindings) { ResultSet rs = qexec.execSelect(); if(!rs.getResultVars().contains("this")) { qexec.close(); throw new IllegalArgumentException("SELECT constraints must return $this"); } try { if(rs.hasNext()) { while(rs.hasNext()) { QuerySolution sol = rs.next(); RDFNode thisValue = sol.get(SH.thisVar.getVarName()); if(thisValue != null) { Resource resultType = SH.ValidationResult; RDFNode selectMessage = sol.get(SH.message.getLocalName()); if(JenaDatatypes.TRUE.equals(sol.get(SH.failureVar.getName()))) { resultType = DASH.FailureResult; String message = getLabel(constraint); message += " has produced ?" + SH.failureVar.getName(); if(focusNode != null) { message += " for focus node "; if(focusNode.isLiteral()) { message += focusNode; } else { message += RDFLabels.get().getLabel((Resource)focusNode); } } FailureLog.get().logFailure(message); selectMessage = ResourceFactory.createTypedLiteral("Validation Failure: Could not validate shape"); } Resource result = engine.createResult(resultType, constraint, thisValue); if(SH.SPARQLConstraintComponent.equals(constraint.getComponent())) { result.addProperty(SH.sourceConstraint, constraint.getParameterValue()); } if(selectMessage != null) { result.addProperty(SH.resultMessage, selectMessage); } else if(constraint.getShapeResource().hasProperty(SH.message)) { for(Statement s : constraint.getShapeResource().listProperties(SH.message).toList()) { result.addProperty(SH.resultMessage, s.getObject()); } } else { addDefaultMessages(engine, messageHolder, constraint.getComponent(), result, bindings, sol); } RDFNode pathValue = sol.get(SH.pathVar.getVarName()); if(pathValue != null && pathValue.isURIResource()) { result.addProperty(SH.resultPath, pathValue); } else if(constraint.getShapeResource().isPropertyShape()) { Resource basePath = constraint.getShapeResource().getPropertyResourceValue(SH.path); result.addProperty(SH.resultPath, SHACLPaths.clonePath(basePath, result.getModel())); } if(!SH.HasValueConstraintComponent.equals(constraint.getComponent())) { // See https://github.com/w3c/data-shapes/issues/111 RDFNode selectValue = sol.get(SH.valueVar.getVarName()); if(selectValue != null) { result.addProperty(SH.value, selectValue); } else if(SH.NodeShape.equals(constraint.getContext())) { result.addProperty(SH.value, focusNode); } } if(engine.getConfiguration().getReportDetails()) { addDetails(result, nestedResults); } } } } else if(createSuccessResults) { Resource success = engine.createResult(DASH.SuccessResult, constraint, focusNode); if(SH.SPARQLConstraintComponent.equals(constraint.getComponent())) { success.addProperty(SH.sourceConstraint, constraint.getParameterValue()); } if(engine.getConfiguration().getReportDetails()) { addDetails(success, nestedResults); } } } finally { qexec.close(); } } private void addDefaultMessages(ValidationEngine engine, Resource messageHolder, Resource fallback, Resource result, QuerySolution bindings, QuerySolution solution) { boolean found = false; for(Statement s : messageHolder.listProperties(SH.message).toList()) { if(s.getObject().isLiteral()) { QuerySolutionMap map = new QuerySolutionMap(); map.addAll(bindings); map.addAll(solution); engine.addResultMessage(result, s.getLiteral(), map); found = true; } } if(!found && fallback != null) { addDefaultMessages(engine, fallback, null, result, bindings, solution); } } public static void addDetails(Resource parentResult, Model nestedResults) { if(!nestedResults.isEmpty()) { parentResult.getModel().add(nestedResults); for(Resource type : SHACLUtil.RESULT_TYPES) { for(Resource nestedResult : nestedResults.listSubjectsWithProperty(RDF.type, type).toList()) { if(!parentResult.getModel().contains(null, SH.detail, nestedResult)) { parentResult.addProperty(SH.detail, nestedResult); } } } } } } <MSG> SPARQL path speed optimization <DFF> @@ -67,9 +67,15 @@ public abstract class AbstractSPARQLExecutor implements ConstraintExecutor { bindings.add(SH.currentShapeVar.getVarName(), constraint.getShapeResource()); bindings.add(SH.shapesGraphVar.getVarName(), ResourceFactory.createResource(engine.getShapesGraphURI().toString())); - if(constraint.getShapeResource().isPropertyShape()) { - String path = SHACLPaths.getPathString(JenaUtil.getResourceProperty(constraint.getShapeResource(), SH.path)); - query = SPARQLSubstitutions.substitutePaths(query, path, constraint.getShapeResource().getModel()); + Resource path = constraint.getShapeResource().getPath(); + if(path != null) { + if(path.isAnon()) { + String pathString = SHACLPaths.getPathString(JenaUtil.getResourceProperty(constraint.getShapeResource(), SH.path)); + query = SPARQLSubstitutions.substitutePaths(query, pathString, constraint.getShapeResource().getModel()); + } + else { + bindings.add(SH.PATHVar.getName(), path); + } } URI oldShapesGraphURI = HasShapeFunction.getShapesGraph();
9
SPARQL path speed optimization
3
.java
java
apache-2.0
TopQuadrant/shacl
348
<NME> SHACLUtil.java <BEF> /* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * See the NOTICE file distributed with this work for additional * information regarding copyright ownership. */ package org.topbraid.shacl.util; import java.net.URI; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Set; import java.util.UUID; import org.apache.jena.graph.Graph; import org.apache.jena.graph.Node; import org.apache.jena.graph.Triple; import org.apache.jena.graph.compose.MultiUnion; import org.apache.jena.query.Dataset; import org.apache.jena.query.Query; import org.apache.jena.query.QueryExecution; import org.apache.jena.query.QuerySolutionMap; import org.apache.jena.query.ResultSet; import org.apache.jena.rdf.model.Model; import org.apache.jena.rdf.model.ModelFactory; import org.apache.jena.rdf.model.Property; import org.apache.jena.rdf.model.RDFNode; import org.apache.jena.rdf.model.Resource; import org.apache.jena.rdf.model.Statement; import org.apache.jena.rdf.model.StmtIterator; import org.apache.jena.util.iterator.ExtendedIterator; import org.apache.jena.vocabulary.OWL; import org.apache.jena.vocabulary.RDF; import org.apache.jena.vocabulary.RDFS; import org.topbraid.jenax.util.ARQFactory; import org.topbraid.jenax.util.JenaDatatypes; import org.topbraid.jenax.util.JenaNodeUtil; import org.topbraid.jenax.util.JenaUtil; import org.topbraid.shacl.model.SHConstraintComponent; import org.topbraid.shacl.model.SHFactory; import org.topbraid.shacl.model.SHNodeShape; import org.topbraid.shacl.model.SHParameter; import org.topbraid.shacl.model.SHParameterizableTarget; import org.topbraid.shacl.model.SHPropertyShape; import org.topbraid.shacl.model.SHResult; import org.topbraid.shacl.optimize.OntologyOptimizations; import org.topbraid.shacl.optimize.OptimizedMultiUnion; import org.topbraid.shacl.targets.CustomTargetLanguage; import org.topbraid.shacl.targets.CustomTargets; import org.topbraid.shacl.vocabulary.DASH; import org.topbraid.shacl.vocabulary.SH; /** * Various SHACL-related utility methods that didn't fit elsewhere. * * @author Holger Knublauch */ public class SHACLUtil { public final static Resource[] RESULT_TYPES = { DASH.FailureResult, DASH.SuccessResult, SH.ValidationResult }; public final static String SHAPES_FILE_PART = ".shapes."; public static final String URN_X_SHACL = "urn:x-shacl:"; private static final Set<Property> SPARQL_PROPERTIES = new HashSet<Property>(); static { SPARQL_PROPERTIES.add(SH.ask); SPARQL_PROPERTIES.add(SH.construct); SPARQL_PROPERTIES.add(SH.select); SPARQL_PROPERTIES.add(SH.update); } private static Query propertyLabelQuery = ARQFactory.get().createQuery( "PREFIX rdfs: <" + RDFS.getURI() + ">\n" + "PREFIX sh: <" + SH.NS + ">\n" + "SELECT ?label\n" + "WHERE {\n" + " ?arg2 a ?type .\n" + " ?type rdfs:subClassOf* ?class .\n" + " ?shape <" + SH.targetClass + ">* ?class .\n" + " ?shape <" + SH.property + ">|<" + SH.parameter + "> ?p .\n" + " ?p <" + SH.path + "> ?arg1 .\n" + " ?p rdfs:label ?label .\n" + "}"); public static void addDirectPropertiesOfClass(Resource cls, Collection<Property> results) { for(Resource argument : JenaUtil.getResourceProperties(cls, SH.parameter)) { Resource predicate = argument.getPropertyResourceValue(SH.path); if(predicate != null && predicate.isURIResource() && !results.contains(predicate)) { results.add(JenaUtil.asProperty(predicate)); } } for(Resource property : JenaUtil.getResourceProperties(cls, SH.property)) { Resource predicate = property.getPropertyResourceValue(SH.path); if(predicate != null && predicate.isURIResource() && !results.contains(predicate)) { results.add(JenaUtil.asProperty(predicate)); } } } private static void addIncludes(Graph model, String uri, Set<Graph> graphs, Set<String> reachedURIs) { graphs.add(model); reachedURIs.add(uri); for(Triple t : model.find(null, OWL.imports.asNode(), null).toList()) { if(t.getObject().isURI()) { String includeURI = t.getObject().getURI(); if(!reachedURIs.contains(includeURI)) { Model includeModel = ARQFactory.getNamedModel(includeURI); if(includeModel != null) { Graph includeGraph = includeModel.getGraph(); addIncludes(includeGraph, includeURI, graphs, reachedURIs); } } } } } /** * Adds all resources from a given sh:target to a given results Set of Nodes. * @param target the value of sh:target (parameterized or SPARQL target) * @param dataset the dataset to operate on * @param results the Set to add the resulting Nodes to */ public static void addNodesInTarget(Resource target, Dataset dataset, Set<Node> results) { for(RDFNode focusNode : getResourcesInTarget(target, dataset)) { results.add(focusNode.asNode()); } } /** * Creates an includes Model for a given input Model. * The includes Model is the union of the input Model will all graphs linked via * sh:include (or owl:imports), transitively. * @param model the Model to create the includes Model for * @param graphURI the URI of the named graph represented by Model * @return a Model including the semantics */ public static Model createIncludesModel(Model model, String graphURI) { Set<Graph> graphs = new HashSet<Graph>(); Graph baseGraph = model.getGraph(); addIncludes(baseGraph, graphURI, graphs, new HashSet<String>()); if(graphs.size() == 1) { return model; } else { MultiUnion union = new MultiUnion(graphs.iterator()); union.setBaseGraph(baseGraph); return ModelFactory.createModelForGraph(union); } } public static URI createRandomShapesGraphURI() { return URI.create(URN_X_SHACL + UUID.randomUUID()); } /** * Gets all focus nodes from the default Model of a given dataset. * This includes all targets of all defined targets as well as all instances of classes that * are also shapes. * @param dataset the Dataset * @param validateShapes true to include the validation of constraint components * @return a Set of focus Nodes */ public static Set<Node> getAllFocusNodes(Dataset dataset, boolean validateShapes) { Set<Node> results = new HashSet<Node>(); // Add all instances of classes that are also shapes Model model = dataset.getDefaultModel(); for(Resource shape : JenaUtil.getAllInstances(SH.Shape.inModel(model))) { if(JenaUtil.hasIndirectType(shape, RDFS.Class)) { for(Resource instance : JenaUtil.getAllInstances(shape)) { results.add(instance.asNode()); } } } // Add all instances of classes mentioned in sh:targetClass triples for(Statement s : model.listStatements(null, SH.targetClass, (RDFNode)null).toList()) { if(s.getObject().isResource()) { if(validateShapes || (!JenaUtil.hasIndirectType(s.getSubject(), SH.ConstraintComponent) && !SH.PropertyShape.equals(s.getObject())) && !SH.Constraint.equals(s.getObject())) { for(Resource instance : JenaUtil.getAllInstances(s.getResource())) { results.add(instance.asNode()); } } } } // Add all objects of sh:targetNode triples for(Statement s : model.listStatements(null, SH.targetNode, (RDFNode)null).toList()) { results.add(s.getObject().asNode()); } // Add all target nodes of sh:target triples for(Statement s : model.listStatements(null, SH.target, (RDFNode)null).toList()) { if(s.getObject().isResource()) { try { while(it.hasNext()) { Statement s = it.next(); if(SH.property.equals(s.getPredicate())) { return SH.PropertyConstraint.inModel(resource.getModel()); } else if(SH.argument.equals(s.getPredicate())) { return SH.Argument.inModel(resource.getModel()); } else if(SH.constraint.equals(s.getPredicate())) { return SH.NativeConstraint.inModel(resource.getModel()); } else if(SH.scope.equals(s.getPredicate())) { return SH.NativeScope.inModel(resource.getModel()); } else if(SH.inverseProperty.equals(s.getPredicate())) { return SH.InversePropertyConstraint.inModel(resource.getModel()); } // TODO: maybe handle other properties } } finally { Property predicate = JenaUtil.asProperty((Resource)property); for(RDFNode focusNode : model.listObjectsOfProperty(predicate).toList()) { results.add(focusNode.asNode()); } } } // Add all subjects of the predicate used as sh:targetSubjectsOf for(RDFNode property : model.listObjectsOfProperty(SH.targetSubjectsOf).toList()) { if(property.isURIResource()) { Property predicate = JenaUtil.asProperty((Resource)property); for(RDFNode focusNode : model.listSubjectsWithProperty(predicate).toList()) { results.add(focusNode.asNode()); } } } return results; } public static List<SHResult> getAllTopLevelResults(Model model) { List<SHResult> results = new LinkedList<SHResult>(); for(Resource type : RESULT_TYPES) { for(Resource r : model.listResourcesWithProperty(RDF.type, type).toList()) { if(!model.contains(null, SH.detail, r)) { results.add(r.as(SHResult.class)); } } } return results; } /** * Gets all (transitive) superclasses including shapes that reference a class via sh:targetClass. * @param cls the class to start at * @return a Set of classes and shapes */ public static Set<Resource> getAllSuperClassesAndShapesStar(Resource cls) { Set<Resource> results = new HashSet<Resource>(); getAllSuperClassesAndShapesStarHelper(cls, results); return results; } private static void getAllSuperClassesAndShapesStarHelper(Resource node, Set<Resource> results) { if(!results.contains(node)) { results.add(node); { StmtIterator it = node.listProperties(RDFS.subClassOf); while(it.hasNext()) { Statement s = it.next(); if(s.getObject().isResource()) { getAllSuperClassesAndShapesStarHelper(s.getResource(), results); } } } { StmtIterator it = node.getModel().listStatements(null, SH.targetClass, node); while(it.hasNext()) { getAllSuperClassesAndShapesStarHelper(it.next().getSubject(), results); } } } } public static SHConstraintComponent getConstraintComponentOfValidator(Resource validator) { for(Statement s : validator.getModel().listStatements(null, null, validator).toList()) { if(SH.validator.equals(s.getPredicate()) || SH.nodeValidator.equals(s.getPredicate()) || SH.propertyValidator.equals(s.getPredicate())) { return s.getSubject().as(SHConstraintComponent.class); } } return null; } public static Resource getDefaultTypeForConstraintPredicate(Property predicate) { if(SH.property.equals(predicate)) { return SH.PropertyShape; } else if(SH.parameter.equals(predicate)) { return SH.Parameter; } else { throw new IllegalArgumentException(); } } public static List<Resource> getTypes(Resource subject) { List<Resource> types = JenaUtil.getTypes(subject); if(types.isEmpty() && subject.isAnon()) { Resource defaultType = getDefaultTemplateType(subject); if(defaultType != null) { return Collections.singletonList(defaultType); } return null; } public static SHParameter getParameterAtInstance(Resource instance, Property predicate) { for(Resource type : JenaUtil.getTypes(instance)) { SHParameter argument = getParameterAtClass(type, predicate); if(argument != null) { return argument; } } return null; } // Simplified to only check for sh:property and sh:parameter (not sh:node etc) public static Resource getResourceDefaultType(Resource resource) { if(resource.getModel().contains(null, SH.property, resource)) { return SH.PropertyShape.inModel(resource.getModel()); } else if(resource.getModel().contains(null, SH.parameter, resource)) { return SH.Parameter.inModel(resource.getModel()); } /* StmtIterator it = resource.getModel().listStatements(null, null, resource); try { while(it.hasNext()) { Statement s = it.next(); Resource defaultValueType = JenaUtil.getResourceProperty(s.getPredicate(), DASH.defaultValueType); if(defaultValueType != null) { return defaultValueType; } } } finally { it.close(); }*/ return null; } /** * Gets any locally-defined label for a given property. * The labels are expected to be attached to shapes associated with a given * context resource (instance). * That context resource may for example be the subject of the current UI form. * @param property the property to get the label of * @param context the context instance * @return the local label or null if it should fall back to a global label */ public static String getLocalPropertyLabel(Resource property, Resource context) { QuerySolutionMap binding = new QuerySolutionMap(); binding.add("arg1", property); binding.add("arg2", context); try(QueryExecution qexec = ARQFactory.get().createQueryExecution(propertyLabelQuery, property.getModel(), binding)) { ResultSet rs = qexec.execSelect(); if(rs.hasNext()) { return rs.next().get("label").asLiteral().getLexicalForm(); } } return null; } public static SHPropertyShape getPropertyConstraintAtClass(Resource cls, Property predicate) { for(Resource c : JenaUtil.getAllSuperClassesStar(cls)) { for(Resource arg : JenaUtil.getResourceProperties(c, SH.property)) { if(arg.hasProperty(SH.path, predicate)) { return SHFactory.asPropertyShape(arg); } } } return null; } public static SHPropertyShape getPropertyConstraintAtInstance(Resource instance, Property predicate) { for(Resource type : JenaUtil.getTypes(instance)) { SHPropertyShape property = getPropertyConstraintAtClass(type, predicate); if(property != null) { return property; } } return null; } /** * Gets all the predicates of all declared sh:properties and sh:parameters * of a given class, including inherited ones. * @param cls the class to get the predicates of * @return the declared predicates */ public static List<Property> getAllPropertiesOfClass(Resource cls) { List<Property> results = new LinkedList<Property>(); for(Resource c : getAllSuperClassesAndShapesStar(cls)) { addDirectPropertiesOfClass(c, results); } return results; } /** * Gets all nodes from a given sh:target. * @param target the value of sh:target (parameterizable or SPARQL target) * @param dataset the dataset to operate on * @return an Iterable over the resources */ public static Iterable<RDFNode> getResourcesInTarget(Resource target, Dataset dataset) { Resource type = JenaUtil.getType(target); Resource executable; SHParameterizableTarget parameterizableTarget = null; if(SHFactory.isParameterizableInstance(target)) { executable = type; parameterizableTarget = SHFactory.asParameterizableTarget(target); } else { executable = target; } CustomTargetLanguage plugin = CustomTargets.get().getLanguageForTarget(executable); if(plugin != null) { Set<RDFNode> results = new HashSet<>(); plugin.createTarget(executable, parameterizableTarget).addTargetNodes(dataset, results); return results; } else { return new ArrayList<>(); } } /** * Gets all shapes associated with a given focus node. * This looks for all shapes based on class-based targets. * Future versions will also look for property-based targets. * @param node the (focus) node * @return a List of shapes */ public static List<SHNodeShape> getAllShapesAtNode(RDFNode node) { return getAllShapesAtNode(node, node instanceof Resource ? JenaUtil.getTypes((Resource)node) : null); } public static List<SHNodeShape> getAllShapesAtNode(RDFNode node, Iterable<Resource> types) { List<SHNodeShape> results = new LinkedList<>(); if(node instanceof Resource) { Set<Resource> reached = new HashSet<>(); for(Resource type : types) { addAllShapesAtClassOrShape(type, results, reached); } } // TODO: support sh:targetObjectsOf and sh:targetSubjectsOf return results; } /** * Gets all sh:Shapes that have a given class in their target, including ConstraintComponents * and the class or shape itself if it is marked as sh:Shape. * Also walks up the class hierarchy. * @param clsOrShape the class or Shape to get the shapes of * @return the shapes, ordered by the most specialized (subclass) first */ @SuppressWarnings("unchecked") public static List<SHNodeShape> getAllShapesAtClassOrShape(Resource clsOrShape) { String key = OntologyOptimizations.get().getKeyIfEnabledFor(clsOrShape.getModel().getGraph()); if(key != null) { key += ".getAllShapesAtClassOrShape(" + clsOrShape + ")"; return (List<SHNodeShape>) OntologyOptimizations.get().getOrComputeObject(key, () -> { List<SHNodeShape> results = new LinkedList<SHNodeShape>(); addAllShapesAtClassOrShape(clsOrShape, results, new HashSet<Resource>()); return results; }); } else { List<SHNodeShape> results = new LinkedList<SHNodeShape>(); addAllShapesAtClassOrShape(clsOrShape, results, new HashSet<Resource>()); return results; } } private static void addAllShapesAtClassOrShape(Resource clsOrShape, List<SHNodeShape> results, Set<Resource> reached) { addDirectShapesAtClassOrShape(clsOrShape, results); reached.add(clsOrShape); for(Resource superClass : JenaUtil.getSuperClasses(clsOrShape)) { if(!reached.contains(superClass)) { addAllShapesAtClassOrShape(superClass, results, reached); } } } /** * Gets the directly associated sh:Shapes that have a given class in their target, * including ConstraintComponents and the class or shape itself if it is marked as sh:Shape. * Does not walk up the class hierarchy. * @param clsOrShape the class or Shape to get the shapes of * @return the shapes */ public static Collection<SHNodeShape> getDirectShapesAtClassOrShape(Resource clsOrShape) { List<SHNodeShape> results = new LinkedList<SHNodeShape>(); addDirectShapesAtClassOrShape(clsOrShape, results); return results; } private static void addDirectShapesAtClassOrShape(Resource clsOrShape, List<SHNodeShape> results) { if(JenaUtil.hasIndirectType(clsOrShape, SH.Shape) && !results.contains(clsOrShape)) { SHNodeShape shape = SHFactory.asNodeShape(clsOrShape); if(!shape.isDeactivated()) { results.add(shape); } } // More correct would be: if(JenaUtil.hasIndirectType(clsOrShape, RDFS.Class)) { { StmtIterator it = clsOrShape.getModel().listStatements(null, SH.targetClass, clsOrShape); while(it.hasNext()) { Resource subject = it.next().getSubject(); if(!results.contains(subject)) { SHNodeShape shape = SHFactory.asNodeShape(subject); if(!shape.isDeactivated()) { results.add(shape); } } } } } public static Set<Resource> getDirectShapesAtResource(Resource resource) { Set<Resource> shapes = new HashSet<>(); for(Resource type : JenaUtil.getResourceProperties(resource, RDF.type)) { if(JenaUtil.hasIndirectType(type, SH.NodeShape)) { shapes.add(type); } Set<Resource> ts = JenaUtil.getAllSuperClassesStar(type); for(Resource s : ts) { { StmtIterator it = type.getModel().listStatements(null, DASH.applicableToClass, s); while(it.hasNext()) { Resource shape = it.next().getSubject(); shapes.add(shape); } } { StmtIterator it = type.getModel().listStatements(null, SH.targetClass, s); while(it.hasNext()) { Resource shape = it.next().getSubject(); shapes.add(shape); } } } } return shapes; } public static List<RDFNode> getTargetNodes(Resource shape, Dataset dataset) { return getTargetNodes(shape, dataset, false); } public static List<RDFNode> getTargetNodes(Resource shape, Dataset dataset, boolean includeApplicableToClass) { Model dataModel = dataset.getDefaultModel(); Set<RDFNode> results = new HashSet<RDFNode>(); if(JenaUtil.hasIndirectType(shape, RDFS.Class)) { results.addAll(JenaUtil.getAllInstances(shape.inModel(dataModel))); } for(Resource targetClass : JenaUtil.getResourceProperties(shape, SH.targetClass)) { results.addAll(JenaUtil.getAllInstances(targetClass.inModel(dataModel))); } for(RDFNode targetNode : shape.getModel().listObjectsOfProperty(shape, SH.targetNode).toList()) { results.add(targetNode.inModel(dataModel)); } for(Resource sof : JenaUtil.getResourceProperties(shape, SH.targetSubjectsOf)) { for(Statement s : dataModel.listStatements(null, JenaUtil.asProperty(sof), (RDFNode)null).toList()) { results.add(s.getSubject()); } } for(Resource sof : JenaUtil.getResourceProperties(shape, SH.targetObjectsOf)) { for(Statement s : dataModel.listStatements(null, JenaUtil.asProperty(sof), (RDFNode)null).toList()) { results.add(s.getObject()); } } for(Resource target : JenaUtil.getResourceProperties(shape, SH.target)) { for(RDFNode targetNode : SHACLUtil.getResourcesInTarget(target, dataset)) { results.add(targetNode); } } if(includeApplicableToClass) { for(Resource targetClass : JenaUtil.getResourceProperties(shape, DASH.applicableToClass)) { results.addAll(JenaUtil.getAllInstances(targetClass.inModel(dataModel))); } } return new ArrayList<RDFNode>(results); } public static List<Resource> getTypes(Resource subject) { List<Resource> types = JenaUtil.getTypes(subject); if(types.isEmpty()) { Resource defaultType = getResourceDefaultType(subject); if(defaultType != null) { return Collections.singletonList(defaultType); } } return types; } public static boolean hasMinSeverity(Resource severity, Resource minSeverity) { if(minSeverity == null || SH.Info.equals(minSeverity)) { return true; } if(SH.Warning.equals(minSeverity)) { return !SH.Info.equals(severity); } else { // SH.Error return SH.Violation.equals(severity); } } public static boolean isDeactivated(Resource resource) { return resource.hasProperty(SH.deactivated, JenaDatatypes.TRUE); } public static boolean isParameterAtInstance(Resource subject, Property predicate) { for(Resource type : getTypes(subject)) { Resource arg = getParameterAtClass(type, predicate); if(arg != null) { return true; } } return false; } public static boolean isSPARQLProperty(Property property) { return SPARQL_PROPERTIES.contains(property); } /** * Checks whether the SHACL vocabulary is present in a given Model. * The condition is that the SHACL namespace must be declared and * sh:Constraint must have an rdf:type. * @param model the Model to check * @return true if SHACL is present */ public static boolean exists(Model model) { return model != null && exists(model.getGraph()); } public static boolean exists(Graph graph) { if(graph instanceof OptimizedMultiUnion) { return ((OptimizedMultiUnion)graph).getIncludesSHACL(); } else { return graph != null && SH.NS.equals(graph.getPrefixMapping().getNsPrefixURI(SH.PREFIX)) && graph.contains(SH.Shape.asNode(), RDF.type.asNode(), Node.ANY); } } public static URI withShapesGraph(Dataset dataset) { URI shapesGraphURI = createRandomShapesGraphURI(); Model shapesModel = createShapesModel(dataset); dataset.addNamedModel(shapesGraphURI.toString(), shapesModel); return shapesGraphURI; } /** * Creates a shapes Model for a given input Model. * The shapes Model is the union of the input Model with all graphs referenced via * the sh:shapesGraph property (and transitive includes or shapesGraphs of those). * @param model the Model to create the shapes Model for * @return a shapes graph Model */ private static Model createShapesModel(Dataset dataset) { Model model = dataset.getDefaultModel(); Set<Graph> graphs = new HashSet<Graph>(); Graph baseGraph = model.getGraph(); graphs.add(baseGraph); for(Statement s : model.listStatements(null, SH.shapesGraph, (RDFNode)null).toList()) { if(s.getObject().isURIResource()) { String graphURI = s.getResource().getURI(); Model sm = dataset.getNamedModel(graphURI); graphs.add(sm.getGraph()); // TODO: Include includes of sm } } if(graphs.size() > 1) { MultiUnion union = new MultiUnion(graphs.iterator()); union.setBaseGraph(baseGraph); return ModelFactory.createModelForGraph(union); } else { return model; } } public static boolean isInTarget(RDFNode focusNode, Dataset dataset, Resource target) { SHParameterizableTarget parameterizableTarget = null; Resource executable = target; if(SHFactory.isParameterizableInstance(target)) { parameterizableTarget = SHFactory.asParameterizableTarget(target); executable = parameterizableTarget.getParameterizable(); } CustomTargetLanguage plugin = CustomTargets.get().getLanguageForTarget(executable); if(plugin != null) { return plugin.createTarget(executable, parameterizableTarget).contains(dataset, focusNode); } else { return false; } } public static Node walkPropertyShapesHelper(Node propertyShape, Graph graph) { Node valueType = JenaNodeUtil.getObject(propertyShape, SH.class_.asNode(), graph); if(valueType != null) { return valueType; } Node datatype = JenaNodeUtil.getObject(propertyShape, SH.datatype.asNode(), graph); if(datatype != null) { return datatype; } ExtendedIterator<Triple> ors = graph.find(propertyShape, SH.or.asNode(), Node.ANY); while(ors.hasNext()) { Node or = ors.next().getObject(); Node first = JenaNodeUtil.getObject(or, RDF.first.asNode(), graph); if(!first.isLiteral()) { Node cls = JenaNodeUtil.getObject(first, SH.class_.asNode(), graph); if(cls != null) { ors.close(); return cls; } datatype = JenaNodeUtil.getObject(first, SH.datatype.asNode(), graph); if(datatype != null) { ors.close(); return datatype; } } } if(graph.contains(propertyShape, SH.node.asNode(), DASH.ListShape.asNode())) { return RDF.List.asNode(); } return null; } } <MSG> Updates for ISSUE-70 resolution <DFF> @@ -228,23 +228,10 @@ public class SHACLUtil { try { while(it.hasNext()) { Statement s = it.next(); - if(SH.property.equals(s.getPredicate())) { - return SH.PropertyConstraint.inModel(resource.getModel()); + Resource defaultValueType = JenaUtil.getResourceProperty(s.getPredicate(), SH.defaultValueType); + if(defaultValueType != null) { + return defaultValueType; } - else if(SH.argument.equals(s.getPredicate())) { - return SH.Argument.inModel(resource.getModel()); - } - else if(SH.constraint.equals(s.getPredicate())) { - return SH.NativeConstraint.inModel(resource.getModel()); - } - else if(SH.scope.equals(s.getPredicate())) { - return SH.NativeScope.inModel(resource.getModel()); - } - else if(SH.inverseProperty.equals(s.getPredicate())) { - return SH.InversePropertyConstraint.inModel(resource.getModel()); - } - - // TODO: maybe handle other properties } } finally { @@ -342,7 +329,7 @@ public class SHACLUtil { public static List<Resource> getTypes(Resource subject) { List<Resource> types = JenaUtil.getTypes(subject); - if(types.isEmpty() && subject.isAnon()) { + if(types.isEmpty()) { Resource defaultType = getDefaultTemplateType(subject); if(defaultType != null) { return Collections.singletonList(defaultType);
4
Updates for ISSUE-70 resolution
17
.java
java
apache-2.0
TopQuadrant/shacl
349
<NME> SHACLUtil.java <BEF> /* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * See the NOTICE file distributed with this work for additional * information regarding copyright ownership. */ package org.topbraid.shacl.util; import java.net.URI; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Set; import java.util.UUID; import org.apache.jena.graph.Graph; import org.apache.jena.graph.Node; import org.apache.jena.graph.Triple; import org.apache.jena.graph.compose.MultiUnion; import org.apache.jena.query.Dataset; import org.apache.jena.query.Query; import org.apache.jena.query.QueryExecution; import org.apache.jena.query.QuerySolutionMap; import org.apache.jena.query.ResultSet; import org.apache.jena.rdf.model.Model; import org.apache.jena.rdf.model.ModelFactory; import org.apache.jena.rdf.model.Property; import org.apache.jena.rdf.model.RDFNode; import org.apache.jena.rdf.model.Resource; import org.apache.jena.rdf.model.Statement; import org.apache.jena.rdf.model.StmtIterator; import org.apache.jena.util.iterator.ExtendedIterator; import org.apache.jena.vocabulary.OWL; import org.apache.jena.vocabulary.RDF; import org.apache.jena.vocabulary.RDFS; import org.topbraid.jenax.util.ARQFactory; import org.topbraid.jenax.util.JenaDatatypes; import org.topbraid.jenax.util.JenaNodeUtil; import org.topbraid.jenax.util.JenaUtil; import org.topbraid.shacl.model.SHConstraintComponent; import org.topbraid.shacl.model.SHFactory; import org.topbraid.shacl.model.SHNodeShape; import org.topbraid.shacl.model.SHParameter; import org.topbraid.shacl.model.SHParameterizableTarget; import org.topbraid.shacl.model.SHPropertyShape; import org.topbraid.shacl.model.SHResult; import org.topbraid.shacl.optimize.OntologyOptimizations; import org.topbraid.shacl.optimize.OptimizedMultiUnion; import org.topbraid.shacl.targets.CustomTargetLanguage; import org.topbraid.shacl.targets.CustomTargets; import org.topbraid.shacl.vocabulary.DASH; import org.topbraid.shacl.vocabulary.SH; /** * Various SHACL-related utility methods that didn't fit elsewhere. * * @author Holger Knublauch */ public class SHACLUtil { public final static Resource[] RESULT_TYPES = { DASH.FailureResult, DASH.SuccessResult, SH.ValidationResult }; public final static String SHAPES_FILE_PART = ".shapes."; public static final String URN_X_SHACL = "urn:x-shacl:"; private static final Set<Property> SPARQL_PROPERTIES = new HashSet<Property>(); static { SPARQL_PROPERTIES.add(SH.ask); SPARQL_PROPERTIES.add(SH.construct); SPARQL_PROPERTIES.add(SH.select); SPARQL_PROPERTIES.add(SH.update); } private static Query propertyLabelQuery = ARQFactory.get().createQuery( "PREFIX rdfs: <" + RDFS.getURI() + ">\n" + "PREFIX sh: <" + SH.NS + ">\n" + "SELECT ?label\n" + "WHERE {\n" + " ?arg2 a ?type .\n" + " ?type rdfs:subClassOf* ?class .\n" + " ?shape <" + SH.targetClass + ">* ?class .\n" + " ?shape <" + SH.property + ">|<" + SH.parameter + "> ?p .\n" + " ?p <" + SH.path + "> ?arg1 .\n" + " ?p rdfs:label ?label .\n" + "}"); public static void addDirectPropertiesOfClass(Resource cls, Collection<Property> results) { for(Resource argument : JenaUtil.getResourceProperties(cls, SH.parameter)) { Resource predicate = argument.getPropertyResourceValue(SH.path); if(predicate != null && predicate.isURIResource() && !results.contains(predicate)) { results.add(JenaUtil.asProperty(predicate)); } } for(Resource property : JenaUtil.getResourceProperties(cls, SH.property)) { Resource predicate = property.getPropertyResourceValue(SH.path); if(predicate != null && predicate.isURIResource() && !results.contains(predicate)) { results.add(JenaUtil.asProperty(predicate)); } } } private static void addIncludes(Graph model, String uri, Set<Graph> graphs, Set<String> reachedURIs) { graphs.add(model); reachedURIs.add(uri); for(Triple t : model.find(null, OWL.imports.asNode(), null).toList()) { if(t.getObject().isURI()) { String includeURI = t.getObject().getURI(); if(!reachedURIs.contains(includeURI)) { Model includeModel = ARQFactory.getNamedModel(includeURI); if(includeModel != null) { Graph includeGraph = includeModel.getGraph(); addIncludes(includeGraph, includeURI, graphs, reachedURIs); } } } } } /** * Adds all resources from a given sh:target to a given results Set of Nodes. * @param target the value of sh:target (parameterized or SPARQL target) * @param dataset the dataset to operate on * @param results the Set to add the resulting Nodes to */ public static void addNodesInTarget(Resource target, Dataset dataset, Set<Node> results) { for(RDFNode focusNode : getResourcesInTarget(target, dataset)) { results.add(focusNode.asNode()); } } /** * Creates an includes Model for a given input Model. * The includes Model is the union of the input Model will all graphs linked via * sh:include (or owl:imports), transitively. * @param model the Model to create the includes Model for * @param graphURI the URI of the named graph represented by Model * @return a Model including the semantics */ public static Model createIncludesModel(Model model, String graphURI) { Set<Graph> graphs = new HashSet<Graph>(); Graph baseGraph = model.getGraph(); addIncludes(baseGraph, graphURI, graphs, new HashSet<String>()); if(graphs.size() == 1) { return model; } else { MultiUnion union = new MultiUnion(graphs.iterator()); union.setBaseGraph(baseGraph); return ModelFactory.createModelForGraph(union); } } public static URI createRandomShapesGraphURI() { return URI.create(URN_X_SHACL + UUID.randomUUID()); } /** * Gets all focus nodes from the default Model of a given dataset. * This includes all targets of all defined targets as well as all instances of classes that * are also shapes. * @param dataset the Dataset * @param validateShapes true to include the validation of constraint components * @return a Set of focus Nodes */ public static Set<Node> getAllFocusNodes(Dataset dataset, boolean validateShapes) { Set<Node> results = new HashSet<Node>(); // Add all instances of classes that are also shapes Model model = dataset.getDefaultModel(); for(Resource shape : JenaUtil.getAllInstances(SH.Shape.inModel(model))) { if(JenaUtil.hasIndirectType(shape, RDFS.Class)) { for(Resource instance : JenaUtil.getAllInstances(shape)) { results.add(instance.asNode()); } } } // Add all instances of classes mentioned in sh:targetClass triples for(Statement s : model.listStatements(null, SH.targetClass, (RDFNode)null).toList()) { if(s.getObject().isResource()) { if(validateShapes || (!JenaUtil.hasIndirectType(s.getSubject(), SH.ConstraintComponent) && !SH.PropertyShape.equals(s.getObject())) && !SH.Constraint.equals(s.getObject())) { for(Resource instance : JenaUtil.getAllInstances(s.getResource())) { results.add(instance.asNode()); } } } } // Add all objects of sh:targetNode triples for(Statement s : model.listStatements(null, SH.targetNode, (RDFNode)null).toList()) { results.add(s.getObject().asNode()); } // Add all target nodes of sh:target triples for(Statement s : model.listStatements(null, SH.target, (RDFNode)null).toList()) { if(s.getObject().isResource()) { try { while(it.hasNext()) { Statement s = it.next(); if(SH.property.equals(s.getPredicate())) { return SH.PropertyConstraint.inModel(resource.getModel()); } else if(SH.argument.equals(s.getPredicate())) { return SH.Argument.inModel(resource.getModel()); } else if(SH.constraint.equals(s.getPredicate())) { return SH.NativeConstraint.inModel(resource.getModel()); } else if(SH.scope.equals(s.getPredicate())) { return SH.NativeScope.inModel(resource.getModel()); } else if(SH.inverseProperty.equals(s.getPredicate())) { return SH.InversePropertyConstraint.inModel(resource.getModel()); } // TODO: maybe handle other properties } } finally { Property predicate = JenaUtil.asProperty((Resource)property); for(RDFNode focusNode : model.listObjectsOfProperty(predicate).toList()) { results.add(focusNode.asNode()); } } } // Add all subjects of the predicate used as sh:targetSubjectsOf for(RDFNode property : model.listObjectsOfProperty(SH.targetSubjectsOf).toList()) { if(property.isURIResource()) { Property predicate = JenaUtil.asProperty((Resource)property); for(RDFNode focusNode : model.listSubjectsWithProperty(predicate).toList()) { results.add(focusNode.asNode()); } } } return results; } public static List<SHResult> getAllTopLevelResults(Model model) { List<SHResult> results = new LinkedList<SHResult>(); for(Resource type : RESULT_TYPES) { for(Resource r : model.listResourcesWithProperty(RDF.type, type).toList()) { if(!model.contains(null, SH.detail, r)) { results.add(r.as(SHResult.class)); } } } return results; } /** * Gets all (transitive) superclasses including shapes that reference a class via sh:targetClass. * @param cls the class to start at * @return a Set of classes and shapes */ public static Set<Resource> getAllSuperClassesAndShapesStar(Resource cls) { Set<Resource> results = new HashSet<Resource>(); getAllSuperClassesAndShapesStarHelper(cls, results); return results; } private static void getAllSuperClassesAndShapesStarHelper(Resource node, Set<Resource> results) { if(!results.contains(node)) { results.add(node); { StmtIterator it = node.listProperties(RDFS.subClassOf); while(it.hasNext()) { Statement s = it.next(); if(s.getObject().isResource()) { getAllSuperClassesAndShapesStarHelper(s.getResource(), results); } } } { StmtIterator it = node.getModel().listStatements(null, SH.targetClass, node); while(it.hasNext()) { getAllSuperClassesAndShapesStarHelper(it.next().getSubject(), results); } } } } public static SHConstraintComponent getConstraintComponentOfValidator(Resource validator) { for(Statement s : validator.getModel().listStatements(null, null, validator).toList()) { if(SH.validator.equals(s.getPredicate()) || SH.nodeValidator.equals(s.getPredicate()) || SH.propertyValidator.equals(s.getPredicate())) { return s.getSubject().as(SHConstraintComponent.class); } } return null; } public static Resource getDefaultTypeForConstraintPredicate(Property predicate) { if(SH.property.equals(predicate)) { return SH.PropertyShape; } else if(SH.parameter.equals(predicate)) { return SH.Parameter; } else { throw new IllegalArgumentException(); } } public static List<Resource> getTypes(Resource subject) { List<Resource> types = JenaUtil.getTypes(subject); if(types.isEmpty() && subject.isAnon()) { Resource defaultType = getDefaultTemplateType(subject); if(defaultType != null) { return Collections.singletonList(defaultType); } return null; } public static SHParameter getParameterAtInstance(Resource instance, Property predicate) { for(Resource type : JenaUtil.getTypes(instance)) { SHParameter argument = getParameterAtClass(type, predicate); if(argument != null) { return argument; } } return null; } // Simplified to only check for sh:property and sh:parameter (not sh:node etc) public static Resource getResourceDefaultType(Resource resource) { if(resource.getModel().contains(null, SH.property, resource)) { return SH.PropertyShape.inModel(resource.getModel()); } else if(resource.getModel().contains(null, SH.parameter, resource)) { return SH.Parameter.inModel(resource.getModel()); } /* StmtIterator it = resource.getModel().listStatements(null, null, resource); try { while(it.hasNext()) { Statement s = it.next(); Resource defaultValueType = JenaUtil.getResourceProperty(s.getPredicate(), DASH.defaultValueType); if(defaultValueType != null) { return defaultValueType; } } } finally { it.close(); }*/ return null; } /** * Gets any locally-defined label for a given property. * The labels are expected to be attached to shapes associated with a given * context resource (instance). * That context resource may for example be the subject of the current UI form. * @param property the property to get the label of * @param context the context instance * @return the local label or null if it should fall back to a global label */ public static String getLocalPropertyLabel(Resource property, Resource context) { QuerySolutionMap binding = new QuerySolutionMap(); binding.add("arg1", property); binding.add("arg2", context); try(QueryExecution qexec = ARQFactory.get().createQueryExecution(propertyLabelQuery, property.getModel(), binding)) { ResultSet rs = qexec.execSelect(); if(rs.hasNext()) { return rs.next().get("label").asLiteral().getLexicalForm(); } } return null; } public static SHPropertyShape getPropertyConstraintAtClass(Resource cls, Property predicate) { for(Resource c : JenaUtil.getAllSuperClassesStar(cls)) { for(Resource arg : JenaUtil.getResourceProperties(c, SH.property)) { if(arg.hasProperty(SH.path, predicate)) { return SHFactory.asPropertyShape(arg); } } } return null; } public static SHPropertyShape getPropertyConstraintAtInstance(Resource instance, Property predicate) { for(Resource type : JenaUtil.getTypes(instance)) { SHPropertyShape property = getPropertyConstraintAtClass(type, predicate); if(property != null) { return property; } } return null; } /** * Gets all the predicates of all declared sh:properties and sh:parameters * of a given class, including inherited ones. * @param cls the class to get the predicates of * @return the declared predicates */ public static List<Property> getAllPropertiesOfClass(Resource cls) { List<Property> results = new LinkedList<Property>(); for(Resource c : getAllSuperClassesAndShapesStar(cls)) { addDirectPropertiesOfClass(c, results); } return results; } /** * Gets all nodes from a given sh:target. * @param target the value of sh:target (parameterizable or SPARQL target) * @param dataset the dataset to operate on * @return an Iterable over the resources */ public static Iterable<RDFNode> getResourcesInTarget(Resource target, Dataset dataset) { Resource type = JenaUtil.getType(target); Resource executable; SHParameterizableTarget parameterizableTarget = null; if(SHFactory.isParameterizableInstance(target)) { executable = type; parameterizableTarget = SHFactory.asParameterizableTarget(target); } else { executable = target; } CustomTargetLanguage plugin = CustomTargets.get().getLanguageForTarget(executable); if(plugin != null) { Set<RDFNode> results = new HashSet<>(); plugin.createTarget(executable, parameterizableTarget).addTargetNodes(dataset, results); return results; } else { return new ArrayList<>(); } } /** * Gets all shapes associated with a given focus node. * This looks for all shapes based on class-based targets. * Future versions will also look for property-based targets. * @param node the (focus) node * @return a List of shapes */ public static List<SHNodeShape> getAllShapesAtNode(RDFNode node) { return getAllShapesAtNode(node, node instanceof Resource ? JenaUtil.getTypes((Resource)node) : null); } public static List<SHNodeShape> getAllShapesAtNode(RDFNode node, Iterable<Resource> types) { List<SHNodeShape> results = new LinkedList<>(); if(node instanceof Resource) { Set<Resource> reached = new HashSet<>(); for(Resource type : types) { addAllShapesAtClassOrShape(type, results, reached); } } // TODO: support sh:targetObjectsOf and sh:targetSubjectsOf return results; } /** * Gets all sh:Shapes that have a given class in their target, including ConstraintComponents * and the class or shape itself if it is marked as sh:Shape. * Also walks up the class hierarchy. * @param clsOrShape the class or Shape to get the shapes of * @return the shapes, ordered by the most specialized (subclass) first */ @SuppressWarnings("unchecked") public static List<SHNodeShape> getAllShapesAtClassOrShape(Resource clsOrShape) { String key = OntologyOptimizations.get().getKeyIfEnabledFor(clsOrShape.getModel().getGraph()); if(key != null) { key += ".getAllShapesAtClassOrShape(" + clsOrShape + ")"; return (List<SHNodeShape>) OntologyOptimizations.get().getOrComputeObject(key, () -> { List<SHNodeShape> results = new LinkedList<SHNodeShape>(); addAllShapesAtClassOrShape(clsOrShape, results, new HashSet<Resource>()); return results; }); } else { List<SHNodeShape> results = new LinkedList<SHNodeShape>(); addAllShapesAtClassOrShape(clsOrShape, results, new HashSet<Resource>()); return results; } } private static void addAllShapesAtClassOrShape(Resource clsOrShape, List<SHNodeShape> results, Set<Resource> reached) { addDirectShapesAtClassOrShape(clsOrShape, results); reached.add(clsOrShape); for(Resource superClass : JenaUtil.getSuperClasses(clsOrShape)) { if(!reached.contains(superClass)) { addAllShapesAtClassOrShape(superClass, results, reached); } } } /** * Gets the directly associated sh:Shapes that have a given class in their target, * including ConstraintComponents and the class or shape itself if it is marked as sh:Shape. * Does not walk up the class hierarchy. * @param clsOrShape the class or Shape to get the shapes of * @return the shapes */ public static Collection<SHNodeShape> getDirectShapesAtClassOrShape(Resource clsOrShape) { List<SHNodeShape> results = new LinkedList<SHNodeShape>(); addDirectShapesAtClassOrShape(clsOrShape, results); return results; } private static void addDirectShapesAtClassOrShape(Resource clsOrShape, List<SHNodeShape> results) { if(JenaUtil.hasIndirectType(clsOrShape, SH.Shape) && !results.contains(clsOrShape)) { SHNodeShape shape = SHFactory.asNodeShape(clsOrShape); if(!shape.isDeactivated()) { results.add(shape); } } // More correct would be: if(JenaUtil.hasIndirectType(clsOrShape, RDFS.Class)) { { StmtIterator it = clsOrShape.getModel().listStatements(null, SH.targetClass, clsOrShape); while(it.hasNext()) { Resource subject = it.next().getSubject(); if(!results.contains(subject)) { SHNodeShape shape = SHFactory.asNodeShape(subject); if(!shape.isDeactivated()) { results.add(shape); } } } } } public static Set<Resource> getDirectShapesAtResource(Resource resource) { Set<Resource> shapes = new HashSet<>(); for(Resource type : JenaUtil.getResourceProperties(resource, RDF.type)) { if(JenaUtil.hasIndirectType(type, SH.NodeShape)) { shapes.add(type); } Set<Resource> ts = JenaUtil.getAllSuperClassesStar(type); for(Resource s : ts) { { StmtIterator it = type.getModel().listStatements(null, DASH.applicableToClass, s); while(it.hasNext()) { Resource shape = it.next().getSubject(); shapes.add(shape); } } { StmtIterator it = type.getModel().listStatements(null, SH.targetClass, s); while(it.hasNext()) { Resource shape = it.next().getSubject(); shapes.add(shape); } } } } return shapes; } public static List<RDFNode> getTargetNodes(Resource shape, Dataset dataset) { return getTargetNodes(shape, dataset, false); } public static List<RDFNode> getTargetNodes(Resource shape, Dataset dataset, boolean includeApplicableToClass) { Model dataModel = dataset.getDefaultModel(); Set<RDFNode> results = new HashSet<RDFNode>(); if(JenaUtil.hasIndirectType(shape, RDFS.Class)) { results.addAll(JenaUtil.getAllInstances(shape.inModel(dataModel))); } for(Resource targetClass : JenaUtil.getResourceProperties(shape, SH.targetClass)) { results.addAll(JenaUtil.getAllInstances(targetClass.inModel(dataModel))); } for(RDFNode targetNode : shape.getModel().listObjectsOfProperty(shape, SH.targetNode).toList()) { results.add(targetNode.inModel(dataModel)); } for(Resource sof : JenaUtil.getResourceProperties(shape, SH.targetSubjectsOf)) { for(Statement s : dataModel.listStatements(null, JenaUtil.asProperty(sof), (RDFNode)null).toList()) { results.add(s.getSubject()); } } for(Resource sof : JenaUtil.getResourceProperties(shape, SH.targetObjectsOf)) { for(Statement s : dataModel.listStatements(null, JenaUtil.asProperty(sof), (RDFNode)null).toList()) { results.add(s.getObject()); } } for(Resource target : JenaUtil.getResourceProperties(shape, SH.target)) { for(RDFNode targetNode : SHACLUtil.getResourcesInTarget(target, dataset)) { results.add(targetNode); } } if(includeApplicableToClass) { for(Resource targetClass : JenaUtil.getResourceProperties(shape, DASH.applicableToClass)) { results.addAll(JenaUtil.getAllInstances(targetClass.inModel(dataModel))); } } return new ArrayList<RDFNode>(results); } public static List<Resource> getTypes(Resource subject) { List<Resource> types = JenaUtil.getTypes(subject); if(types.isEmpty()) { Resource defaultType = getResourceDefaultType(subject); if(defaultType != null) { return Collections.singletonList(defaultType); } } return types; } public static boolean hasMinSeverity(Resource severity, Resource minSeverity) { if(minSeverity == null || SH.Info.equals(minSeverity)) { return true; } if(SH.Warning.equals(minSeverity)) { return !SH.Info.equals(severity); } else { // SH.Error return SH.Violation.equals(severity); } } public static boolean isDeactivated(Resource resource) { return resource.hasProperty(SH.deactivated, JenaDatatypes.TRUE); } public static boolean isParameterAtInstance(Resource subject, Property predicate) { for(Resource type : getTypes(subject)) { Resource arg = getParameterAtClass(type, predicate); if(arg != null) { return true; } } return false; } public static boolean isSPARQLProperty(Property property) { return SPARQL_PROPERTIES.contains(property); } /** * Checks whether the SHACL vocabulary is present in a given Model. * The condition is that the SHACL namespace must be declared and * sh:Constraint must have an rdf:type. * @param model the Model to check * @return true if SHACL is present */ public static boolean exists(Model model) { return model != null && exists(model.getGraph()); } public static boolean exists(Graph graph) { if(graph instanceof OptimizedMultiUnion) { return ((OptimizedMultiUnion)graph).getIncludesSHACL(); } else { return graph != null && SH.NS.equals(graph.getPrefixMapping().getNsPrefixURI(SH.PREFIX)) && graph.contains(SH.Shape.asNode(), RDF.type.asNode(), Node.ANY); } } public static URI withShapesGraph(Dataset dataset) { URI shapesGraphURI = createRandomShapesGraphURI(); Model shapesModel = createShapesModel(dataset); dataset.addNamedModel(shapesGraphURI.toString(), shapesModel); return shapesGraphURI; } /** * Creates a shapes Model for a given input Model. * The shapes Model is the union of the input Model with all graphs referenced via * the sh:shapesGraph property (and transitive includes or shapesGraphs of those). * @param model the Model to create the shapes Model for * @return a shapes graph Model */ private static Model createShapesModel(Dataset dataset) { Model model = dataset.getDefaultModel(); Set<Graph> graphs = new HashSet<Graph>(); Graph baseGraph = model.getGraph(); graphs.add(baseGraph); for(Statement s : model.listStatements(null, SH.shapesGraph, (RDFNode)null).toList()) { if(s.getObject().isURIResource()) { String graphURI = s.getResource().getURI(); Model sm = dataset.getNamedModel(graphURI); graphs.add(sm.getGraph()); // TODO: Include includes of sm } } if(graphs.size() > 1) { MultiUnion union = new MultiUnion(graphs.iterator()); union.setBaseGraph(baseGraph); return ModelFactory.createModelForGraph(union); } else { return model; } } public static boolean isInTarget(RDFNode focusNode, Dataset dataset, Resource target) { SHParameterizableTarget parameterizableTarget = null; Resource executable = target; if(SHFactory.isParameterizableInstance(target)) { parameterizableTarget = SHFactory.asParameterizableTarget(target); executable = parameterizableTarget.getParameterizable(); } CustomTargetLanguage plugin = CustomTargets.get().getLanguageForTarget(executable); if(plugin != null) { return plugin.createTarget(executable, parameterizableTarget).contains(dataset, focusNode); } else { return false; } } public static Node walkPropertyShapesHelper(Node propertyShape, Graph graph) { Node valueType = JenaNodeUtil.getObject(propertyShape, SH.class_.asNode(), graph); if(valueType != null) { return valueType; } Node datatype = JenaNodeUtil.getObject(propertyShape, SH.datatype.asNode(), graph); if(datatype != null) { return datatype; } ExtendedIterator<Triple> ors = graph.find(propertyShape, SH.or.asNode(), Node.ANY); while(ors.hasNext()) { Node or = ors.next().getObject(); Node first = JenaNodeUtil.getObject(or, RDF.first.asNode(), graph); if(!first.isLiteral()) { Node cls = JenaNodeUtil.getObject(first, SH.class_.asNode(), graph); if(cls != null) { ors.close(); return cls; } datatype = JenaNodeUtil.getObject(first, SH.datatype.asNode(), graph); if(datatype != null) { ors.close(); return datatype; } } } if(graph.contains(propertyShape, SH.node.asNode(), DASH.ListShape.asNode())) { return RDF.List.asNode(); } return null; } } <MSG> Updates for ISSUE-70 resolution <DFF> @@ -228,23 +228,10 @@ public class SHACLUtil { try { while(it.hasNext()) { Statement s = it.next(); - if(SH.property.equals(s.getPredicate())) { - return SH.PropertyConstraint.inModel(resource.getModel()); + Resource defaultValueType = JenaUtil.getResourceProperty(s.getPredicate(), SH.defaultValueType); + if(defaultValueType != null) { + return defaultValueType; } - else if(SH.argument.equals(s.getPredicate())) { - return SH.Argument.inModel(resource.getModel()); - } - else if(SH.constraint.equals(s.getPredicate())) { - return SH.NativeConstraint.inModel(resource.getModel()); - } - else if(SH.scope.equals(s.getPredicate())) { - return SH.NativeScope.inModel(resource.getModel()); - } - else if(SH.inverseProperty.equals(s.getPredicate())) { - return SH.InversePropertyConstraint.inModel(resource.getModel()); - } - - // TODO: maybe handle other properties } } finally { @@ -342,7 +329,7 @@ public class SHACLUtil { public static List<Resource> getTypes(Resource subject) { List<Resource> types = JenaUtil.getTypes(subject); - if(types.isEmpty() && subject.isAnon()) { + if(types.isEmpty()) { Resource defaultType = getDefaultTemplateType(subject); if(defaultType != null) { return Collections.singletonList(defaultType);
4
Updates for ISSUE-70 resolution
17
.java
java
apache-2.0
TopQuadrant/shacl
350
<NME> EDG.java <BEF> ADDFILE <MSG> #85: Fixed incomplete evaluation of sh:TripleRules. Also, general trivial updates to code base. <DFF> @@ -0,0 +1,29 @@ +package org.topbraid.shacl.vocabulary; + +import org.apache.jena.rdf.model.Resource; +import org.apache.jena.rdf.model.ResourceFactory; + +public class EDG { + public final static String BASE_URI = "http://edg.topbraid.solutions/model"; + + public final static String NAME = "EDG"; + + public final static String NS = BASE_URI + "/"; + + public final static String PREFIX = "edg"; + + public final static Resource GlossaryTerm = ResourceFactory.createResource(NS + "GlossaryTerm"); + public final static Resource RequirementsViewpoint = ResourceFactory.createResource(NS + "RequirementsViewpoint"); + public final static Resource BigDataAsset = ResourceFactory.createResource(NS + "BigDataAsset"); + public final static Resource DataAsset = ResourceFactory.createResource(NS + "DataAsset"); + public final static Resource DataValueRule = ResourceFactory.createResource(NS + "DataValueRule"); + public final static Resource Datatype = ResourceFactory.createResource(NS + "Datatype"); + public final static Resource EnumerationViewpoint = ResourceFactory.createResource(NS + "EnumerationViewpoint"); + public final static Resource EnterpriseAsset = ResourceFactory.createResource(NS + "EnterpriseAsset"); + public final static Resource TechnicalAsset = ResourceFactory.createResource(NS + "TechnicalAsset"); + public final static Resource LineageModel = ResourceFactory.createResource(NS + "LineageModel"); + + public static String getURI() { + return NS; + } +}
29
#85: Fixed incomplete evaluation of sh:TripleRules. Also, general trivial updates to code base.
0
.java
java
apache-2.0
TopQuadrant/shacl
351
<NME> EDG.java <BEF> ADDFILE <MSG> #85: Fixed incomplete evaluation of sh:TripleRules. Also, general trivial updates to code base. <DFF> @@ -0,0 +1,29 @@ +package org.topbraid.shacl.vocabulary; + +import org.apache.jena.rdf.model.Resource; +import org.apache.jena.rdf.model.ResourceFactory; + +public class EDG { + public final static String BASE_URI = "http://edg.topbraid.solutions/model"; + + public final static String NAME = "EDG"; + + public final static String NS = BASE_URI + "/"; + + public final static String PREFIX = "edg"; + + public final static Resource GlossaryTerm = ResourceFactory.createResource(NS + "GlossaryTerm"); + public final static Resource RequirementsViewpoint = ResourceFactory.createResource(NS + "RequirementsViewpoint"); + public final static Resource BigDataAsset = ResourceFactory.createResource(NS + "BigDataAsset"); + public final static Resource DataAsset = ResourceFactory.createResource(NS + "DataAsset"); + public final static Resource DataValueRule = ResourceFactory.createResource(NS + "DataValueRule"); + public final static Resource Datatype = ResourceFactory.createResource(NS + "Datatype"); + public final static Resource EnumerationViewpoint = ResourceFactory.createResource(NS + "EnumerationViewpoint"); + public final static Resource EnterpriseAsset = ResourceFactory.createResource(NS + "EnterpriseAsset"); + public final static Resource TechnicalAsset = ResourceFactory.createResource(NS + "TechnicalAsset"); + public final static Resource LineageModel = ResourceFactory.createResource(NS + "LineageModel"); + + public static String getURI() { + return NS; + } +}
29
#85: Fixed incomplete evaluation of sh:TripleRules. Also, general trivial updates to code base.
0
.java
java
apache-2.0
TopQuadrant/shacl
352
<NME> TestValidatorConfiguration.java <BEF> ADDFILE <MSG> Adding configuration object and allowing partial validation of constraints <DFF> @@ -0,0 +1,36 @@ +package org.topbraid.shacl; + +import org.apache.jena.rdf.model.Model; +import org.apache.jena.rdf.model.Resource; +import org.apache.jena.util.FileUtils; +import org.junit.Test; +import org.topbraid.jenax.util.JenaUtil; +import org.topbraid.shacl.validation.ValidationEngineConfiguration; +import org.topbraid.shacl.validation.ValidationUtil; +import org.topbraid.shacl.vocabulary.SH; + +public class TestValidatorConfiguration { + + @Test + public void testMaxErrors() { + Model dataModel = JenaUtil.createMemoryModel(); + dataModel.read(ValidationExample.class.getResourceAsStream("/sh/tests/core/property/class-001.test.ttl"), "urn:dummy", FileUtils.langTurtle); + + ValidationEngineConfiguration configuration = new ValidationEngineConfiguration(); + configuration.setValidationErrorBatch(-1); + + Resource reportNoMaximum = ValidationUtil.validateModel(dataModel, dataModel, configuration); + + Model resultModel = reportNoMaximum.getModel(); + assert(resultModel.listStatements(null, SH.resultSeverity, SH.Violation).toList().size() == 2); + + + configuration.setValidationErrorBatch(1); + Resource reportMaximum = ValidationUtil.validateModel(dataModel, dataModel, configuration); + + resultModel = reportMaximum.getModel(); + System.out.println("FOUND " + resultModel.listStatements(null, SH.resultSeverity, SH.Violation).toList().size() ); + assert(resultModel.listStatements(null, SH.resultSeverity, SH.Violation).toList().size() == 1); + + } +}
36
Adding configuration object and allowing partial validation of constraints
0
.java
java
apache-2.0
TopQuadrant/shacl
353
<NME> TestValidatorConfiguration.java <BEF> ADDFILE <MSG> Adding configuration object and allowing partial validation of constraints <DFF> @@ -0,0 +1,36 @@ +package org.topbraid.shacl; + +import org.apache.jena.rdf.model.Model; +import org.apache.jena.rdf.model.Resource; +import org.apache.jena.util.FileUtils; +import org.junit.Test; +import org.topbraid.jenax.util.JenaUtil; +import org.topbraid.shacl.validation.ValidationEngineConfiguration; +import org.topbraid.shacl.validation.ValidationUtil; +import org.topbraid.shacl.vocabulary.SH; + +public class TestValidatorConfiguration { + + @Test + public void testMaxErrors() { + Model dataModel = JenaUtil.createMemoryModel(); + dataModel.read(ValidationExample.class.getResourceAsStream("/sh/tests/core/property/class-001.test.ttl"), "urn:dummy", FileUtils.langTurtle); + + ValidationEngineConfiguration configuration = new ValidationEngineConfiguration(); + configuration.setValidationErrorBatch(-1); + + Resource reportNoMaximum = ValidationUtil.validateModel(dataModel, dataModel, configuration); + + Model resultModel = reportNoMaximum.getModel(); + assert(resultModel.listStatements(null, SH.resultSeverity, SH.Violation).toList().size() == 2); + + + configuration.setValidationErrorBatch(1); + Resource reportMaximum = ValidationUtil.validateModel(dataModel, dataModel, configuration); + + resultModel = reportMaximum.getModel(); + System.out.println("FOUND " + resultModel.listStatements(null, SH.resultSeverity, SH.Violation).toList().size() ); + assert(resultModel.listStatements(null, SH.resultSeverity, SH.Violation).toList().size() == 1); + + } +}
36
Adding configuration object and allowing partial validation of constraints
0
.java
java
apache-2.0
TopQuadrant/shacl
354
<NME> AbstractSPARQLExecutor.java <BEF> /* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * See the NOTICE file distributed with this work for additional * information regarding copyright ownership. */ package org.topbraid.shacl.validation.sparql; import java.net.URI; import java.util.Collection; import java.util.Collections; import java.util.Iterator; import org.apache.jena.query.Query; import org.apache.jena.query.QueryExecution; import org.apache.jena.query.QueryParseException; import org.apache.jena.query.QuerySolution; import org.apache.jena.query.QuerySolutionMap; import org.apache.jena.query.ResultSet; import org.apache.jena.rdf.model.Model; import org.apache.jena.rdf.model.RDFNode; import org.apache.jena.rdf.model.Resource; import org.apache.jena.rdf.model.ResourceFactory; import org.apache.jena.rdf.model.Statement; import org.apache.jena.vocabulary.RDF; import org.topbraid.jenax.statistics.ExecStatistics; import org.topbraid.jenax.statistics.ExecStatisticsManager; import org.topbraid.jenax.util.ARQFactory; import org.topbraid.jenax.util.JenaDatatypes; import org.topbraid.jenax.util.JenaUtil; import org.topbraid.jenax.util.RDFLabels; import org.topbraid.shacl.arq.SHACLPaths; import org.topbraid.shacl.arq.functions.HasShapeFunction; import org.topbraid.shacl.engine.Constraint; import org.topbraid.shacl.engine.ShapesGraph; import org.topbraid.shacl.util.FailureLog; import org.topbraid.shacl.util.SHACLUtil; import org.topbraid.shacl.validation.ConstraintExecutor; import org.topbraid.shacl.validation.SHACLException; import org.topbraid.shacl.validation.ValidationEngine; import org.topbraid.shacl.vocabulary.DASH; import org.topbraid.shacl.vocabulary.SH; public abstract class AbstractSPARQLExecutor implements ConstraintExecutor { // Flag to generate dash:SuccessResults for all violations. public static boolean createSuccessResults = false; private Query query; private String queryString; protected AbstractSPARQLExecutor(Constraint constraint) { this.queryString = getSPARQL(constraint); try { this.query = ARQFactory.get().createQuery(queryString); Resource path = constraint.getShapeResource().getPath(); if(path != null && path.isAnon()) { String pathString = SHACLPaths.getPathString(constraint.getShapeResource().getPropertyResourceValue(SH.path)); query = SPARQLSubstitutions.substitutePaths(query, pathString, constraint.getShapeResource().getModel()); } } catch(QueryParseException ex) { throw new SHACLException("Invalid SPARQL constraint (" + ex.getLocalizedMessage() + "):\n" + queryString); } if(!query.isSelectType()) { throw new IllegalArgumentException("SHACL constraints must be SELECT queries"); } } @Override public void executeConstraint(Constraint constraint, ValidationEngine engine, Collection<RDFNode> focusNodes) { QuerySolutionMap bindings = new QuerySolutionMap(); addBindings(constraint, bindings); bindings.add(SH.currentShapeVar.getVarName(), constraint.getShapeResource()); bindings.add(SH.shapesGraphVar.getVarName(), ResourceFactory.createResource(engine.getShapesGraphURI().toString())); Resource path = constraint.getShapeResource().getPath(); if(path != null && path.isURIResource()) { bindings.add(SH.PATHVar.getName(), path); } URI oldShapesGraphURI = HasShapeFunction.getShapesGraphURI(); ShapesGraph oldShapesGraph = HasShapeFunction.getShapesGraph(); if(!engine.getShapesGraphURI().equals(oldShapesGraphURI)) { HasShapeFunction.setShapesGraph(engine.getShapesGraph(), engine.getShapesGraphURI()); } Model oldNestedResults = HasShapeFunction.getResultsModel(); Model nestedResults = JenaUtil.createMemoryModel(); HasShapeFunction.setResultsModel(nestedResults); try { long startTime = System.currentTimeMillis(); Resource messageHolder = getSPARQLExecutable(constraint); for(RDFNode focusNode : focusNodes) { bindings.add(SH.thisVar.getVarName(), focusNode); // Overwrite any previous binding QueryExecution qexec = SPARQLSubstitutions.createQueryExecution(query, engine.getDataset(), bindings); executeSelectQuery(engine, constraint, messageHolder, nestedResults, focusNode, qexec, bindings); engine.checkCanceled(); } if(ExecStatisticsManager.get().isRecording()) { long endTime = System.currentTimeMillis(); long duration = endTime - startTime; String label = getLabel(constraint); Iterator<String> varNames = bindings.varNames(); if(varNames.hasNext()) { queryString += "\nBindings:"; while(varNames.hasNext()) { String varName = varNames.next(); queryString += "\n- ?" + varName + ": " + bindings.get(varName); } } ExecStatistics stats = new ExecStatistics(label, queryString, duration, startTime, constraint.getComponent().asNode()); ExecStatisticsManager.get().add(Collections.singletonList(stats)); } } finally { HasShapeFunction.setShapesGraph(oldShapesGraph, oldShapesGraphURI); HasShapeFunction.setResultsModel(oldNestedResults); } } protected abstract void addBindings(Constraint constraint, QuerySolutionMap bindings); protected abstract Resource getSPARQLExecutable(Constraint constraint); protected abstract String getLabel(Constraint constraint); protected Query getQuery() { return query; } protected abstract String getSPARQL(Constraint constraint); private void executeSelectQuery(ValidationEngine engine, Constraint constraint, Resource messageHolder, Model nestedResults, RDFNode focusNode, QueryExecution qexec, QuerySolution bindings) { ResultSet rs = qexec.execSelect(); if(!rs.getResultVars().contains("this")) { qexec.close(); selectMessage = ResourceFactory.createTypedLiteral("Validation Failure: Could not validate shape"); } Resource result = engine.createResult(resultType, constraint, focusNode); if(SH.SPARQLConstraintComponent.equals(constraint.getComponent())) { result.addProperty(SH.sourceConstraint, constraint.getParameterValue()); } RDFNode thisValue = sol.get(SH.thisVar.getVarName()); if(thisValue != null) { Resource resultType = SH.ValidationResult; RDFNode selectMessage = sol.get(SH.message.getLocalName()); if(JenaDatatypes.TRUE.equals(sol.get(SH.failureVar.getName()))) { addDefaultMessages(engine, messageHolder, constraint.getComponent(), result, bindings, sol); } RDFNode resultFocusNode = thisValue; RDFNode pathValue = sol.get(SH.pathVar.getVarName()); if(pathValue != null && pathValue.isURIResource()) { result.addProperty(SH.resultPath, pathValue); message += focusNode; } else { message += RDFLabels.get().getLabel((Resource)focusNode); } } FailureLog.get().logFailure(message); if(selectValue != null) { result.addProperty(SH.value, selectValue); } result.addProperty(SH.focusNode, resultFocusNode); if(createDetails) { addDetails(result, nestedResults); result.addProperty(SH.resultMessage, selectMessage); } else if(constraint.getShapeResource().hasProperty(SH.message)) { for(Statement s : constraint.getShapeResource().listProperties(SH.message).toList()) { result.addProperty(SH.resultMessage, s.getObject()); } } else { addDefaultMessages(engine, messageHolder, constraint.getComponent(), result, bindings, sol); } RDFNode pathValue = sol.get(SH.pathVar.getVarName()); if(pathValue != null && pathValue.isURIResource()) { result.addProperty(SH.resultPath, pathValue); } else if(constraint.getShapeResource().isPropertyShape()) { Resource basePath = constraint.getShapeResource().getPropertyResourceValue(SH.path); result.addProperty(SH.resultPath, SHACLPaths.clonePath(basePath, result.getModel())); } if(!SH.HasValueConstraintComponent.equals(constraint.getComponent())) { // See https://github.com/w3c/data-shapes/issues/111 RDFNode selectValue = sol.get(SH.valueVar.getVarName()); if(selectValue != null) { result.addProperty(SH.value, selectValue); } else if(SH.NodeShape.equals(constraint.getContext())) { result.addProperty(SH.value, focusNode); } } if(engine.getConfiguration().getReportDetails()) { addDetails(result, nestedResults); } } } } else if(createSuccessResults) { Resource success = engine.createResult(DASH.SuccessResult, constraint, focusNode); if(SH.SPARQLConstraintComponent.equals(constraint.getComponent())) { success.addProperty(SH.sourceConstraint, constraint.getParameterValue()); } if(engine.getConfiguration().getReportDetails()) { addDetails(success, nestedResults); } } } finally { qexec.close(); } } private void addDefaultMessages(ValidationEngine engine, Resource messageHolder, Resource fallback, Resource result, QuerySolution bindings, QuerySolution solution) { boolean found = false; for(Statement s : messageHolder.listProperties(SH.message).toList()) { if(s.getObject().isLiteral()) { QuerySolutionMap map = new QuerySolutionMap(); map.addAll(bindings); map.addAll(solution); engine.addResultMessage(result, s.getLiteral(), map); found = true; } } if(!found && fallback != null) { addDefaultMessages(engine, fallback, null, result, bindings, solution); } } public static void addDetails(Resource parentResult, Model nestedResults) { if(!nestedResults.isEmpty()) { parentResult.getModel().add(nestedResults); for(Resource type : SHACLUtil.RESULT_TYPES) { for(Resource nestedResult : nestedResults.listSubjectsWithProperty(RDF.type, type).toList()) { if(!parentResult.getModel().contains(null, SH.detail, nestedResult)) { parentResult.addProperty(SH.detail, nestedResult); } } } } } } <MSG> Bug fix related to setting sh:value if ?value is not returned from SELECT query <DFF> @@ -163,7 +163,7 @@ public abstract class AbstractSPARQLExecutor implements ConstraintExecutor { selectMessage = ResourceFactory.createTypedLiteral("Validation Failure: Could not validate shape"); } - Resource result = engine.createResult(resultType, constraint, focusNode); + Resource result = engine.createResult(resultType, constraint, thisValue); if(SH.SPARQLConstraintComponent.equals(constraint.getComponent())) { result.addProperty(SH.sourceConstraint, constraint.getParameterValue()); } @@ -175,7 +175,6 @@ public abstract class AbstractSPARQLExecutor implements ConstraintExecutor { addDefaultMessages(engine, messageHolder, constraint.getComponent(), result, bindings, sol); } - RDFNode resultFocusNode = thisValue; RDFNode pathValue = sol.get(SH.pathVar.getVarName()); if(pathValue != null && pathValue.isURIResource()) { result.addProperty(SH.resultPath, pathValue); @@ -189,8 +188,9 @@ public abstract class AbstractSPARQLExecutor implements ConstraintExecutor { if(selectValue != null) { result.addProperty(SH.value, selectValue); } - - result.addProperty(SH.focusNode, resultFocusNode); + else if(SH.NodeShape.equals(constraint.getContext())) { + result.addProperty(SH.value, focusNode); + } if(createDetails) { addDetails(result, nestedResults);
4
Bug fix related to setting sh:value if ?value is not returned from SELECT query
4
.java
java
apache-2.0
TopQuadrant/shacl
355
<NME> AbstractSPARQLExecutor.java <BEF> /* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * See the NOTICE file distributed with this work for additional * information regarding copyright ownership. */ package org.topbraid.shacl.validation.sparql; import java.net.URI; import java.util.Collection; import java.util.Collections; import java.util.Iterator; import org.apache.jena.query.Query; import org.apache.jena.query.QueryExecution; import org.apache.jena.query.QueryParseException; import org.apache.jena.query.QuerySolution; import org.apache.jena.query.QuerySolutionMap; import org.apache.jena.query.ResultSet; import org.apache.jena.rdf.model.Model; import org.apache.jena.rdf.model.RDFNode; import org.apache.jena.rdf.model.Resource; import org.apache.jena.rdf.model.ResourceFactory; import org.apache.jena.rdf.model.Statement; import org.apache.jena.vocabulary.RDF; import org.topbraid.jenax.statistics.ExecStatistics; import org.topbraid.jenax.statistics.ExecStatisticsManager; import org.topbraid.jenax.util.ARQFactory; import org.topbraid.jenax.util.JenaDatatypes; import org.topbraid.jenax.util.JenaUtil; import org.topbraid.jenax.util.RDFLabels; import org.topbraid.shacl.arq.SHACLPaths; import org.topbraid.shacl.arq.functions.HasShapeFunction; import org.topbraid.shacl.engine.Constraint; import org.topbraid.shacl.engine.ShapesGraph; import org.topbraid.shacl.util.FailureLog; import org.topbraid.shacl.util.SHACLUtil; import org.topbraid.shacl.validation.ConstraintExecutor; import org.topbraid.shacl.validation.SHACLException; import org.topbraid.shacl.validation.ValidationEngine; import org.topbraid.shacl.vocabulary.DASH; import org.topbraid.shacl.vocabulary.SH; public abstract class AbstractSPARQLExecutor implements ConstraintExecutor { // Flag to generate dash:SuccessResults for all violations. public static boolean createSuccessResults = false; private Query query; private String queryString; protected AbstractSPARQLExecutor(Constraint constraint) { this.queryString = getSPARQL(constraint); try { this.query = ARQFactory.get().createQuery(queryString); Resource path = constraint.getShapeResource().getPath(); if(path != null && path.isAnon()) { String pathString = SHACLPaths.getPathString(constraint.getShapeResource().getPropertyResourceValue(SH.path)); query = SPARQLSubstitutions.substitutePaths(query, pathString, constraint.getShapeResource().getModel()); } } catch(QueryParseException ex) { throw new SHACLException("Invalid SPARQL constraint (" + ex.getLocalizedMessage() + "):\n" + queryString); } if(!query.isSelectType()) { throw new IllegalArgumentException("SHACL constraints must be SELECT queries"); } } @Override public void executeConstraint(Constraint constraint, ValidationEngine engine, Collection<RDFNode> focusNodes) { QuerySolutionMap bindings = new QuerySolutionMap(); addBindings(constraint, bindings); bindings.add(SH.currentShapeVar.getVarName(), constraint.getShapeResource()); bindings.add(SH.shapesGraphVar.getVarName(), ResourceFactory.createResource(engine.getShapesGraphURI().toString())); Resource path = constraint.getShapeResource().getPath(); if(path != null && path.isURIResource()) { bindings.add(SH.PATHVar.getName(), path); } URI oldShapesGraphURI = HasShapeFunction.getShapesGraphURI(); ShapesGraph oldShapesGraph = HasShapeFunction.getShapesGraph(); if(!engine.getShapesGraphURI().equals(oldShapesGraphURI)) { HasShapeFunction.setShapesGraph(engine.getShapesGraph(), engine.getShapesGraphURI()); } Model oldNestedResults = HasShapeFunction.getResultsModel(); Model nestedResults = JenaUtil.createMemoryModel(); HasShapeFunction.setResultsModel(nestedResults); try { long startTime = System.currentTimeMillis(); Resource messageHolder = getSPARQLExecutable(constraint); for(RDFNode focusNode : focusNodes) { bindings.add(SH.thisVar.getVarName(), focusNode); // Overwrite any previous binding QueryExecution qexec = SPARQLSubstitutions.createQueryExecution(query, engine.getDataset(), bindings); executeSelectQuery(engine, constraint, messageHolder, nestedResults, focusNode, qexec, bindings); engine.checkCanceled(); } if(ExecStatisticsManager.get().isRecording()) { long endTime = System.currentTimeMillis(); long duration = endTime - startTime; String label = getLabel(constraint); Iterator<String> varNames = bindings.varNames(); if(varNames.hasNext()) { queryString += "\nBindings:"; while(varNames.hasNext()) { String varName = varNames.next(); queryString += "\n- ?" + varName + ": " + bindings.get(varName); } } ExecStatistics stats = new ExecStatistics(label, queryString, duration, startTime, constraint.getComponent().asNode()); ExecStatisticsManager.get().add(Collections.singletonList(stats)); } } finally { HasShapeFunction.setShapesGraph(oldShapesGraph, oldShapesGraphURI); HasShapeFunction.setResultsModel(oldNestedResults); } } protected abstract void addBindings(Constraint constraint, QuerySolutionMap bindings); protected abstract Resource getSPARQLExecutable(Constraint constraint); protected abstract String getLabel(Constraint constraint); protected Query getQuery() { return query; } protected abstract String getSPARQL(Constraint constraint); private void executeSelectQuery(ValidationEngine engine, Constraint constraint, Resource messageHolder, Model nestedResults, RDFNode focusNode, QueryExecution qexec, QuerySolution bindings) { ResultSet rs = qexec.execSelect(); if(!rs.getResultVars().contains("this")) { qexec.close(); selectMessage = ResourceFactory.createTypedLiteral("Validation Failure: Could not validate shape"); } Resource result = engine.createResult(resultType, constraint, focusNode); if(SH.SPARQLConstraintComponent.equals(constraint.getComponent())) { result.addProperty(SH.sourceConstraint, constraint.getParameterValue()); } RDFNode thisValue = sol.get(SH.thisVar.getVarName()); if(thisValue != null) { Resource resultType = SH.ValidationResult; RDFNode selectMessage = sol.get(SH.message.getLocalName()); if(JenaDatatypes.TRUE.equals(sol.get(SH.failureVar.getName()))) { addDefaultMessages(engine, messageHolder, constraint.getComponent(), result, bindings, sol); } RDFNode resultFocusNode = thisValue; RDFNode pathValue = sol.get(SH.pathVar.getVarName()); if(pathValue != null && pathValue.isURIResource()) { result.addProperty(SH.resultPath, pathValue); message += focusNode; } else { message += RDFLabels.get().getLabel((Resource)focusNode); } } FailureLog.get().logFailure(message); if(selectValue != null) { result.addProperty(SH.value, selectValue); } result.addProperty(SH.focusNode, resultFocusNode); if(createDetails) { addDetails(result, nestedResults); result.addProperty(SH.resultMessage, selectMessage); } else if(constraint.getShapeResource().hasProperty(SH.message)) { for(Statement s : constraint.getShapeResource().listProperties(SH.message).toList()) { result.addProperty(SH.resultMessage, s.getObject()); } } else { addDefaultMessages(engine, messageHolder, constraint.getComponent(), result, bindings, sol); } RDFNode pathValue = sol.get(SH.pathVar.getVarName()); if(pathValue != null && pathValue.isURIResource()) { result.addProperty(SH.resultPath, pathValue); } else if(constraint.getShapeResource().isPropertyShape()) { Resource basePath = constraint.getShapeResource().getPropertyResourceValue(SH.path); result.addProperty(SH.resultPath, SHACLPaths.clonePath(basePath, result.getModel())); } if(!SH.HasValueConstraintComponent.equals(constraint.getComponent())) { // See https://github.com/w3c/data-shapes/issues/111 RDFNode selectValue = sol.get(SH.valueVar.getVarName()); if(selectValue != null) { result.addProperty(SH.value, selectValue); } else if(SH.NodeShape.equals(constraint.getContext())) { result.addProperty(SH.value, focusNode); } } if(engine.getConfiguration().getReportDetails()) { addDetails(result, nestedResults); } } } } else if(createSuccessResults) { Resource success = engine.createResult(DASH.SuccessResult, constraint, focusNode); if(SH.SPARQLConstraintComponent.equals(constraint.getComponent())) { success.addProperty(SH.sourceConstraint, constraint.getParameterValue()); } if(engine.getConfiguration().getReportDetails()) { addDetails(success, nestedResults); } } } finally { qexec.close(); } } private void addDefaultMessages(ValidationEngine engine, Resource messageHolder, Resource fallback, Resource result, QuerySolution bindings, QuerySolution solution) { boolean found = false; for(Statement s : messageHolder.listProperties(SH.message).toList()) { if(s.getObject().isLiteral()) { QuerySolutionMap map = new QuerySolutionMap(); map.addAll(bindings); map.addAll(solution); engine.addResultMessage(result, s.getLiteral(), map); found = true; } } if(!found && fallback != null) { addDefaultMessages(engine, fallback, null, result, bindings, solution); } } public static void addDetails(Resource parentResult, Model nestedResults) { if(!nestedResults.isEmpty()) { parentResult.getModel().add(nestedResults); for(Resource type : SHACLUtil.RESULT_TYPES) { for(Resource nestedResult : nestedResults.listSubjectsWithProperty(RDF.type, type).toList()) { if(!parentResult.getModel().contains(null, SH.detail, nestedResult)) { parentResult.addProperty(SH.detail, nestedResult); } } } } } } <MSG> Bug fix related to setting sh:value if ?value is not returned from SELECT query <DFF> @@ -163,7 +163,7 @@ public abstract class AbstractSPARQLExecutor implements ConstraintExecutor { selectMessage = ResourceFactory.createTypedLiteral("Validation Failure: Could not validate shape"); } - Resource result = engine.createResult(resultType, constraint, focusNode); + Resource result = engine.createResult(resultType, constraint, thisValue); if(SH.SPARQLConstraintComponent.equals(constraint.getComponent())) { result.addProperty(SH.sourceConstraint, constraint.getParameterValue()); } @@ -175,7 +175,6 @@ public abstract class AbstractSPARQLExecutor implements ConstraintExecutor { addDefaultMessages(engine, messageHolder, constraint.getComponent(), result, bindings, sol); } - RDFNode resultFocusNode = thisValue; RDFNode pathValue = sol.get(SH.pathVar.getVarName()); if(pathValue != null && pathValue.isURIResource()) { result.addProperty(SH.resultPath, pathValue); @@ -189,8 +188,9 @@ public abstract class AbstractSPARQLExecutor implements ConstraintExecutor { if(selectValue != null) { result.addProperty(SH.value, selectValue); } - - result.addProperty(SH.focusNode, resultFocusNode); + else if(SH.NodeShape.equals(constraint.getContext())) { + result.addProperty(SH.value, focusNode); + } if(createDetails) { addDetails(result, nestedResults);
4
Bug fix related to setting sh:value if ?value is not returned from SELECT query
4
.java
java
apache-2.0
TopQuadrant/shacl
356
<NME> README.md <BEF> ADDFILE <MSG> Adding README <DFF> @@ -0,0 +1,37 @@ +# SHACL.js + +## Usage + +Create a new SHACL validator and load shapes and data to trigger the validation. +The validation function returns a `ValidationReport` object that can be used to inspect conformance rand results. + +```javascript +var validator = new SHACLValidator(); +validator.validate(data, "text/turtle", shapes, "text/turtle", function (e, report) { + console.log("Conforms? " + report.conforms()); + if (report.conforms() === false) { + report.results().forEach(function(result) { + console.log(" - Severity: " + result.severity() + " for " + result.sourceConstraintComponent()); + }); + } +}); +``` + +## Building for the web + +A browser version of the library will be built in the `dist` directory using the gulp `browserify` task. + +## Running the tests + +Tests can be run using the `test` gulp task. + +## Running the web tests + +Tests can be run for the browser version running the `test-web` gulp task. This task will generate the test cases from +the node version and start a server in port 3000. The browser version of the library must have been built before running +this task. + +## Regenerating vocabularies + +The vocabularies for SHACL and DASH are located in the `vocabularies` directory. After modifying these files, they must +be transformed into library code using the `generate-vocabularies` gulp task. \ No newline at end of file
37
Adding README
0
.md
md
apache-2.0
TopQuadrant/shacl
357
<NME> README.md <BEF> ADDFILE <MSG> Adding README <DFF> @@ -0,0 +1,37 @@ +# SHACL.js + +## Usage + +Create a new SHACL validator and load shapes and data to trigger the validation. +The validation function returns a `ValidationReport` object that can be used to inspect conformance rand results. + +```javascript +var validator = new SHACLValidator(); +validator.validate(data, "text/turtle", shapes, "text/turtle", function (e, report) { + console.log("Conforms? " + report.conforms()); + if (report.conforms() === false) { + report.results().forEach(function(result) { + console.log(" - Severity: " + result.severity() + " for " + result.sourceConstraintComponent()); + }); + } +}); +``` + +## Building for the web + +A browser version of the library will be built in the `dist` directory using the gulp `browserify` task. + +## Running the tests + +Tests can be run using the `test` gulp task. + +## Running the web tests + +Tests can be run for the browser version running the `test-web` gulp task. This task will generate the test cases from +the node version and start a server in port 3000. The browser version of the library must have been built before running +this task. + +## Regenerating vocabularies + +The vocabularies for SHACL and DASH are located in the `vocabularies` directory. After modifying these files, they must +be transformed into library code using the `generate-vocabularies` gulp task. \ No newline at end of file
37
Adding README
0
.md
md
apache-2.0
TopQuadrant/shacl
358
<NME> tosh.ttl <BEF> # baseURI: http://topbraid.org/tosh # imports: http://datashapes.org/dash # prefix: tosh @prefix dash: <http://datashapes.org/dash#> . @prefix graphql: <http://datashapes.org/graphql#> . @prefix owl: <http://www.w3.org/2002/07/owl#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix sh: <http://www.w3.org/ns/shacl#> . @prefix swa: <http://topbraid.org/swa#> . @prefix tosh: <http://topbraid.org/tosh#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . dash: tosh:systemNamespace true ; . dash:Action sh:property tosh:Action-actionGroup ; sh:property tosh:Action-actionIconClass ; sh:property tosh:Action-deactivated ; . dash:ActionGroup sh:property tosh:ActionGroup-order ; sh:property tosh:Resource-comment ; . dash:NonRecursiveConstraintComponent dash:propertySuggestionGenerator tosh:DeleteTripleSuggestionGenerator ; sh:property [ sh:path dash:nonRecursive ; sh:group tosh:RelationshipPropertyGroup ; ] ; . dash:PrimaryKeyConstraintComponent-uriStart tosh:editWidget swa:PlainTextFieldEditor ; . dash:RootClassConstraintComponent dash:propertySuggestionGenerator tosh:DeleteTripleSuggestionGenerator ; sh:group tosh:ValidationPropertyGroup ; . dash:CoExistsWithConstraintComponent-coExistsWith sh:group tosh:PropertyPairConstraintsPropertyGroup ; sh:order "0"^^xsd:decimal ; . dash:DetailsEditor dash:hidden true ; owl:versionInfo "This is not yet supported by TopBraid." ; . dash:FunctionTestCase sh:property tosh:FunctionTestCase-expectedResult ; sh:property tosh:FunctionTestCase-expression ; . dash:GraphStoreTestCase }""" ; ] ; . <http://spinrdf.org/sp#> tosh:systemNamespace true ; . . dash:JSTestCase sh:property tosh:JSTestCase-expectedResult ; . dash:MultiFunction sh:property tosh:Function-apiStatus ; sh:property tosh:MultiFunction-resultVariable ; . dash:NonRecursiveConstraintComponent dash:propertySuggestionGenerator tosh:DeleteTripleSuggestionGenerator ; . dash:NonRecursiveConstraintComponent-nonRecursive sh:group tosh:ValueConstraintsPropertyGroup ; sh:order "5"^^xsd:decimal ; . dash:PrimaryKeyConstraintComponent-uriStart sh:group tosh:StringConstraintsPropertyGroup ; sh:order "40"^^xsd:decimal ; . dash:PropertyRole sh:property tosh:Resource-comment ; sh:property tosh:Resource-label ; . dash:QueryTestCase sh:property tosh:QueryTestCase-expectedResult ; . dash:ReifiableByConstraintComponent-reifiableBy sh:group tosh:ReificationPropertyGroup ; sh:order "0"^^xsd:decimal ; . dash:ResourceAction sh:property tosh:ResourceAction-jsCondition ; . dash:RootClassConstraintComponent dash:propertySuggestionGenerator tosh:DeleteTripleSuggestionGenerator ; . dash:RootClassConstraintComponent-rootClass sh:group tosh:ValueConstraintsPropertyGroup ; sh:order "10"^^xsd:decimal ; . dash:SPARQLConstructTemplate a sh:NodeShape ; sh:property tosh:Parameterizable-labelTemplate ; . dash:SPARQLSelectTemplate a sh:NodeShape ; sh:property tosh:Parameterizable-labelTemplate ; . dash:Script sh:property tosh:Resource-comment ; sh:property tosh:Resource-label ; sh:property tosh:Script-js ; . dash:ScriptConstraint sh:property tosh:Script-onAllValues ; sh:property tosh:ScriptConstraint-deactivated ; sh:property tosh:ScriptConstraint-message ; . dash:ScriptConstraintComponent-scriptConstraint sh:group tosh:AdvancedPropertyGroup ; sh:order "20"^^xsd:decimal ; . dash:ScriptFunction sh:property tosh:ScriptFunction-canWrite ; . dash:ScriptTestCase sh:property tosh:ScriptTestCase-expectedResult ; sh:property tosh:ScriptTestCase-focusNode ; . dash:ScriptValidator sh:property tosh:Script-onAllValues ; . dash:Service sh:property tosh:Service-canWrite ; sh:property tosh:Service-deactivated ; sh:property tosh:Service-responseContentType ; . dash:StemConstraintComponent-stem sh:group tosh:StringConstraintsPropertyGroup ; sh:order "45"^^xsd:decimal ; . dash:SubSetOfConstraintComponent-subSetOf sh:group tosh:PropertyPairConstraintsPropertyGroup ; sh:order "20"^^xsd:decimal ; . dash:SymmetricConstraintComponent dash:propertySuggestionGenerator tosh:DeleteTripleSuggestionGenerator ; dash:propertySuggestionGenerator [ a dash:SPARQLUpdateSuggestionGenerator ; sh:message "Add symmetric value." ; sh:order "0"^^xsd:decimal ; sh:prefixes <http://topbraid.org/tosh> ; sh:update """INSERT { $value $predicate $focusNode . } WHERE { }""" ; ] ; . dash:SymmetricConstraintComponent-symmetric sh:group tosh:ValueConstraintsPropertyGroup ; sh:order "10"^^xsd:decimal ; . dash:TestCase sh:property tosh:TestCase-deactivated ; . dash:TestCaseResult sh:property [ a sh:PropertyShape ; sh:path dash:testCase ; sh:class dash:TestCase ; sh:description "The dash:TestCase that was executed." ; sh:maxCount 1 ; sh:minCount 1 ; sh:name "test case" ; ] ; sh:property [ a sh:PropertyShape ; sh:path dash:testGraph ; sh:class rdfs:Resource ; sh:description "The graph containing the test case." ; sh:maxCount 1 ; sh:minCount 1 ; sh:name "test graph" ; sh:nodeKind sh:IRI ; ] ; . dash:UniqueValueForClassConstraintComponent-uniqueValueForClass sh:group tosh:ValueConstraintsPropertyGroup ; sh:order "20"^^xsd:decimal ; . dash:ValidationTestCase sh:property tosh:ValidationTestCase-expectedResult ; sh:property tosh:ValidationTestCase-includeSuggestions ; sh:property tosh:ValidationTestCase-validateShapes ; . dash:Widget sh:property tosh:Resource-comment ; sh:property tosh:Resource-label ; tosh:PropertyShapeShape a sh:NodeShape ; rdfs:label "Property shape shape" ; sh:property [ a sh:PropertyShape ; sh:path sh:values ; a owl:Ontology ; dash:generateClass dash:ConstraintReificationShape ; dash:generateClass rdf:Property ; dash:generateClass rdfs:Class ; dash:generateClass rdfs:Datatype ; dash:generateClass owl:Class ; dash:generateClass owl:Ontology ; dash:generateClass sh:ConstraintComponent ; dash:generateClass sh:PropertyGroup ; dash:generateClass sh:Rule ; dash:generateClass sh:Shape ; dash:generatePrefixConstants "dash" ; dash:generatePrefixConstants "owl" ; dash:generatePrefixConstants "rdf" ; dash:generatePrefixConstants "rdfs" ; dash:generatePrefixConstants "sh" ; dash:generatePrefixConstants "xsd" ; rdfs:comment """A collection of SHACL features that are available whenever SHACL graphs are used within TopBraid Suite products. In particular this includes shape definitions for the \"system\" classes such as rdfs:Class, sh:PropertyShape etc. These shapes are used by TopBraid products to validate ontology definitions and to drive user interface forms. The TOSH namespace also includes things like suggestions, Active Data Shapes scripts and a couple of SPARQL functions. Some of these may be of general use outside of TopBraid too.""" ; rdfs:label "TopBraid Data Shapes Library" ; owl:imports <http://datashapes.org/dash> ; sh:declare [ a sh:PrefixDeclaration ; sh:namespace "http://jena.hpl.hp.com/ARQ/function#"^^xsd:anyURI ; sh:prefix "afn" ; ] ; sh:declare [ a sh:PrefixDeclaration ; sh:namespace "http://spinrdf.org/spif#"^^xsd:anyURI ; sh:prefix "spif" ; ] ; sh:declare [ a sh:PrefixDeclaration ; sh:namespace "http://topbraid.org/sparqlmotionfunctions#"^^xsd:anyURI ; sh:prefix "smf" ; ] ; sh:declare [ a sh:PrefixDeclaration ; sh:namespace "http://topbraid.org/tosh#"^^xsd:anyURI ; sh:prefix "tosh" ; ] ; . tosh: tosh:systemNamespace true ; . tosh:Action-actionGroup a sh:PropertyShape ; sh:path dash:actionGroup ; sh:class dash:ActionGroup ; sh:description "The Action Group that the action should appear in (in menus etc)." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:order "5"^^xsd:decimal ; . tosh:Action-actionIconClass a sh:PropertyShape ; sh:path dash:actionIconClass ; sh:datatype xsd:string ; sh:description "The CSS class for the action for display purposes. For example, pick one of https://fontawesome.com/icons?d=gallery&m=free or https://getbootstrap.com/docs/3.3/components/#glyphicons-glyphs" ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:order "7"^^xsd:decimal ; . tosh:Action-deactivated a sh:PropertyShape ; sh:path sh:deactivated ; sh:datatype xsd:boolean ; sh:description "True to deactivate this action (from user interfaces)." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "deactivated" ; sh:order "8"^^xsd:decimal ; . tosh:ActionGroup-order a sh:PropertyShape ; sh:path sh:order ; sh:description "The relative order of this group compared to other groups, e.g. to display in drop down menus." ; sh:group tosh:DisplayPropertyGroup ; sh:maxCount 1 ; sh:name "order" ; sh:or ( [ sh:datatype xsd:decimal ; ] [ sh:datatype xsd:integer ; ] ) ; . tosh:ActionTestCase-action a sh:PropertyShape ; sh:path dash:action ; sh:class dash:Action ; sh:description "The dash:Action to execute." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:minCount 1 ; sh:name "action" ; sh:nodeKind sh:IRI ; sh:order "0"^^xsd:decimal ; . tosh:ActionTestCase-expectedResult a sh:PropertyShape ; sh:path dash:expectedResult ; sh:description "The expected result of the evaluation, as JSON object as produced by the servlet, or true or false." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:name "expected result" ; sh:order "10"^^xsd:decimal ; . tosh:ActionTestCase-focusNode a sh:PropertyShape ; sh:path dash:focusNode ; sh:name "on property" ; sh:order 0 ; ] ; sh:targetClass sh:PropertyShape ; . tosh:RelationshipPropertyGroup sh:order "2"^^xsd:decimal ; . rdfs:label "Relationship" ; sh:order 8 ; . tosh:ReplaceWithDefaultValueSuggestionGenerator a dash:SPARQLUpdateSuggestionGenerator ; rdfs:comment "Produces a suggestion to replace all values of the given predicate (which must exist) at the focus node to the default value declared at the shape that has caused the violation. Does nothing if the shape does not declare a sh:defaultValue. Deletes any old value of the property." ; sh:maxCount 1 ; sh:name "deactivated" ; sh:order "10"^^xsd:decimal ; . tosh:ChangeScript-order a sh:PropertyShape ; sh:path sh:order ; sh:description "The relative order of this script compared to other change scripts. The default value is 0. Scripts with lower numbers are executed first." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "order" ; sh:or ( [ sh:datatype xsd:decimal ; ] [ sh:datatype xsd:integer ; ] ) ; sh:order "40"^^xsd:decimal ; . tosh:Class-ShapeScript a dash:ShapeScript ; dash:js """ /** * Returns this class as an instance of sh:NodeShape. * @returns {sh_NodeShape} */ asNodeShape() { return sh.asNodeShape(this); } /** * @callback rdfs_Class_callback * @param {rdfs_Class} class the visited class */ /** * Performs a depth-first traversal this class and its superclasses, visiting each (super) class * once until the callback function returns a non-null/undefined result. This becomes the result of this function. * The order in which sibling classes are traversed is undefined, so results may be inconsistent in * multiple-inheritance scenarios. * @param {rdfs_Class_callback} callback the callback for each class * @param {Set} [reached] the Set of reached URI strings, used internally * @returns the return value of the first callback that returned any value */ walkSuperclasses(callback, reached) { if(!reached) { reached = new Set(); } if(!reached.has(this.uri)) { reached.add(this.uri); let result = callback(this); if(result !== undefined && result !== null) { return result; } let supers = this.superclasses; for(let i = 0; i < supers.length; i++) { result = supers[i].walkSuperclasses(callback, reached); if(result !== undefined && result !== null) { return result; } } } } """ ; . tosh:Class-abstract a sh:PropertyShape ; sh:path dash:abstract ; sh:datatype xsd:boolean ; sh:description "States whether this class is abstract, i.e. cannot have direct instances. Abstract classes are typically used to defined shared properties of its subclasses." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "abstract" ; sh:order "30"^^xsd:decimal ; . tosh:Class-classIcon a sh:PropertyShape ; sh:path tosh:classIcon ; dash:hidden true ; dash:propertyRole dash:IconRole ; sh:datatype xsd:string ; sh:defaultValue "http://datashapes.org/icons/class.svg" ; sh:description "Used to return the default icon for all classes." ; sh:group tosh:DisplayPropertyGroup ; sh:maxCount 1 ; sh:name "class icon" ; sh:order "1"^^xsd:decimal ; . tosh:Class-constructor a sh:PropertyShape ; sh:path dash:constructor ; graphql:name "constructorScript" ; sh:class dash:Constructor ; sh:description "The Constructor that shall be used to create new instances of this class or its subclasses." ; sh:group tosh:ScriptsPropertyGroup ; sh:maxCount 1 ; sh:name "constructor" ; sh:order "20"^^xsd:decimal ; . tosh:Class-disjointWith a sh:PropertyShape ; sh:path owl:disjointWith ; sh:class owl:Class ; sh:group tosh:OWLAxiomsPropertyGroup ; sh:name "disjoint with" ; sh:order "1"^^xsd:decimal ; . tosh:Class-domain-inverse a sh:PropertyShape ; sh:path [ sh:inversePath rdfs:domain ; ] ; dash:editor dash:PropertyAutoCompleteEditor ; sh:class rdf:Property ; sh:description "The properties that declare to have this class in their domain." ; sh:group tosh:RDFSPropertyAxiomsPropertyGroup ; sh:name "domain of" ; sh:nodeKind sh:IRI ; sh:order "0"^^xsd:decimal ; . tosh:Class-equivalentClass a sh:PropertyShape ; sh:path owl:equivalentClass ; sh:class owl:Class ; sh:group tosh:OWLAxiomsPropertyGroup ; sh:name "equivalent classes" ; sh:order "0"^^xsd:decimal ; . tosh:Class-hidden a sh:PropertyShape ; sh:path dash:hidden ; sh:datatype xsd:boolean ; sh:description "True if this class shall be hidden from the class hierarchies." ; sh:group tosh:DisplayPropertyGroup ; sh:maxCount 1 ; sh:name "hidden" ; sh:order "0"^^xsd:decimal ; . tosh:Class-range-inverse a sh:PropertyShape ; sh:path [ sh:inversePath rdfs:range ; ] ; dash:editor dash:PropertyAutoCompleteEditor ; sh:class rdf:Property ; sh:description "The properties that have this class in their rdfs:range." ; sh:group tosh:RDFSPropertyAxiomsPropertyGroup ; sh:name "range of" ; sh:nodeKind sh:IRI ; sh:order "1"^^xsd:decimal ; . tosh:Class-resourceAction a sh:PropertyShape ; sh:path dash:resourceAction ; graphql:name "resourceActions" ; sh:class dash:ResourceAction ; sh:description "The Resource Actions that can be applied to instances of this class." ; sh:group tosh:ScriptsPropertyGroup ; sh:name "resource actions" ; sh:order "0"^^xsd:decimal ; . tosh:Class-resourceService a sh:PropertyShape ; sh:path dash:resourceService ; graphql:name "resourceServices" ; sh:class dash:ResourceService ; sh:description "The Services that can be applied to instances of this class (as focusNode)." ; sh:group tosh:ScriptsPropertyGroup ; sh:name "resource services" ; sh:order "10"^^xsd:decimal ; . tosh:Class-subClassOf a sh:PropertyShape ; sh:path rdfs:subClassOf ; graphql:name "superclasses" ; sh:class rdfs:Class ; sh:description "The (direct) parent classes of this class." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "superclasses" ; sh:order "20"^^xsd:decimal ; . tosh:Class-subClassOf-inverse a sh:PropertyShape ; sh:path [ sh:inversePath rdfs:subClassOf ; ] ; dash:hidden true ; graphql:name "subclasses" ; sh:class rdfs:Class ; sh:description "The (direct) subclasses of this class." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "subclasses" ; sh:order "21"^^xsd:decimal ; . tosh:ConstraintComponent-localConstraint a sh:PropertyShape ; sh:path dash:localConstraint ; sh:datatype xsd:boolean ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "local constraint" ; sh:order "10"^^xsd:decimal ; . tosh:ConstraintComponent-message a sh:PropertyShape ; sh:path sh:message ; sh:description "The message to generate on violations." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "messages" ; sh:or dash:StringOrLangString ; sh:order "26"^^xsd:decimal ; . tosh:ConstraintComponent-nodeValidator a sh:PropertyShape ; sh:path sh:nodeValidator ; sh:class sh:Validator ; sh:description "The validator(s) used to evaluate a constraint in the context of a node shape." ; sh:group tosh:ImplementationPropertyGroup ; sh:name "node validators" ; sh:order "2"^^xsd:decimal ; . tosh:ConstraintComponent-propertySuggestionGenerator a sh:PropertyShape ; sh:path dash:propertySuggestionGenerator ; sh:class dash:SuggestionGenerator ; sh:group tosh:ImplementationPropertyGroup ; sh:name "property suggestion generators" ; sh:order "20"^^xsd:decimal ; . tosh:ConstraintComponent-propertyValidator a sh:PropertyShape ; sh:path sh:propertyValidator ; sh:class sh:Validator ; sh:description "The validator(s) used to evaluate a constraint in the context of a property shape." ; sh:group tosh:ImplementationPropertyGroup ; sh:name "property validators" ; sh:order "1"^^xsd:decimal ; . tosh:ConstraintComponent-staticConstraint a sh:PropertyShape ; sh:path dash:staticConstraint ; sh:datatype xsd:boolean ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "static constraint" ; sh:order "11"^^xsd:decimal ; . tosh:ConstraintComponent-validator a sh:PropertyShape ; sh:path sh:validator ; sh:class sh:Validator ; sh:description "The validator(s) used to evaluate constraints of either node or property shapes, unless more specific validators are available." ; sh:group tosh:ImplementationPropertyGroup ; sh:name "validators" ; sh:order "0"^^xsd:decimal ; . tosh:DatatypePropertyShapeView a sh:NodeShape ; rdfs:comment "The default view shape for property shapes on datatype values." ; rdfs:label "Attribute view" ; sh:node tosh:PropertyShapeView ; sh:property dash:PrimaryKeyConstraintComponent-uriStart ; sh:property dash:SingleLineConstraintComponent-singleLine ; sh:property tosh:Shape-datatypes ; sh:property sh:LanguageInConstraintComponent-languageIn ; sh:property sh:LessThanConstraintComponent-lessThan ; sh:property sh:LessThanOrEqualsConstraintComponent-lessThanOrEquals ; sh:property sh:MaxExclusiveConstraintComponent-maxExclusive ; sh:property sh:MaxInclusiveConstraintComponent-maxInclusive ; sh:property sh:MaxLengthConstraintComponent-maxLength ; sh:property sh:MinExclusiveConstraintComponent-minExclusive ; sh:property sh:MinInclusiveConstraintComponent-minInclusive ; sh:property sh:MinLengthConstraintComponent-minLength ; sh:property sh:PatternConstraintComponent-flags ; sh:property sh:PatternConstraintComponent-pattern ; sh:property sh:UniqueLangConstraintComponent-uniqueLang ; . tosh:DatatypesViewer a dash:MultiViewer ; dash:hidden true ; rdfs:label "Datatypes viewer" ; . tosh:DefinitionPropertyGroup a sh:PropertyGroup ; rdfs:label "Definition" ; sh:order "0"^^xsd:decimal ; . tosh:DeleteTripleSuggestionGenerator a dash:SPARQLUpdateSuggestionGenerator ; rdfs:comment "Produces a suggestion that would delete the offending value in the validation result from the focus node." ; rdfs:label "Delete triple suggestion generator" ; sh:message "Delete the invalid statement" ; sh:order 100.0 ; sh:update """DELETE { $focusNode $predicate $value . } WHERE { $focusNode $predicate $value . }""" ; . tosh:DependentEnumSelectEditor a dash:SingleEditor ; rdfs:comment """A drop-down editor for enumerated values that are dynamically determined via a node shape that has sh:target dash:HasValueTarget. Example: states:USAddressShape rdf:type sh:NodeShape ; rdfs:label \"US Address shape\" ; sh:property [ rdf:type sh:PropertyShape ; ] ; sh:returnType xsd:boolean ; . tosh:open a rdf:Property ; a owl:DeprecatedProperty ; sh:in ( dash:Experimental dash:Stable dash:Deprecated ) ; sh:maxCount 1 ; sh:name "API status" ; sh:order "15"^^xsd:decimal ; . tosh:Function-cachable a sh:PropertyShape ; sh:path dash:cachable ; sh:datatype xsd:boolean ; sh:description "True to indicate that this function will always return the same values for the same combination of arguments, regardless of the query graphs. Engines can use this information to cache and reuse previous function calls." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "cachable" ; sh:order "10"^^xsd:decimal ; . tosh:Function-returnType a sh:PropertyShape ; sh:path sh:returnType ; sh:class rdfs:Class ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "return type" ; sh:order "5"^^xsd:decimal ; . tosh:FunctionTestCase-expectedResult a sh:PropertyShape ; sh:path dash:expectedResult ; sh:description "The expected result of a function call." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:name "expected result" ; sh:order "10"^^xsd:decimal ; . tosh:FunctionTestCase-expression a sh:PropertyShape ; sh:path dash:expression ; sh:description "A valid SPARQL expression calling the function to test." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:minCount 1 ; sh:name "expression" ; sh:order "0"^^xsd:decimal ; . tosh:GovernanceRoleSelectEditor a dash:SingleEditor ; rdfs:label "Governance role editor" ; . tosh:GovernanceRoleViewer a dash:SingleViewer ; rdfs:label "Governance role viewer" ; . tosh:GraphStoreTestCase-expectedResult a sh:PropertyShape ; sh:path dash:expectedResult ; sh:datatype xsd:string ; sh:description "The expected RDF graph, as a Turtle string." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:minCount 1 ; sh:order "10"^^xsd:decimal ; . tosh:GraphStoreTestCase-uri a sh:PropertyShape ; sh:path dash:uri ; sh:datatype xsd:anyURI ; sh:description "The URI of the graph to load." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:minCount 1 ; sh:name "uri" ; sh:order "0"^^xsd:decimal ; . tosh:ImplementationPropertyGroup a sh:PropertyGroup ; rdfs:label "Implementation" ; sh:order "10"^^xsd:decimal ; . tosh:IncludedScript-exports a sh:PropertyShape ; sh:path dash:exports ; sh:datatype xsd:string ; sh:description "Declares the symbols that shall be exported from the surrounding module, e.g. for use in Node.js applications." ; sh:group tosh:ImplementationPropertyGroup ; sh:name "exports" ; sh:order "30"^^xsd:decimal ; . tosh:InferenceRulesShape a sh:NodeShape ; rdfs:comment "A node shape for classes and node shapes, declaring the sh:rule property." ; rdfs:label "Inference rules" ; sh:property tosh:InferenceRulesShape-rule ; sh:targetClass sh:NodeShape ; . tosh:InferenceRulesShape-rule a sh:PropertyShape ; sh:path sh:rule ; sh:class sh:Rule ; sh:description "The inference rules associated with this node shape or class." ; sh:group tosh:InferencesPropertyGroup ; sh:name "rule" ; . tosh:InferencesPropertyGroup a sh:PropertyGroup ; rdfs:label "Inferences" ; sh:order "80"^^xsd:decimal ; . tosh:InferencingTestCase-expectedResult a sh:PropertyShape ; sh:path dash:expectedResult ; sh:description "The expected inferred triples, represented by instances of rdfs:Statement." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:name "expected result" ; sh:order "10"^^xsd:decimal ; . tosh:InstancesInGraphSelectEditor a dash:SingleEditor ; rdfs:comment "A drop-down editor for all instances of a class (based on tosh:shapeInGraph/sh:class of the property) in a graph specified using tosh:graph." ; rdfs:label "Instances in graph select editor" ; . tosh:JSTestCase-expectedResult a sh:PropertyShape ; sh:path dash:expectedResult ; sh:description "The expected result of the JavaScript function call, as an RDF node." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:name "expected result" ; . tosh:MemberShapeConstraintComponent a sh:ConstraintComponent ; rdfs:comment "Can be used to specify constraints on the members of a given list, assuming that the given sh:property has rdf:Lists as values. A violation is reported for each member of the list that does not comply with the constraints specified by the given shape." ; rdfs:label "Member shape constraint component" ; sh:parameter tosh:MemberShapeConstraintComponent-memberShape ; sh:propertyValidator [ a sh:SPARQLSelectValidator ; sh:message "List member does not have the shape {$memberShape}" ; sh:prefixes <http://topbraid.org/tosh> ; sh:select """ SELECT DISTINCT $this ?value ?failure ?member WHERE { $this $PATH ?value . ?value rdf:rest*/rdf:first ?member . BIND (tosh:hasShape(?member, $memberShape) AS ?hasShape) . BIND (!bound(?hasShape) AS ?failure) . FILTER (?failure || !?hasShape) . } """ ; ] ; sh:targetClass sh:PropertyShape ; . tosh:MemberShapeConstraintComponent-memberShape a sh:Parameter ; sh:path tosh:memberShape ; sh:class sh:Shape ; sh:description "The shape that the list members must have." ; sh:name "member shape" ; . tosh:ModifyAction-skipPreview a sh:PropertyShape ; sh:path dash:skipPreview ; sh:datatype xsd:boolean ; sh:description "For actions that take no parameters, this can be set to true to skip any means for the user to preview the action. It will instead directly execute the modification." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "skip preview" ; sh:order "11"^^xsd:decimal ; . tosh:MultiFunction-resultVariable a sh:PropertyShape ; sh:path dash:resultVariable ; sh:class sh:Parameter ; sh:description "The result variables." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "result variables" ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order "30"^^xsd:decimal ; . tosh:NodeShape-ShapeScript a dash:ShapeScript ; dash:js """ /** * Returns this class as an instance of rdfs_Class, assuming this node shape is also a class. * @returns {rdfs_Class} */ asClass() { return rdfs.asClass(this); } /** * Gets the \"nearest\" constraint of a given type and a given path property. Deactivated shapes are skipped. * For example, call it with (ex.myProperty, sh.datatype) to find the closest sh:datatype constraint for ex:myProperty. * @param {NamedNode} path the property that is the sh:path of matching property shapes * @param {NamedNode} predicate the property to fetch the nearest value of */ nearestPropertyShapeValue(path, predicate) { return this.walkSupershapes(s => { if(!s.deactivated) { let ps = s.properties; for(let i = 0; i < ps.length; i++) { if(!ps[i].deactivated && graph.contains(ps[i], sh.path, path)) { let value = ps[i].value(predicate); if(value !== null && value !== undefined) { return value; } } } } }) } /** * @callback sh_NodeShape_callback * @param {sh_NodeShape} nodeShape the visited node shape */ /** * Performs a depth-first traversal of this and its superclasses (via rdfs:subClassOf) and supershapes (via sh:node), * visiting each (super) shape once until the callback function returns a non-null/undefined result. This becomes the result of this function. * The order in which sibling parents are traversed is undefined. * @param {sh_NodeShape_callback} callback the callback for each shape * @param {Set} [reached] the Set of reached URI strings, used internally but may also be used to terminate at certain supers * @returns the return value of the first callback that returned any value */ walkSupershapes(callback, reached) { if(!reached) { reached = new Set(); } if(!reached.has(this.uri)) { reached.add(this.uri); let result = callback(this); if(result !== undefined && result !== null) { return result; } let superClasses = this.asClass().superclasses; for(let i = 0; i < superClasses.length; i++) { result = superClasses[i].asNodeShape().walkSupershapes(callback, reached); if(result !== undefined && result !== null) { return result; } } let superShapes = this.supershapes; for(let i = 0; i < superShapes.length; i++) { result = superShapes[i].walkSupershapes(callback, reached); if(result !== undefined && result !== null) { return result; } } } } """ ; . tosh:NodeShape-applicableToClass a sh:PropertyShape ; sh:path dash:applicableToClass ; sh:class rdfs:Class ; sh:description "Links a node shape with the classes that it can be applied to." ; sh:group tosh:TargetsPropertyGroup ; sh:name "applicable to classes" ; sh:nodeKind sh:IRI ; sh:order "10"^^xsd:decimal ; . tosh:NodeShape-defaultViewForRole a sh:PropertyShape ; sh:path dash:defaultViewForRole ; dash:editor tosh:GovernanceRoleSelectEditor ; dash:viewer tosh:GovernanceRoleViewer ; sh:description "The user roles that this shape shall be used as default view for." ; sh:group tosh:TargetsPropertyGroup ; sh:name "default view for roles" ; sh:nodeKind sh:IRI ; sh:order "20"^^xsd:decimal ; . tosh:NodeShape-inheritedProperty a sh:PropertyShape ; sh:path tosh:inheritedProperty ; dash:neverMaterialize true ; dash:viewer tosh:PropertyTableViewer ; sh:description "Returns all property shapes that have been declared at \"super-shapes\" (via sh:node) or \"superclasses\" (via rdfs:subClassOf), including the indirect supers, recursively." ; sh:group tosh:PropertiesPropertyGroup ; sh:name "inherited properties" ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order "1"^^xsd:decimal ; sh:values [ sh:path sh:property ; sh:nodes [ sh:minus sh:this ; sh:nodes [ sh:distinct [ sh:path [ sh:oneOrMorePath [ sh:alternativePath ( rdfs:subClassOf sh:node ) ; ] ; ] ; ] ; ] ; ] ; ] ; . tosh:NodeShape-node a sh:PropertyShape ; sh:path sh:node ; graphql:name "supershapes" ; sh:description "The node shapes that this must also conform to, forming a kind of inheritance between shapes similar to a subclass-of relationship." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "node (super shapes)" ; sh:node sh:NodeShape ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order "20"^^xsd:decimal ; . tosh:NodeShape-targetClass a sh:PropertyShape ; sh:path sh:targetClass ; graphql:name "targetClasses" ; sh:class rdfs:Class ; sh:description "The types of instances that this shape is targeted at." ; sh:group tosh:TargetsPropertyGroup ; sh:name "target classes" ; sh:nodeKind sh:IRI ; sh:order "0"^^xsd:decimal ; . tosh:NodeShape-targetObjectsOf a sh:PropertyShape ; sh:path sh:targetObjectsOf ; sh:group tosh:TargetsPropertyGroup ; sh:name "target objects of" ; sh:node rdf:Property ; sh:nodeKind sh:IRI ; sh:order "1"^^xsd:decimal ; . tosh:NodeShape-targetSubjectsOf a sh:PropertyShape ; sh:path sh:targetSubjectsOf ; sh:group tosh:TargetsPropertyGroup ; sh:name "target subjects of" ; sh:node rdf:Property ; sh:nodeKind sh:IRI ; sh:order "2"^^xsd:decimal ; . tosh:NodeShapeConstraintsShape a sh:NodeShape ; rdfs:comment "A shape that can be used to validate the syntax of node shapes, and to enter constraints for node shapes on forms." ; rdfs:label "Node shape constraints" ; sh:property dash:ClosedByTypesConstraintComponent-closedByTypes ; sh:property dash:ScriptConstraintComponent-scriptConstraint ; sh:property dash:SingleLineConstraintComponent-singleLine ; sh:property dash:StemConstraintComponent-stem ; sh:property tosh:Shape-datatypes ; sh:property sh:ClassConstraintComponent-class ; sh:property sh:ClosedConstraintComponent-closed ; sh:property sh:ClosedConstraintComponent-ignoredProperties ; sh:property sh:DatatypeConstraintComponent-datatype ; sh:property sh:HasValueConstraintComponent-hasValue ; sh:property sh:InConstraintComponent-in ; sh:property sh:LanguageInConstraintComponent-languageIn ; sh:property sh:MaxExclusiveConstraintComponent-maxExclusive ; sh:property sh:MaxInclusiveConstraintComponent-maxInclusive ; sh:property sh:MaxLengthConstraintComponent-maxLength ; sh:property sh:MinExclusiveConstraintComponent-minExclusive ; sh:property sh:MinInclusiveConstraintComponent-minInclusive ; sh:property sh:MinLengthConstraintComponent-minLength ; sh:property sh:NodeKindConstraintComponent-nodeKind ; sh:property sh:PatternConstraintComponent-flags ; sh:property sh:PatternConstraintComponent-pattern ; sh:property sh:SPARQLConstraintComponent-sparql ; sh:targetClass sh:NodeShape ; . tosh:NumberOfValuesPropertyGroup a sh:PropertyGroup ; rdfs:label "Number of Values" ; sh:order "40"^^xsd:decimal ; . tosh:OWLAxiomsPropertyGroup a sh:PropertyGroup ; rdfs:label "OWL Axioms" ; sh:order "17"^^xsd:decimal ; . tosh:ObjectPropertyShapeView a sh:NodeShape ; rdfs:comment "The default view shape for property shapes on object values." ; rdfs:label "Relationship view" ; sh:node tosh:PropertyShapeView ; sh:property dash:NonRecursiveConstraintComponent-nonRecursive ; sh:property dash:RootClassConstraintComponent-rootClass ; sh:property dash:StemConstraintComponent-stem ; sh:property dash:SymmetricConstraintComponent-symmetric ; sh:property tosh:ObjectPropertyShapeView-node ; sh:property sh:ClassConstraintComponent-class ; sh:property sh:NodeKindConstraintComponent-nodeKind ; . tosh:ObjectPropertyShapeView-node a sh:PropertyShape ; sh:path sh:node ; dash:reifiableBy dash:ConstraintReificationShape ; sh:class sh:NodeShape ; sh:description "The node shape(s) that all values of the property must conform to." ; sh:group tosh:ValueConstraintsPropertyGroup ; sh:name "node" ; sh:order "0"^^xsd:decimal ; . tosh:Ontology-imports a sh:PropertyShape ; sh:path owl:imports ; sh:description "The (directly) imported graphs." ; sh:name "imports" ; sh:nodeKind sh:IRI ; . tosh:Parameterizable-labelTemplate a sh:PropertyShape ; sh:path sh:labelTemplate ; sh:description "Outlines how human-readable labels of instances of the associated Parameterizable shall be produced. The values can contain {?paramName} as placeholders for the actual values of the given parameter." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "label template" ; sh:or dash:StringOrLangString ; sh:order "25"^^xsd:decimal ; . tosh:Parameterizable-parameter a sh:PropertyShape ; sh:path sh:parameter ; sh:class sh:Parameter ; sh:description "The input parameters." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "parameters" ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order "20"^^xsd:decimal ; . tosh:PathStringViewer a dash:MultiViewer ; dash:hidden true ; rdfs:label "Path string viewer" ; . tosh:PropertiesPropertyGroup a sh:PropertyGroup ; rdfs:comment "The declared and inferred properties of a shape or class." ; rdfs:label "Properties" ; sh:order "10"^^xsd:decimal ; . tosh:Property-domain a sh:PropertyShape ; sh:path rdfs:domain ; graphql:name "domains" ; sh:description "The domain(s) of this property." ; sh:group tosh:PropertyAxiomsPropertyGroup ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order "0"^^xsd:decimal ; . tosh:Property-range a sh:PropertyShape ; sh:path rdfs:range ; graphql:name "ranges" ; sh:description "The range(s) of this property." ; sh:group tosh:PropertyAxiomsPropertyGroup ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order "1"^^xsd:decimal ; . tosh:Property-subPropertyOf a sh:PropertyShape ; sh:path rdfs:subPropertyOf ; graphql:name "superproperties" ; sh:class rdf:Property ; sh:description "The (direct) superproperties of this." ; sh:group tosh:PropertyAxiomsPropertyGroup ; sh:name "superproperties" ; sh:nodeKind sh:IRI ; sh:order "2"^^xsd:decimal ; . tosh:Property-subPropertyOf-inverse a sh:PropertyShape ; sh:path [ sh:inversePath rdfs:subPropertyOf ; ] ; graphql:name "subproperties" ; sh:class rdf:Property ; sh:description "The (direct) subproperties of this." ; sh:group tosh:PropertyAxiomsPropertyGroup ; sh:name "subproperties" ; sh:nodeKind sh:IRI ; sh:order "3"^^xsd:decimal ; . tosh:PropertyAxiomsPropertyGroup a sh:PropertyGroup ; rdfs:label "Property Axioms" ; sh:order "1"^^xsd:decimal ; . tosh:PropertyGroup-order a sh:PropertyShape ; sh:path sh:order ; sh:description "The relative order of this group compared to others." ; sh:group tosh:DisplayPropertyGroup ; sh:maxCount 1 ; sh:name "order" ; sh:or ( [ sh:datatype xsd:decimal ; ] [ sh:datatype xsd:integer ; ] ) ; sh:order "0"^^xsd:decimal ; . tosh:PropertyPairConstraintsPropertyGroup a sh:PropertyGroup ; rdfs:label "Property Pair Constraints" ; sh:order "75"^^xsd:decimal ; . tosh:PropertyShape-defaultValue a sh:PropertyShape ; sh:path sh:defaultValue ; dash:readOnly true ; dash:viewer dash:NodeExpressionViewer ; tosh:useDeclaredDatatype true ; sh:description "The default value to be used for this property if no other value has been asserted. This may be a constant value or a SHACL node expression, in which case the values can be derived from other values. Default values are typically inferred and not stored as RDF statements." ; sh:group tosh:InferencesPropertyGroup ; sh:name "default value" ; sh:order "0"^^xsd:decimal ; . tosh:PropertyShape-description a sh:PropertyShape ; sh:path sh:description ; dash:singleLine false ; graphql:name "descriptions" ; sh:description "The description(s) of the property, possibly in multiple languages." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "descriptions" ; sh:nodeKind sh:Literal ; sh:or dash:StringOrLangStringOrHTML ; sh:order "1"^^xsd:decimal ; sh:sparql [ sh:message "Property shapes cannot have both class and datatype constraints." ; sh:prefixes <http://topbraid.org/tosh> ; sh:select """SELECT $this WHERE { FILTER EXISTS { $this sh:class ?class . $this sh:datatype ?datatype . } }""" ; ] ; . tosh:PropertyShape-detailsEndpoint a sh:PropertyShape ; sh:path dash:detailsEndpoint ; sh:datatype xsd:string ; sh:maxCount 1 ; sh:name "details endpoint" ; . tosh:PropertyShape-editor a sh:PropertyShape ; sh:path dash:editor ; dash:editor dash:InstancesSelectEditor ; sh:class dash:Editor ; sh:description "The editor component that should be used to edit values of this property." ; sh:group tosh:DisplayPropertyGroup ; sh:maxCount 1 ; sh:nodeKind sh:IRI ; sh:order "11"^^xsd:decimal ; . tosh:PropertyShape-group a sh:PropertyShape ; sh:path sh:group ; sh:class sh:PropertyGroup ; sh:description "The group that this property belongs to." ; sh:group tosh:DisplayPropertyGroup ; sh:maxCount 1 ; sh:name "group" ; sh:order "0"^^xsd:decimal ; . tosh:PropertyShape-hidden a sh:PropertyShape ; sh:path dash:hidden ; dash:editor dash:BooleanSelectEditor ; sh:datatype xsd:boolean ; sh:description "True to mark this property as hidden in user interface, yet still used in data tasks." ; sh:group tosh:DisplayPropertyGroup ; sh:maxCount 1 ; sh:order "30"^^xsd:decimal ; . tosh:PropertyShape-indexed a sh:PropertyShape ; sh:path dash:indexed ; sh:datatype xsd:boolean ; sh:description "True to indicate that the values of this shall be indexed, forming ordered arrays." ; sh:maxCount 1 ; sh:name "indexed" ; . tosh:PropertyShape-name a sh:PropertyShape ; sh:path sh:name ; dash:singleLine true ; graphql:name "names" ; sh:description "The display names of the property, possibly in multiple languages." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "names" ; sh:nodeKind sh:Literal ; sh:or dash:StringOrLangString ; sh:order "0"^^xsd:decimal ; . tosh:PropertyShape-neverMaterialize a sh:PropertyShape ; sh:path dash:neverMaterialize ; sh:datatype xsd:boolean ; sh:group tosh:InferencesPropertyGroup ; sh:maxCount 1 ; sh:name "never materialize" ; sh:order "11"^^xsd:decimal ; . tosh:PropertyShape-order a sh:PropertyShape ; sh:path sh:order ; sh:description "The relative order of this property shape compared to others." ; sh:group tosh:DisplayPropertyGroup ; sh:maxCount 1 ; sh:name "order" ; sh:or ( [ sh:datatype xsd:decimal ; ] [ sh:datatype xsd:integer ; ] ) ; sh:order "1"^^xsd:decimal ; . tosh:PropertyShape-path a sh:PropertyShape ; sh:path sh:path ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:minCount 1 ; sh:name "path" ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order "31"^^xsd:decimal ; . tosh:PropertyShape-propertyRole a sh:PropertyShape ; sh:path dash:propertyRole ; sh:class dash:PropertyRole ; sh:group tosh:DisplayPropertyGroup ; sh:maxCount 1 ; sh:name "role" ; sh:order "40"^^xsd:decimal ; . tosh:PropertyShape-readOnly a sh:PropertyShape ; sh:path dash:readOnly ; dash:editor dash:BooleanSelectEditor ; dash:viewer dash:NodeExpressionViewer ; sh:datatype xsd:boolean ; sh:description """If set to true then the values of this property should not be editable in the user interface. Note that low-level access such as source code editors may still allow editing, but form-based editors would not. More generally, the values of this property are SHACL node expressions, e.g. function calls, in which case the property counts as read-only if the expression evaluates to true.""" ; sh:group tosh:DisplayPropertyGroup ; sh:maxCount 1 ; sh:order "20"^^xsd:decimal ; . tosh:PropertyShape-values a sh:PropertyShape ; sh:path sh:values ; dash:viewer dash:NodeExpressionViewer ; sh:group tosh:InferencesPropertyGroup ; sh:name "values" ; sh:order "10"^^xsd:decimal ; sh:sparql [ sh:message "sh:values must be accompanied by a sh:path that is an IRI." ; sh:prefixes <http://topbraid.org/tosh> ; sh:select """SELECT $this ?value WHERE { $this $PATH ?value . FILTER NOT EXISTS { $this sh:path ?path . FILTER isIRI(?path) } }""" ; ] ; . tosh:PropertyShape-viewer a sh:PropertyShape ; sh:path dash:viewer ; dash:editor dash:InstancesSelectEditor ; sh:class dash:Viewer ; sh:description "The viewer component that should be used to render values of this property." ; sh:group tosh:DisplayPropertyGroup ; sh:maxCount 1 ; sh:nodeKind sh:IRI ; sh:order "10"^^xsd:decimal ; . tosh:PropertyShapeView a sh:NodeShape ; rdfs:comment "Base view shape for either datatype or object property shapes." ; rdfs:label "Property shape view" ; sh:property dash:CoExistsWithConstraintComponent-coExistsWith ; sh:property dash:IndexedConstraintComponent-indexed ; sh:property dash:ReifiableByConstraintComponent-reifiableBy ; sh:property dash:ScriptConstraintComponent-scriptConstraint ; sh:property dash:SubSetOfConstraintComponent-subSetOf ; sh:property tosh:PropertyShape-defaultValue ; sh:property tosh:PropertyShape-description ; sh:property tosh:PropertyShape-editor ; sh:property tosh:PropertyShape-group ; sh:property tosh:PropertyShape-hidden ; sh:property tosh:PropertyShape-name ; sh:property tosh:PropertyShape-neverMaterialize ; sh:property tosh:PropertyShape-order ; sh:property tosh:PropertyShape-propertyRole ; sh:property tosh:PropertyShape-readOnly ; sh:property tosh:PropertyShape-values ; sh:property tosh:PropertyShape-viewer ; sh:property tosh:PropertyShapeView-message ; sh:property tosh:PropertyShapeView-pathSystemLabel ; sh:property tosh:PropertyShapeView-qualifiedMaxCount ; sh:property tosh:PropertyShapeView-qualifiedMinCount ; sh:property tosh:PropertyShapeView-qualifiedValueShape ; sh:property tosh:PropertyShapeView-qualifiedValueShapesDisjoint ; sh:property tosh:Shape-deactivated ; sh:property tosh:Shape-severity ; sh:property sh:DisjointConstraintComponent-disjoint ; sh:property sh:EqualsConstraintComponent-equals ; sh:property sh:MaxCountConstraintComponent-maxCount ; sh:property sh:MinCountConstraintComponent-minCount ; sh:property sh:SPARQLConstraintComponent-sparql ; . tosh:PropertyShapeView-indexed a sh:PropertyShape ; sh:path dash:indexed ; sh:datatype xsd:boolean ; sh:description "Indicates whether the values are sorted by an index. The user interface will display them in-order." ; sh:group tosh:ReificationPropertyGroup ; sh:maxCount 1 ; sh:name "indexed" ; sh:order "1"^^xsd:decimal ; . tosh:PropertyShapeView-message a sh:PropertyShape ; sh:path sh:message ; sh:description "The message that shall be generated for all constraint violations produced by this property shape." ; sh:group tosh:ValidationPropertyGroup ; sh:name "messages" ; sh:or dash:StringOrLangString ; sh:order "5"^^xsd:decimal ; . tosh:PropertyShapeView-pathSystemLabel a sh:PropertyShape ; sh:path tosh:pathSystemLabel ; dash:neverMaterialize true ; dash:viewer tosh:PathStringViewer ; sh:datatype xsd:string ; sh:description "A display label of the sh:path based on qnames." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "property path" ; sh:order "2"^^xsd:decimal ; sh:values [ sh:else [ <http://uispin.org/ui#label> ( [ sh:path sh:path ; ] ) ; ] ; sh:if [ <http://datashapes.org/sparql#isIRI> ( [ sh:path sh:path ; ] ) ; ] ; sh:then [ <http://topbraid.org/sparqlmotionfunctions#qname> ( [ sh:path sh:path ; ] ) ; ] ; ] ; . tosh:PropertyShapeView-qualifiedMaxCount a sh:PropertyShape ; sh:path sh:qualifiedMaxCount ; sh:datatype xsd:integer ; sh:description "The maximum number of values that may conform to the qualified value shape." ; sh:group tosh:QualifiedCardinalityConstraintsPropertyGroup ; sh:maxCount 1 ; sh:name "qualified max count" ; sh:order "1"^^xsd:decimal ; . tosh:PropertyShapeView-qualifiedMinCount a sh:PropertyShape ; sh:path sh:qualifiedMinCount ; sh:datatype xsd:integer ; sh:description "The minimum number of values that must conform to the qualified value shape." ; sh:group tosh:QualifiedCardinalityConstraintsPropertyGroup ; sh:maxCount 1 ; sh:name "qualified min count" ; sh:order "0"^^xsd:decimal ; . tosh:PropertyShapeView-qualifiedValueShape a sh:PropertyShape ; sh:path sh:qualifiedValueShape ; sh:class sh:NodeShape ; sh:description "The shape that the specified number of values must conform to." ; sh:group tosh:QualifiedCardinalityConstraintsPropertyGroup ; sh:name "qualified value shape" ; sh:order "2"^^xsd:decimal ; . tosh:PropertyShapeView-qualifiedValueShapesDisjoint a sh:PropertyShape ; sh:path sh:qualifiedValueShapesDisjoint ; sh:datatype xsd:boolean ; sh:description "True to treat all qualified values as disjoint." ; sh:group tosh:QualifiedCardinalityConstraintsPropertyGroup ; sh:maxCount 1 ; sh:name "qualified value shapes disjoint" ; sh:order "3"^^xsd:decimal ; . tosh:PropertyTableViewer a dash:MultiViewer ; dash:hidden true ; rdfs:label "Property table viewer" ; . tosh:QualifiedCardinalityConstraintsPropertyGroup a sh:PropertyGroup ; rdfs:comment "The properties in this group are used together to express that a certain number of values must conform to a given shape." ; rdfs:label "Qualified Cardinality Constraints" ; sh:order "77"^^xsd:decimal ; . tosh:QueryTestCase-expectedResult a sh:PropertyShape ; sh:path dash:expectedResult ; dash:singleLine false ; sh:description "The expected result set, as a JSON string." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:name "expected result" ; sh:or ( [ sh:datatype rdf:JSON ; ] [ sh:datatype xsd:string ; ] ) ; . tosh:RDFSOWLClassView a sh:NodeShape ; dash:applicableToClass rdfs:Class ; rdfs:comment "A node shape collecting RDFS and OWL axioms for classes." ; rdfs:label "RDFS/OWL class view" ; sh:property tosh:Class-disjointWith ; sh:property tosh:Class-domain-inverse ; sh:property tosh:Class-equivalentClass ; sh:property tosh:Class-range-inverse ; sh:property tosh:Class-subClassOf ; sh:property tosh:Class-subClassOf-inverse ; sh:property tosh:Resource-comment ; sh:property tosh:Resource-label ; sh:property tosh:Resource-type ; . tosh:RDFSPropertyAxiomsPropertyGroup a sh:PropertyGroup ; rdfs:label "RDFS Property Axioms" ; sh:order "15"^^xsd:decimal ; . tosh:ReferencesPropertyGroup a sh:PropertyGroup ; rdfs:comment "A property group typically used for incoming references or usages."^^rdf:HTML ; rdfs:label "References" ; sh:order "100"^^xsd:decimal ; . tosh:ReificationPropertyGroup a sh:PropertyGroup ; rdfs:label "Reification (Statements about Statements)" ; sh:order "90"^^xsd:decimal ; . tosh:ReplaceWithDefaultValueSuggestionGenerator a dash:SPARQLUpdateSuggestionGenerator ; rdfs:comment "Produces a suggestion to replace all values of the given predicate (which must exist) at the focus node to the default value declared at the shape that has caused the violation. Does nothing if the shape does not declare a sh:defaultValue. Deletes any old value of the property." ; rdfs:label "Replace with default value suggestion generator" ; sh:message "Replace with default value" ; sh:prefixes <http://topbraid.org/tosh> ; sh:select """SELECT ?defaultValue WHERE { GRAPH $shapesGraph { $sourceShape sh:defaultValue ?defaultValue . } }""" ; sh:update """DELETE { $focusNode $predicate ?oldValue . } INSERT { $focusNode $predicate ?defaultValue . } WHERE { $focusNode $predicate ?oldValue . }""" ; . tosh:Resource-comment a sh:PropertyShape ; sh:path rdfs:comment ; dash:propertyRole dash:DescriptionRole ; dash:singleLine false ; graphql:name "comments" ; sh:description "The comments of this, possibly in multiple languages." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "comments" ; sh:or dash:StringOrLangStringOrHTML ; sh:order "1"^^xsd:decimal ; . tosh:Resource-label a sh:PropertyShape ; sh:path rdfs:label ; dash:propertyRole dash:LabelRole ; graphql:name "labels" ; sh:description "The display name(s) of this, possibly in multiple languages." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "labels" ; sh:or dash:StringOrLangString ; sh:order "0"^^xsd:decimal ; . tosh:Resource-type a sh:PropertyShape ; sh:path rdf:type ; graphql:name "types" ; sh:class rdfs:Class ; sh:description "The type(s) of this." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "types" ; sh:order "10"^^xsd:decimal ; . tosh:ResourceAction-jsCondition a sh:PropertyShape ; sh:path dash:jsCondition ; sh:datatype xsd:string ; sh:description "An (ADS) JavaScript expression that will be executed to determine whether the action is applicable to the selected resource in the current context. The variable focusNode can be queried here. The expression needs to return true for the action to be deemed suitable." ; sh:group tosh:ImplementationPropertyGroup ; sh:name "action pre-condition" ; sh:order "25"^^xsd:decimal ; . tosh:ResourceView a sh:NodeShape ; rdfs:comment "A generic view shape that can be used as fallback to display typical resources that have an rdfs:label and an rdfs:comment." ; rdfs:label "Resource view" ; sh:property tosh:Resource-comment ; sh:property tosh:Resource-label ; . tosh:Rule-condition a sh:PropertyShape ; sh:path sh:condition ; sh:description "The pre-conditions that must apply before a rule gets executed. The focus node must conform to all conditions, which must be shapes." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "conditions" ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order "40"^^xsd:decimal ; . tosh:Rule-deactivated a sh:PropertyShape ; sh:path sh:deactivated ; sh:datatype xsd:boolean ; sh:description "True to deactivate the rule so that it will not get executed." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "deactivated" ; sh:order "30"^^xsd:decimal ; . tosh:Rule-order a sh:PropertyShape ; sh:path sh:order ; sh:description "The order of this rule relative to other rules at the same shape. Rules with lower order are executed first. Default value is 0. Rules with the same order cannot \"see\" each other's inferences." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "order" ; sh:or ( [ sh:datatype xsd:decimal ; ] [ sh:datatype xsd:integer ; ] ) ; sh:order "35"^^xsd:decimal ; . tosh:Rule-rule-inverse a sh:PropertyShape ; sh:path [ sh:inversePath sh:rule ; ] ; sh:class sh:Shape ; sh:description "The shapes or classes that the rule is attached to." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "rule of" ; sh:order "20"^^xsd:decimal ; . tosh:SHMinMaxEditor a dash:SingleEditor ; dash:hidden true ; rdfs:comment "An internally used editor for min/max range values of property shapes."^^rdf:HTML ; rdfs:label "SHACL Min Max Editor" ; . tosh:SPARQLAskExecutable-ask a sh:PropertyShape ; sh:path sh:ask ; dash:singleLine false ; sh:datatype xsd:string ; sh:description "The SPARQL ASK query string." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "ask" ; sh:order "1"^^xsd:decimal ; . tosh:SPARQLConstraint-deactivated a sh:PropertyShape ; sh:path sh:deactivated ; sh:datatype xsd:boolean ; sh:description "True to deactive this constraint." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "deactivated" ; sh:order "30"^^xsd:decimal ; . tosh:SPARQLConstraint-message a sh:PropertyShape ; sh:path sh:message ; sh:description "The message(s) that should be produced for constraint violations. The messages may contain placeholders such as {$value} for any variable returned in the SELECT clause of the SPARQL query." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "messages" ; sh:or dash:StringOrLangString ; sh:order "20"^^xsd:decimal ; . tosh:SPARQLConstructExecutable-construct a sh:PropertyShape ; sh:path sh:construct ; dash:singleLine false ; sh:datatype xsd:string ; sh:description "The SPARQL CONSTRUCT query string." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "construct" ; sh:order "1"^^xsd:decimal ; . tosh:SPARQLExecutable-prefixes a sh:PropertyShape ; sh:path sh:prefixes ; sh:class owl:Ontology ; sh:description "The Ontology declaring the SHACL prefix declarations to use for the SPARQL query." ; sh:group tosh:ImplementationPropertyGroup ; sh:name "prefixes" ; sh:order "0"^^xsd:decimal ; . tosh:SPARQLSelectExecutable-select a sh:PropertyShape ; sh:path sh:select ; dash:singleLine false ; sh:datatype xsd:string ; sh:description "The SPARQL SELECT query string." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "select" ; sh:order "1"^^xsd:decimal ; . tosh:SPARQLUpdateExecutable-update a sh:PropertyShape ; sh:path sh:update ; dash:singleLine false ; sh:datatype xsd:string ; sh:description "The SPARQL UPDATE request string." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "update" ; sh:order "1"^^xsd:decimal ; . tosh:Script-js a sh:PropertyShape ; sh:path dash:js ; sh:datatype xsd:string ; sh:description "The implementation as JavaScript." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "JavaScript code" ; sh:order "20"^^xsd:decimal ; . tosh:Script-onAllValues a sh:PropertyShape ; sh:path dash:onAllValues ; sh:datatype xsd:boolean ; sh:description "If true then all value nodes will be available to the script at once, through the variable \"values\"." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "on all values" ; sh:order "0"^^xsd:decimal ; . tosh:ScriptConstraint-deactivated a sh:PropertyShape ; sh:path sh:deactivated ; sh:datatype xsd:boolean ; sh:description "True to deactivate this constraint." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "deactivated" ; sh:order "30"^^xsd:decimal ; . tosh:ScriptConstraint-message a sh:PropertyShape ; sh:path sh:message ; sh:description "The message(s) to use for violations produced by this script." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "messages" ; sh:or dash:StringOrLangString ; sh:order "20"^^xsd:decimal ; . tosh:ScriptFunction-canWrite a sh:PropertyShape ; sh:path dash:canWrite ; sh:datatype xsd:boolean ; sh:description "True to allow this function to have side effects. By default, functions are not permitted to modify the graph as this would violate SPARQL contracts. However, if canWrite is true then the function will not be available as a SPARQL function and only be injected into the generated API in read/write mode." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "can write" ; sh:order "15"^^xsd:decimal ; . tosh:ScriptTestCase-expectedResult a sh:PropertyShape ; sh:path dash:expectedResult ; sh:description "The expected result of the evaluation, as JSON object as produced by the servlet, or true or false." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:name "expected result" ; sh:or ( [ sh:datatype rdf:JSON ; ] [ sh:datatype xsd:boolean ; ] ) ; sh:order "0"^^xsd:decimal ; . tosh:ScriptTestCase-focusNode a sh:PropertyShape ; sh:path dash:focusNode ; sh:description "The selected resource, which will become value of focusNode for the script, with its \"most suitable\" JavaScript class as type. Defaults to the test case itself." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:name "focus node" ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order "10"^^xsd:decimal ; . tosh:ScriptsPropertyGroup a sh:PropertyGroup ; rdfs:comment "Scripts based on Active Data Shapes." ; rdfs:label "Scripts" ; sh:order "30"^^xsd:decimal ; . tosh:Service-canWrite a sh:PropertyShape ; sh:path dash:canWrite ; sh:datatype xsd:boolean ; sh:description "True if this service can modify the data, i.e. it will execute in read/write mode. By default, all services are read-only." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "can write" ; . tosh:Service-deactivated a sh:PropertyShape ; sh:path sh:deactivated ; sh:datatype xsd:boolean ; sh:description "True to deactivate this service." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "deactivated" ; sh:order "30"^^xsd:decimal ; . tosh:Service-responseContentType a sh:PropertyShape ; sh:path dash:responseContentType ; sh:datatype xsd:string ; sh:description "The content type (mime type) of the service response, defaulting to \"application/json\". Use \"void\" to return nothing." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "response content type" ; sh:order "10"^^xsd:decimal ; . tosh:SetToDefaultValueSuggestionGenerator a dash:SPARQLUpdateSuggestionGenerator ; rdfs:comment "Produces a suggestion to set the given predicate at the focus node to the default value declared at the shape that has caused the violation. Does nothing if the shape does not declare a sh:defaultValue. Deletes any old value of the property." ; rdfs:label "Set to default value suggestion generator" ; sh:message "Set to default value" ; sh:prefixes <http://topbraid.org/tosh> ; sh:select """SELECT ?defaultValue WHERE { GRAPH $shapesGraph { $sourceShape sh:defaultValue ?defaultValue . } }""" ; sh:update """DELETE { $focusNode $predicate ?oldValue . } INSERT { $focusNode $predicate ?defaultValue . } WHERE { OPTIONAL { $focusNode $predicate ?oldValue . } }""" ; . tosh:Shape-datatypes a sh:PropertyShape ; sh:path tosh:datatypes ; dash:neverMaterialize true ; dash:viewer tosh:DatatypesViewer ; sh:description "Zero of more datatypes that value nodes can take. In SHACL, the typical pattern is to either use a single sh:datatype or a sh:or of multiple sh:datatype constraints. This inferred property here provides a unified way to access these two design patterns." ; sh:group tosh:TypeOfValuesPropertyGroup ; sh:name "datatypes" ; sh:nodeKind sh:IRI ; sh:order "0"^^xsd:decimal ; sh:values [ sh:union ( [ sh:path sh:datatype ; ] [ sh:path ( sh:or [ sh:zeroOrMorePath rdf:rest ; ] rdf:first sh:datatype ) ; ] ) ; ] ; . tosh:Shape-deactivated a sh:PropertyShape ; sh:path sh:deactivated ; sh:datatype xsd:boolean ; sh:description "True to deactivate this shape, making it literally invisible and without any effect." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "deactivated" ; sh:order "30"^^xsd:decimal ; . tosh:Shape-severity a sh:PropertyShape ; sh:path sh:severity ; dash:editor dash:InstancesSelectEditor ; sh:class sh:Severity ; sh:description "The severity to be used for validation results produced by the constraints." ; sh:group tosh:ValidationPropertyGroup ; sh:maxCount 1 ; sh:name "severity" ; sh:order "0"^^xsd:decimal ; . tosh:ShapeInGraphConstraintComponent a sh:ConstraintComponent ; dash:propertySuggestionGenerator tosh:DeleteTripleSuggestionGenerator ; rdfs:comment """A constraint component that can be used to verify that the value nodes have a given shape, where the shape validation is executed in a given graph. This can, for example, be used to verify that a given value is declared as an instance of a given class in some specified (not imported) graph. A typical design pattern is as follows: ex:NodeShape sh:property [ sh:path ex:myProperty ; sh:nodeKind sh:IRI ; tosh:graph <http://example.org/externalGraph> ; tosh:shapeInGraph [ sh:class ex:ExternalClass ; ] ; tosh:editor tosh:InstancesInGraphSelectEditor ; tosh:viewer tosh:URIInGraphViewer ; ] .""" ; rdfs:label "Shape in graph constraint component" ; sh:labelTemplate "Values must have shape {$shapeInGraph} defined in graph {$graph}" ; sh:message "Value does not have shape {$shapeInGraph} defined in graph {$graph}" ; sh:parameter [ a sh:Parameter ; sh:path tosh:graph ; sh:nodeKind sh:IRI ; ] ; sh:parameter [ a sh:Parameter ; sh:path tosh:shapeInGraph ; sh:nodeKind sh:BlankNodeOrIRI ; ] ; sh:validator [ a sh:SPARQLAskValidator ; sh:ask """ASK { GRAPH $graph { FILTER tosh:hasShape($value, $shapeInGraph) } }""" ; sh:prefixes <http://topbraid.org/tosh> ; ] ; . tosh:StringConstraintsPropertyGroup a sh:PropertyGroup ; rdfs:label "String Constraints" ; sh:order "70"^^xsd:decimal ; . tosh:SystemNamespaceShape a sh:NodeShape ; rdfs:comment "A shape that detects whether the focus node is a URI that has a namespace from one of the system namespaces - RDF, RDFS, OWL etc. The list of actual system namespaces is represented via tosh:systemNamespace true triples." ; rdfs:label "System namespace shape" ; sh:sparql [ a sh:SPARQLConstraint ; sh:message "Not a IRI from a system namespace" ; sh:prefixes <http://topbraid.org/tosh> ; sh:select """SELECT $this WHERE { FILTER (!isIRI($this) || (isIRI($this) && EXISTS { BIND (IRI(afn:namespace($this)) AS ?ns) . FILTER NOT EXISTS { ?ns tosh:systemNamespace true } . } )) . }""" ; ] ; . tosh:TargetsPropertyGroup a sh:PropertyGroup ; rdfs:label "Targets" ; sh:order "5"^^xsd:decimal ; . tosh:TeamworkPlatform a dash:ExecutionPlatform ; dash:includedExecutionPlatform tosh:TopBraidPlatform ; rdfs:comment "The platform consisting of TopBraid plus any teamwork features used by TopBraid EDG." ; rdfs:label "Teamwork platform" ; . tosh:TestCase-deactivated a sh:PropertyShape ; sh:path sh:deactivated ; sh:datatype xsd:boolean ; sh:description "If set to true, this test case will be skipped." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:name "deactivated" ; sh:order "50"^^xsd:decimal ; . tosh:TestPropertiesPropertyGroup a sh:PropertyGroup ; rdfs:label "Test Properties" ; sh:order "20"^^xsd:decimal ; . tosh:TopBraidPlatform a dash:ExecutionPlatform ; rdfs:comment "The platform consisting of TopBraid." ; rdfs:label "TopBraid platform" ; . tosh:TripleRule-object a sh:PropertyShape ; sh:path sh:object ; dash:viewer dash:NodeExpressionViewer ; sh:description "The node expression producing the object(s) of the triple inferred by the rule." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:minCount 1 ; sh:name "object" ; sh:order 2 ; . tosh:TripleRule-predicate a sh:PropertyShape ; sh:path sh:predicate ; dash:viewer dash:NodeExpressionViewer ; sh:description "The node expression producing the predicate(s) of the triple inferred by the rule." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:minCount 1 ; sh:name "predicate" ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order 1 ; . tosh:TripleRule-subject a sh:PropertyShape ; sh:path sh:subject ; dash:viewer dash:NodeExpressionViewer ; sh:description "The node expression producing the subject(s) of the triple inferred by the rule." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:minCount 1 ; sh:name "subject" ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order 0 ; . tosh:TypeOfValuesPropertyGroup a sh:PropertyGroup ; rdfs:label "Type of Values" ; sh:order "50"^^xsd:decimal ; . tosh:URIInGraphViewer a dash:SingleViewer ; rdfs:comment "A viewer for URI resources that have their data in a given graph that may be outside of the imports closure. The graph must be specified using a tosh:graph constraint for the property." ; rdfs:label "URI in graph viewer" ; . tosh:UseDeclaredDatatypeConstraintComponent a sh:ConstraintComponent ; dash:propertySuggestionGenerator [ a dash:SPARQLUpdateSuggestionGenerator ; sh:message "Change datatype of the invalid value to the specified sh:datatype" ; sh:prefixes <http://topbraid.org/tosh> ; sh:update """DELETE { $subject $predicate $object . } INSERT { $subject $predicate ?newObject . } WHERE { $subject sh:datatype ?datatype . BIND (spif:cast(?object, ?datatype) AS ?newObject) . }""" ; ] ; rdfs:comment "Constrains the value nodes to be either non-literals or literals that have the same datatype as the declared sh:datatype for the given constraint node. This is used, among others, in properties such as sh:hasValue and sh:minExclusive." ; rdfs:label "Use declared datatype constraint component" ; sh:parameter [ a sh:Parameter ; sh:path tosh:useDeclaredDatatype ; sh:datatype xsd:boolean ; sh:description "True to state that the datatype of literal values must be the same as the declared sh:datatype." ; sh:name "use declared datatype" ; ] ; sh:propertyValidator [ a sh:SPARQLSelectValidator ; sh:message "Datatype must match the declared datatype " ; sh:prefixes <http://topbraid.org/tosh> ; sh:select """ SELECT DISTINCT $this ?value ?datatype WHERE { { FILTER ($useDeclaredDatatype) } $this sh:datatype ?datatype . $this $PATH ?value . FILTER (isLiteral(?value) && datatype(?value) != ?datatype) . }""" ; ] ; sh:targetClass sh:PropertyShape ; . tosh:ValidationPropertyGroup a sh:PropertyGroup ; rdfs:label "Validation" ; sh:order "30"^^xsd:decimal ; . tosh:ValidationTestCase-expectedResult a sh:PropertyShape ; sh:path dash:expectedResult ; sh:description "The expected validation report, either as instance of sh:ValidationReport or a Turtle string with one instance of sh:ValidationReport in it when parsed." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:name "expected result" ; sh:or ( [ sh:datatype xsd:string ; ] [ sh:class sh:ValidationReport ; ] ) ; sh:order "10"^^xsd:decimal ; . tosh:ValidationTestCase-includeSuggestions a sh:PropertyShape ; sh:path dash:includeSuggestions ; sh:datatype xsd:boolean ; sh:description "True to also generate and verify suggestions." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:name "include suggestions" ; sh:order "0"^^xsd:decimal ; . tosh:ValidationTestCase-validateShapes a sh:PropertyShape ; sh:path dash:validateShapes ; sh:datatype xsd:boolean ; sh:description "True to also validate shapes themselves." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:name "validate shapes" ; sh:order "5"^^xsd:decimal ; . tosh:ValueConstraintsPropertyGroup a sh:PropertyGroup ; rdfs:label "Value Constraints" ; sh:order "60"^^xsd:decimal ; . tosh:ValueRangePropertyGroup a sh:PropertyGroup ; rdfs:label "Value Range" ; sh:order "60"^^xsd:decimal ; . tosh:countShapesWithMatchResult a sh:SPARQLFunction ; rdfs:comment "Counts the number of shapes from a given rdf:List (?arg2) defined in a given shapes graph (?arg3) where tosh:hasShape returns the provided match value (true or false, ?arg4) for a given focus node (?arg1). The function produces a failure if one of the shapes validated to a failure." ; rdfs:label "count shapes with match result" ; sh:parameter [ a sh:Parameter ; sh:path sh:expectedValue ; sh:datatype xsd:boolean ; sh:description "The expected value of tosh:hasShape to count." ; sh:order 3.0 ; ] ; sh:parameter [ a sh:Parameter ; sh:path sh:focusNode ; sh:class rdfs:Resource ; sh:description "The focus node." ; sh:order 0.0 ; ] ; sh:parameter [ a sh:Parameter ; sh:path sh:shapes ; sh:class rdf:List ; sh:description "The list of shapes to walk through." ; sh:order 1.0 ; ] ; sh:parameter [ a sh:Parameter ; sh:path sh:shapesGraph ; sh:class rdfs:Resource ; sh:description "The shapes graph." ; sh:order 2.0 ; ] ; sh:prefixes <http://topbraid.org/tosh> ; sh:returnType xsd:integer ; sh:select """ # The SUM will fail with an error if one of the operands is not a number # (this mechanism is used to propagate errors from tosh:hasShape calls) SELECT (SUM(?s) AS ?result) WHERE { GRAPH $shapesGraph { $shapes rdf:rest*/rdf:first ?shape . } BIND (tosh:hasShape($focusNode, ?shape, true) AS ?hasShape) . BIND (IF(bound(?hasShape), IF(?hasShape = $expectedValue, 1, 0), 'error') AS ?s) . } """ ; . tosh:editGroupDescription a rdf:Property ; rdfs:comment "A description of the property group when in \"edit\" mode." ; rdfs:domain sh:PropertyGroup ; rdfs:label "edit group description" ; rdfs:range xsd:string ; . tosh:graph a rdf:Property ; rdfs:comment "The graph that the shape is validated in." ; rdfs:label "graph" ; . tosh:hasDatatype a sh:SPARQLAskValidator ; rdfs:comment "Checks whether a given node ($value) is a literal with a given datatype ($datatype), and that the literal is well-formed." ; rdfs:label "has datatype" ; sh:ask """ ASK { FILTER (datatype($value) = $datatype && spif:isValidForDatatype($value, $datatype)) . } """ ; sh:prefixes <http://topbraid.org/tosh> ; . tosh:hasShape a sh:Function ; dash:apiStatus dash:Experimental ; rdfs:comment """A built-in function of the TopBraid SHACL implementation. Can be used to validate a given (focus) node against a given shape, returning <code>true</code> if the node is valid. If executed within a SHACL validation engine, this uses the shapes graph that was provided when the engine started. If executed in other contexts, e.g. in a stand-alone SPARQL query, the function attempts to use the URI of the current default graph as the shapes graph. This may not always be supported. If called from within an SWP engine, the shapes graph is the current query graph."""^^rdf:HTML ; rdfs:label "has shape" ; sh:parameter [ a sh:Parameter ; sh:path tosh:node ; sh:description "The node to validate." ; ] ; sh:parameter [ a sh:Parameter ; sh:path tosh:shape ; sh:description "The shape that the node is supposed to have." ; ] ; sh:returnType xsd:boolean
51
Merge branch 'compact'
4
.ttl
ttl
apache-2.0
TopQuadrant/shacl
359
<NME> tosh.ttl <BEF> # baseURI: http://topbraid.org/tosh # imports: http://datashapes.org/dash # prefix: tosh @prefix dash: <http://datashapes.org/dash#> . @prefix graphql: <http://datashapes.org/graphql#> . @prefix owl: <http://www.w3.org/2002/07/owl#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix sh: <http://www.w3.org/ns/shacl#> . @prefix swa: <http://topbraid.org/swa#> . @prefix tosh: <http://topbraid.org/tosh#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . dash: tosh:systemNamespace true ; . dash:Action sh:property tosh:Action-actionGroup ; sh:property tosh:Action-actionIconClass ; sh:property tosh:Action-deactivated ; . dash:ActionGroup sh:property tosh:ActionGroup-order ; sh:property tosh:Resource-comment ; . dash:NonRecursiveConstraintComponent dash:propertySuggestionGenerator tosh:DeleteTripleSuggestionGenerator ; sh:property [ sh:path dash:nonRecursive ; sh:group tosh:RelationshipPropertyGroup ; ] ; . dash:PrimaryKeyConstraintComponent-uriStart tosh:editWidget swa:PlainTextFieldEditor ; . dash:RootClassConstraintComponent dash:propertySuggestionGenerator tosh:DeleteTripleSuggestionGenerator ; sh:group tosh:ValidationPropertyGroup ; . dash:CoExistsWithConstraintComponent-coExistsWith sh:group tosh:PropertyPairConstraintsPropertyGroup ; sh:order "0"^^xsd:decimal ; . dash:DetailsEditor dash:hidden true ; owl:versionInfo "This is not yet supported by TopBraid." ; . dash:FunctionTestCase sh:property tosh:FunctionTestCase-expectedResult ; sh:property tosh:FunctionTestCase-expression ; . dash:GraphStoreTestCase }""" ; ] ; . <http://spinrdf.org/sp#> tosh:systemNamespace true ; . . dash:JSTestCase sh:property tosh:JSTestCase-expectedResult ; . dash:MultiFunction sh:property tosh:Function-apiStatus ; sh:property tosh:MultiFunction-resultVariable ; . dash:NonRecursiveConstraintComponent dash:propertySuggestionGenerator tosh:DeleteTripleSuggestionGenerator ; . dash:NonRecursiveConstraintComponent-nonRecursive sh:group tosh:ValueConstraintsPropertyGroup ; sh:order "5"^^xsd:decimal ; . dash:PrimaryKeyConstraintComponent-uriStart sh:group tosh:StringConstraintsPropertyGroup ; sh:order "40"^^xsd:decimal ; . dash:PropertyRole sh:property tosh:Resource-comment ; sh:property tosh:Resource-label ; . dash:QueryTestCase sh:property tosh:QueryTestCase-expectedResult ; . dash:ReifiableByConstraintComponent-reifiableBy sh:group tosh:ReificationPropertyGroup ; sh:order "0"^^xsd:decimal ; . dash:ResourceAction sh:property tosh:ResourceAction-jsCondition ; . dash:RootClassConstraintComponent dash:propertySuggestionGenerator tosh:DeleteTripleSuggestionGenerator ; . dash:RootClassConstraintComponent-rootClass sh:group tosh:ValueConstraintsPropertyGroup ; sh:order "10"^^xsd:decimal ; . dash:SPARQLConstructTemplate a sh:NodeShape ; sh:property tosh:Parameterizable-labelTemplate ; . dash:SPARQLSelectTemplate a sh:NodeShape ; sh:property tosh:Parameterizable-labelTemplate ; . dash:Script sh:property tosh:Resource-comment ; sh:property tosh:Resource-label ; sh:property tosh:Script-js ; . dash:ScriptConstraint sh:property tosh:Script-onAllValues ; sh:property tosh:ScriptConstraint-deactivated ; sh:property tosh:ScriptConstraint-message ; . dash:ScriptConstraintComponent-scriptConstraint sh:group tosh:AdvancedPropertyGroup ; sh:order "20"^^xsd:decimal ; . dash:ScriptFunction sh:property tosh:ScriptFunction-canWrite ; . dash:ScriptTestCase sh:property tosh:ScriptTestCase-expectedResult ; sh:property tosh:ScriptTestCase-focusNode ; . dash:ScriptValidator sh:property tosh:Script-onAllValues ; . dash:Service sh:property tosh:Service-canWrite ; sh:property tosh:Service-deactivated ; sh:property tosh:Service-responseContentType ; . dash:StemConstraintComponent-stem sh:group tosh:StringConstraintsPropertyGroup ; sh:order "45"^^xsd:decimal ; . dash:SubSetOfConstraintComponent-subSetOf sh:group tosh:PropertyPairConstraintsPropertyGroup ; sh:order "20"^^xsd:decimal ; . dash:SymmetricConstraintComponent dash:propertySuggestionGenerator tosh:DeleteTripleSuggestionGenerator ; dash:propertySuggestionGenerator [ a dash:SPARQLUpdateSuggestionGenerator ; sh:message "Add symmetric value." ; sh:order "0"^^xsd:decimal ; sh:prefixes <http://topbraid.org/tosh> ; sh:update """INSERT { $value $predicate $focusNode . } WHERE { }""" ; ] ; . dash:SymmetricConstraintComponent-symmetric sh:group tosh:ValueConstraintsPropertyGroup ; sh:order "10"^^xsd:decimal ; . dash:TestCase sh:property tosh:TestCase-deactivated ; . dash:TestCaseResult sh:property [ a sh:PropertyShape ; sh:path dash:testCase ; sh:class dash:TestCase ; sh:description "The dash:TestCase that was executed." ; sh:maxCount 1 ; sh:minCount 1 ; sh:name "test case" ; ] ; sh:property [ a sh:PropertyShape ; sh:path dash:testGraph ; sh:class rdfs:Resource ; sh:description "The graph containing the test case." ; sh:maxCount 1 ; sh:minCount 1 ; sh:name "test graph" ; sh:nodeKind sh:IRI ; ] ; . dash:UniqueValueForClassConstraintComponent-uniqueValueForClass sh:group tosh:ValueConstraintsPropertyGroup ; sh:order "20"^^xsd:decimal ; . dash:ValidationTestCase sh:property tosh:ValidationTestCase-expectedResult ; sh:property tosh:ValidationTestCase-includeSuggestions ; sh:property tosh:ValidationTestCase-validateShapes ; . dash:Widget sh:property tosh:Resource-comment ; sh:property tosh:Resource-label ; tosh:PropertyShapeShape a sh:NodeShape ; rdfs:label "Property shape shape" ; sh:property [ a sh:PropertyShape ; sh:path sh:values ; a owl:Ontology ; dash:generateClass dash:ConstraintReificationShape ; dash:generateClass rdf:Property ; dash:generateClass rdfs:Class ; dash:generateClass rdfs:Datatype ; dash:generateClass owl:Class ; dash:generateClass owl:Ontology ; dash:generateClass sh:ConstraintComponent ; dash:generateClass sh:PropertyGroup ; dash:generateClass sh:Rule ; dash:generateClass sh:Shape ; dash:generatePrefixConstants "dash" ; dash:generatePrefixConstants "owl" ; dash:generatePrefixConstants "rdf" ; dash:generatePrefixConstants "rdfs" ; dash:generatePrefixConstants "sh" ; dash:generatePrefixConstants "xsd" ; rdfs:comment """A collection of SHACL features that are available whenever SHACL graphs are used within TopBraid Suite products. In particular this includes shape definitions for the \"system\" classes such as rdfs:Class, sh:PropertyShape etc. These shapes are used by TopBraid products to validate ontology definitions and to drive user interface forms. The TOSH namespace also includes things like suggestions, Active Data Shapes scripts and a couple of SPARQL functions. Some of these may be of general use outside of TopBraid too.""" ; rdfs:label "TopBraid Data Shapes Library" ; owl:imports <http://datashapes.org/dash> ; sh:declare [ a sh:PrefixDeclaration ; sh:namespace "http://jena.hpl.hp.com/ARQ/function#"^^xsd:anyURI ; sh:prefix "afn" ; ] ; sh:declare [ a sh:PrefixDeclaration ; sh:namespace "http://spinrdf.org/spif#"^^xsd:anyURI ; sh:prefix "spif" ; ] ; sh:declare [ a sh:PrefixDeclaration ; sh:namespace "http://topbraid.org/sparqlmotionfunctions#"^^xsd:anyURI ; sh:prefix "smf" ; ] ; sh:declare [ a sh:PrefixDeclaration ; sh:namespace "http://topbraid.org/tosh#"^^xsd:anyURI ; sh:prefix "tosh" ; ] ; . tosh: tosh:systemNamespace true ; . tosh:Action-actionGroup a sh:PropertyShape ; sh:path dash:actionGroup ; sh:class dash:ActionGroup ; sh:description "The Action Group that the action should appear in (in menus etc)." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:order "5"^^xsd:decimal ; . tosh:Action-actionIconClass a sh:PropertyShape ; sh:path dash:actionIconClass ; sh:datatype xsd:string ; sh:description "The CSS class for the action for display purposes. For example, pick one of https://fontawesome.com/icons?d=gallery&m=free or https://getbootstrap.com/docs/3.3/components/#glyphicons-glyphs" ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:order "7"^^xsd:decimal ; . tosh:Action-deactivated a sh:PropertyShape ; sh:path sh:deactivated ; sh:datatype xsd:boolean ; sh:description "True to deactivate this action (from user interfaces)." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "deactivated" ; sh:order "8"^^xsd:decimal ; . tosh:ActionGroup-order a sh:PropertyShape ; sh:path sh:order ; sh:description "The relative order of this group compared to other groups, e.g. to display in drop down menus." ; sh:group tosh:DisplayPropertyGroup ; sh:maxCount 1 ; sh:name "order" ; sh:or ( [ sh:datatype xsd:decimal ; ] [ sh:datatype xsd:integer ; ] ) ; . tosh:ActionTestCase-action a sh:PropertyShape ; sh:path dash:action ; sh:class dash:Action ; sh:description "The dash:Action to execute." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:minCount 1 ; sh:name "action" ; sh:nodeKind sh:IRI ; sh:order "0"^^xsd:decimal ; . tosh:ActionTestCase-expectedResult a sh:PropertyShape ; sh:path dash:expectedResult ; sh:description "The expected result of the evaluation, as JSON object as produced by the servlet, or true or false." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:name "expected result" ; sh:order "10"^^xsd:decimal ; . tosh:ActionTestCase-focusNode a sh:PropertyShape ; sh:path dash:focusNode ; sh:name "on property" ; sh:order 0 ; ] ; sh:targetClass sh:PropertyShape ; . tosh:RelationshipPropertyGroup sh:order "2"^^xsd:decimal ; . rdfs:label "Relationship" ; sh:order 8 ; . tosh:ReplaceWithDefaultValueSuggestionGenerator a dash:SPARQLUpdateSuggestionGenerator ; rdfs:comment "Produces a suggestion to replace all values of the given predicate (which must exist) at the focus node to the default value declared at the shape that has caused the violation. Does nothing if the shape does not declare a sh:defaultValue. Deletes any old value of the property." ; sh:maxCount 1 ; sh:name "deactivated" ; sh:order "10"^^xsd:decimal ; . tosh:ChangeScript-order a sh:PropertyShape ; sh:path sh:order ; sh:description "The relative order of this script compared to other change scripts. The default value is 0. Scripts with lower numbers are executed first." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "order" ; sh:or ( [ sh:datatype xsd:decimal ; ] [ sh:datatype xsd:integer ; ] ) ; sh:order "40"^^xsd:decimal ; . tosh:Class-ShapeScript a dash:ShapeScript ; dash:js """ /** * Returns this class as an instance of sh:NodeShape. * @returns {sh_NodeShape} */ asNodeShape() { return sh.asNodeShape(this); } /** * @callback rdfs_Class_callback * @param {rdfs_Class} class the visited class */ /** * Performs a depth-first traversal this class and its superclasses, visiting each (super) class * once until the callback function returns a non-null/undefined result. This becomes the result of this function. * The order in which sibling classes are traversed is undefined, so results may be inconsistent in * multiple-inheritance scenarios. * @param {rdfs_Class_callback} callback the callback for each class * @param {Set} [reached] the Set of reached URI strings, used internally * @returns the return value of the first callback that returned any value */ walkSuperclasses(callback, reached) { if(!reached) { reached = new Set(); } if(!reached.has(this.uri)) { reached.add(this.uri); let result = callback(this); if(result !== undefined && result !== null) { return result; } let supers = this.superclasses; for(let i = 0; i < supers.length; i++) { result = supers[i].walkSuperclasses(callback, reached); if(result !== undefined && result !== null) { return result; } } } } """ ; . tosh:Class-abstract a sh:PropertyShape ; sh:path dash:abstract ; sh:datatype xsd:boolean ; sh:description "States whether this class is abstract, i.e. cannot have direct instances. Abstract classes are typically used to defined shared properties of its subclasses." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "abstract" ; sh:order "30"^^xsd:decimal ; . tosh:Class-classIcon a sh:PropertyShape ; sh:path tosh:classIcon ; dash:hidden true ; dash:propertyRole dash:IconRole ; sh:datatype xsd:string ; sh:defaultValue "http://datashapes.org/icons/class.svg" ; sh:description "Used to return the default icon for all classes." ; sh:group tosh:DisplayPropertyGroup ; sh:maxCount 1 ; sh:name "class icon" ; sh:order "1"^^xsd:decimal ; . tosh:Class-constructor a sh:PropertyShape ; sh:path dash:constructor ; graphql:name "constructorScript" ; sh:class dash:Constructor ; sh:description "The Constructor that shall be used to create new instances of this class or its subclasses." ; sh:group tosh:ScriptsPropertyGroup ; sh:maxCount 1 ; sh:name "constructor" ; sh:order "20"^^xsd:decimal ; . tosh:Class-disjointWith a sh:PropertyShape ; sh:path owl:disjointWith ; sh:class owl:Class ; sh:group tosh:OWLAxiomsPropertyGroup ; sh:name "disjoint with" ; sh:order "1"^^xsd:decimal ; . tosh:Class-domain-inverse a sh:PropertyShape ; sh:path [ sh:inversePath rdfs:domain ; ] ; dash:editor dash:PropertyAutoCompleteEditor ; sh:class rdf:Property ; sh:description "The properties that declare to have this class in their domain." ; sh:group tosh:RDFSPropertyAxiomsPropertyGroup ; sh:name "domain of" ; sh:nodeKind sh:IRI ; sh:order "0"^^xsd:decimal ; . tosh:Class-equivalentClass a sh:PropertyShape ; sh:path owl:equivalentClass ; sh:class owl:Class ; sh:group tosh:OWLAxiomsPropertyGroup ; sh:name "equivalent classes" ; sh:order "0"^^xsd:decimal ; . tosh:Class-hidden a sh:PropertyShape ; sh:path dash:hidden ; sh:datatype xsd:boolean ; sh:description "True if this class shall be hidden from the class hierarchies." ; sh:group tosh:DisplayPropertyGroup ; sh:maxCount 1 ; sh:name "hidden" ; sh:order "0"^^xsd:decimal ; . tosh:Class-range-inverse a sh:PropertyShape ; sh:path [ sh:inversePath rdfs:range ; ] ; dash:editor dash:PropertyAutoCompleteEditor ; sh:class rdf:Property ; sh:description "The properties that have this class in their rdfs:range." ; sh:group tosh:RDFSPropertyAxiomsPropertyGroup ; sh:name "range of" ; sh:nodeKind sh:IRI ; sh:order "1"^^xsd:decimal ; . tosh:Class-resourceAction a sh:PropertyShape ; sh:path dash:resourceAction ; graphql:name "resourceActions" ; sh:class dash:ResourceAction ; sh:description "The Resource Actions that can be applied to instances of this class." ; sh:group tosh:ScriptsPropertyGroup ; sh:name "resource actions" ; sh:order "0"^^xsd:decimal ; . tosh:Class-resourceService a sh:PropertyShape ; sh:path dash:resourceService ; graphql:name "resourceServices" ; sh:class dash:ResourceService ; sh:description "The Services that can be applied to instances of this class (as focusNode)." ; sh:group tosh:ScriptsPropertyGroup ; sh:name "resource services" ; sh:order "10"^^xsd:decimal ; . tosh:Class-subClassOf a sh:PropertyShape ; sh:path rdfs:subClassOf ; graphql:name "superclasses" ; sh:class rdfs:Class ; sh:description "The (direct) parent classes of this class." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "superclasses" ; sh:order "20"^^xsd:decimal ; . tosh:Class-subClassOf-inverse a sh:PropertyShape ; sh:path [ sh:inversePath rdfs:subClassOf ; ] ; dash:hidden true ; graphql:name "subclasses" ; sh:class rdfs:Class ; sh:description "The (direct) subclasses of this class." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "subclasses" ; sh:order "21"^^xsd:decimal ; . tosh:ConstraintComponent-localConstraint a sh:PropertyShape ; sh:path dash:localConstraint ; sh:datatype xsd:boolean ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "local constraint" ; sh:order "10"^^xsd:decimal ; . tosh:ConstraintComponent-message a sh:PropertyShape ; sh:path sh:message ; sh:description "The message to generate on violations." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "messages" ; sh:or dash:StringOrLangString ; sh:order "26"^^xsd:decimal ; . tosh:ConstraintComponent-nodeValidator a sh:PropertyShape ; sh:path sh:nodeValidator ; sh:class sh:Validator ; sh:description "The validator(s) used to evaluate a constraint in the context of a node shape." ; sh:group tosh:ImplementationPropertyGroup ; sh:name "node validators" ; sh:order "2"^^xsd:decimal ; . tosh:ConstraintComponent-propertySuggestionGenerator a sh:PropertyShape ; sh:path dash:propertySuggestionGenerator ; sh:class dash:SuggestionGenerator ; sh:group tosh:ImplementationPropertyGroup ; sh:name "property suggestion generators" ; sh:order "20"^^xsd:decimal ; . tosh:ConstraintComponent-propertyValidator a sh:PropertyShape ; sh:path sh:propertyValidator ; sh:class sh:Validator ; sh:description "The validator(s) used to evaluate a constraint in the context of a property shape." ; sh:group tosh:ImplementationPropertyGroup ; sh:name "property validators" ; sh:order "1"^^xsd:decimal ; . tosh:ConstraintComponent-staticConstraint a sh:PropertyShape ; sh:path dash:staticConstraint ; sh:datatype xsd:boolean ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "static constraint" ; sh:order "11"^^xsd:decimal ; . tosh:ConstraintComponent-validator a sh:PropertyShape ; sh:path sh:validator ; sh:class sh:Validator ; sh:description "The validator(s) used to evaluate constraints of either node or property shapes, unless more specific validators are available." ; sh:group tosh:ImplementationPropertyGroup ; sh:name "validators" ; sh:order "0"^^xsd:decimal ; . tosh:DatatypePropertyShapeView a sh:NodeShape ; rdfs:comment "The default view shape for property shapes on datatype values." ; rdfs:label "Attribute view" ; sh:node tosh:PropertyShapeView ; sh:property dash:PrimaryKeyConstraintComponent-uriStart ; sh:property dash:SingleLineConstraintComponent-singleLine ; sh:property tosh:Shape-datatypes ; sh:property sh:LanguageInConstraintComponent-languageIn ; sh:property sh:LessThanConstraintComponent-lessThan ; sh:property sh:LessThanOrEqualsConstraintComponent-lessThanOrEquals ; sh:property sh:MaxExclusiveConstraintComponent-maxExclusive ; sh:property sh:MaxInclusiveConstraintComponent-maxInclusive ; sh:property sh:MaxLengthConstraintComponent-maxLength ; sh:property sh:MinExclusiveConstraintComponent-minExclusive ; sh:property sh:MinInclusiveConstraintComponent-minInclusive ; sh:property sh:MinLengthConstraintComponent-minLength ; sh:property sh:PatternConstraintComponent-flags ; sh:property sh:PatternConstraintComponent-pattern ; sh:property sh:UniqueLangConstraintComponent-uniqueLang ; . tosh:DatatypesViewer a dash:MultiViewer ; dash:hidden true ; rdfs:label "Datatypes viewer" ; . tosh:DefinitionPropertyGroup a sh:PropertyGroup ; rdfs:label "Definition" ; sh:order "0"^^xsd:decimal ; . tosh:DeleteTripleSuggestionGenerator a dash:SPARQLUpdateSuggestionGenerator ; rdfs:comment "Produces a suggestion that would delete the offending value in the validation result from the focus node." ; rdfs:label "Delete triple suggestion generator" ; sh:message "Delete the invalid statement" ; sh:order 100.0 ; sh:update """DELETE { $focusNode $predicate $value . } WHERE { $focusNode $predicate $value . }""" ; . tosh:DependentEnumSelectEditor a dash:SingleEditor ; rdfs:comment """A drop-down editor for enumerated values that are dynamically determined via a node shape that has sh:target dash:HasValueTarget. Example: states:USAddressShape rdf:type sh:NodeShape ; rdfs:label \"US Address shape\" ; sh:property [ rdf:type sh:PropertyShape ; ] ; sh:returnType xsd:boolean ; . tosh:open a rdf:Property ; a owl:DeprecatedProperty ; sh:in ( dash:Experimental dash:Stable dash:Deprecated ) ; sh:maxCount 1 ; sh:name "API status" ; sh:order "15"^^xsd:decimal ; . tosh:Function-cachable a sh:PropertyShape ; sh:path dash:cachable ; sh:datatype xsd:boolean ; sh:description "True to indicate that this function will always return the same values for the same combination of arguments, regardless of the query graphs. Engines can use this information to cache and reuse previous function calls." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "cachable" ; sh:order "10"^^xsd:decimal ; . tosh:Function-returnType a sh:PropertyShape ; sh:path sh:returnType ; sh:class rdfs:Class ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "return type" ; sh:order "5"^^xsd:decimal ; . tosh:FunctionTestCase-expectedResult a sh:PropertyShape ; sh:path dash:expectedResult ; sh:description "The expected result of a function call." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:name "expected result" ; sh:order "10"^^xsd:decimal ; . tosh:FunctionTestCase-expression a sh:PropertyShape ; sh:path dash:expression ; sh:description "A valid SPARQL expression calling the function to test." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:minCount 1 ; sh:name "expression" ; sh:order "0"^^xsd:decimal ; . tosh:GovernanceRoleSelectEditor a dash:SingleEditor ; rdfs:label "Governance role editor" ; . tosh:GovernanceRoleViewer a dash:SingleViewer ; rdfs:label "Governance role viewer" ; . tosh:GraphStoreTestCase-expectedResult a sh:PropertyShape ; sh:path dash:expectedResult ; sh:datatype xsd:string ; sh:description "The expected RDF graph, as a Turtle string." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:minCount 1 ; sh:order "10"^^xsd:decimal ; . tosh:GraphStoreTestCase-uri a sh:PropertyShape ; sh:path dash:uri ; sh:datatype xsd:anyURI ; sh:description "The URI of the graph to load." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:minCount 1 ; sh:name "uri" ; sh:order "0"^^xsd:decimal ; . tosh:ImplementationPropertyGroup a sh:PropertyGroup ; rdfs:label "Implementation" ; sh:order "10"^^xsd:decimal ; . tosh:IncludedScript-exports a sh:PropertyShape ; sh:path dash:exports ; sh:datatype xsd:string ; sh:description "Declares the symbols that shall be exported from the surrounding module, e.g. for use in Node.js applications." ; sh:group tosh:ImplementationPropertyGroup ; sh:name "exports" ; sh:order "30"^^xsd:decimal ; . tosh:InferenceRulesShape a sh:NodeShape ; rdfs:comment "A node shape for classes and node shapes, declaring the sh:rule property." ; rdfs:label "Inference rules" ; sh:property tosh:InferenceRulesShape-rule ; sh:targetClass sh:NodeShape ; . tosh:InferenceRulesShape-rule a sh:PropertyShape ; sh:path sh:rule ; sh:class sh:Rule ; sh:description "The inference rules associated with this node shape or class." ; sh:group tosh:InferencesPropertyGroup ; sh:name "rule" ; . tosh:InferencesPropertyGroup a sh:PropertyGroup ; rdfs:label "Inferences" ; sh:order "80"^^xsd:decimal ; . tosh:InferencingTestCase-expectedResult a sh:PropertyShape ; sh:path dash:expectedResult ; sh:description "The expected inferred triples, represented by instances of rdfs:Statement." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:name "expected result" ; sh:order "10"^^xsd:decimal ; . tosh:InstancesInGraphSelectEditor a dash:SingleEditor ; rdfs:comment "A drop-down editor for all instances of a class (based on tosh:shapeInGraph/sh:class of the property) in a graph specified using tosh:graph." ; rdfs:label "Instances in graph select editor" ; . tosh:JSTestCase-expectedResult a sh:PropertyShape ; sh:path dash:expectedResult ; sh:description "The expected result of the JavaScript function call, as an RDF node." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:name "expected result" ; . tosh:MemberShapeConstraintComponent a sh:ConstraintComponent ; rdfs:comment "Can be used to specify constraints on the members of a given list, assuming that the given sh:property has rdf:Lists as values. A violation is reported for each member of the list that does not comply with the constraints specified by the given shape." ; rdfs:label "Member shape constraint component" ; sh:parameter tosh:MemberShapeConstraintComponent-memberShape ; sh:propertyValidator [ a sh:SPARQLSelectValidator ; sh:message "List member does not have the shape {$memberShape}" ; sh:prefixes <http://topbraid.org/tosh> ; sh:select """ SELECT DISTINCT $this ?value ?failure ?member WHERE { $this $PATH ?value . ?value rdf:rest*/rdf:first ?member . BIND (tosh:hasShape(?member, $memberShape) AS ?hasShape) . BIND (!bound(?hasShape) AS ?failure) . FILTER (?failure || !?hasShape) . } """ ; ] ; sh:targetClass sh:PropertyShape ; . tosh:MemberShapeConstraintComponent-memberShape a sh:Parameter ; sh:path tosh:memberShape ; sh:class sh:Shape ; sh:description "The shape that the list members must have." ; sh:name "member shape" ; . tosh:ModifyAction-skipPreview a sh:PropertyShape ; sh:path dash:skipPreview ; sh:datatype xsd:boolean ; sh:description "For actions that take no parameters, this can be set to true to skip any means for the user to preview the action. It will instead directly execute the modification." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "skip preview" ; sh:order "11"^^xsd:decimal ; . tosh:MultiFunction-resultVariable a sh:PropertyShape ; sh:path dash:resultVariable ; sh:class sh:Parameter ; sh:description "The result variables." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "result variables" ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order "30"^^xsd:decimal ; . tosh:NodeShape-ShapeScript a dash:ShapeScript ; dash:js """ /** * Returns this class as an instance of rdfs_Class, assuming this node shape is also a class. * @returns {rdfs_Class} */ asClass() { return rdfs.asClass(this); } /** * Gets the \"nearest\" constraint of a given type and a given path property. Deactivated shapes are skipped. * For example, call it with (ex.myProperty, sh.datatype) to find the closest sh:datatype constraint for ex:myProperty. * @param {NamedNode} path the property that is the sh:path of matching property shapes * @param {NamedNode} predicate the property to fetch the nearest value of */ nearestPropertyShapeValue(path, predicate) { return this.walkSupershapes(s => { if(!s.deactivated) { let ps = s.properties; for(let i = 0; i < ps.length; i++) { if(!ps[i].deactivated && graph.contains(ps[i], sh.path, path)) { let value = ps[i].value(predicate); if(value !== null && value !== undefined) { return value; } } } } }) } /** * @callback sh_NodeShape_callback * @param {sh_NodeShape} nodeShape the visited node shape */ /** * Performs a depth-first traversal of this and its superclasses (via rdfs:subClassOf) and supershapes (via sh:node), * visiting each (super) shape once until the callback function returns a non-null/undefined result. This becomes the result of this function. * The order in which sibling parents are traversed is undefined. * @param {sh_NodeShape_callback} callback the callback for each shape * @param {Set} [reached] the Set of reached URI strings, used internally but may also be used to terminate at certain supers * @returns the return value of the first callback that returned any value */ walkSupershapes(callback, reached) { if(!reached) { reached = new Set(); } if(!reached.has(this.uri)) { reached.add(this.uri); let result = callback(this); if(result !== undefined && result !== null) { return result; } let superClasses = this.asClass().superclasses; for(let i = 0; i < superClasses.length; i++) { result = superClasses[i].asNodeShape().walkSupershapes(callback, reached); if(result !== undefined && result !== null) { return result; } } let superShapes = this.supershapes; for(let i = 0; i < superShapes.length; i++) { result = superShapes[i].walkSupershapes(callback, reached); if(result !== undefined && result !== null) { return result; } } } } """ ; . tosh:NodeShape-applicableToClass a sh:PropertyShape ; sh:path dash:applicableToClass ; sh:class rdfs:Class ; sh:description "Links a node shape with the classes that it can be applied to." ; sh:group tosh:TargetsPropertyGroup ; sh:name "applicable to classes" ; sh:nodeKind sh:IRI ; sh:order "10"^^xsd:decimal ; . tosh:NodeShape-defaultViewForRole a sh:PropertyShape ; sh:path dash:defaultViewForRole ; dash:editor tosh:GovernanceRoleSelectEditor ; dash:viewer tosh:GovernanceRoleViewer ; sh:description "The user roles that this shape shall be used as default view for." ; sh:group tosh:TargetsPropertyGroup ; sh:name "default view for roles" ; sh:nodeKind sh:IRI ; sh:order "20"^^xsd:decimal ; . tosh:NodeShape-inheritedProperty a sh:PropertyShape ; sh:path tosh:inheritedProperty ; dash:neverMaterialize true ; dash:viewer tosh:PropertyTableViewer ; sh:description "Returns all property shapes that have been declared at \"super-shapes\" (via sh:node) or \"superclasses\" (via rdfs:subClassOf), including the indirect supers, recursively." ; sh:group tosh:PropertiesPropertyGroup ; sh:name "inherited properties" ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order "1"^^xsd:decimal ; sh:values [ sh:path sh:property ; sh:nodes [ sh:minus sh:this ; sh:nodes [ sh:distinct [ sh:path [ sh:oneOrMorePath [ sh:alternativePath ( rdfs:subClassOf sh:node ) ; ] ; ] ; ] ; ] ; ] ; ] ; . tosh:NodeShape-node a sh:PropertyShape ; sh:path sh:node ; graphql:name "supershapes" ; sh:description "The node shapes that this must also conform to, forming a kind of inheritance between shapes similar to a subclass-of relationship." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "node (super shapes)" ; sh:node sh:NodeShape ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order "20"^^xsd:decimal ; . tosh:NodeShape-targetClass a sh:PropertyShape ; sh:path sh:targetClass ; graphql:name "targetClasses" ; sh:class rdfs:Class ; sh:description "The types of instances that this shape is targeted at." ; sh:group tosh:TargetsPropertyGroup ; sh:name "target classes" ; sh:nodeKind sh:IRI ; sh:order "0"^^xsd:decimal ; . tosh:NodeShape-targetObjectsOf a sh:PropertyShape ; sh:path sh:targetObjectsOf ; sh:group tosh:TargetsPropertyGroup ; sh:name "target objects of" ; sh:node rdf:Property ; sh:nodeKind sh:IRI ; sh:order "1"^^xsd:decimal ; . tosh:NodeShape-targetSubjectsOf a sh:PropertyShape ; sh:path sh:targetSubjectsOf ; sh:group tosh:TargetsPropertyGroup ; sh:name "target subjects of" ; sh:node rdf:Property ; sh:nodeKind sh:IRI ; sh:order "2"^^xsd:decimal ; . tosh:NodeShapeConstraintsShape a sh:NodeShape ; rdfs:comment "A shape that can be used to validate the syntax of node shapes, and to enter constraints for node shapes on forms." ; rdfs:label "Node shape constraints" ; sh:property dash:ClosedByTypesConstraintComponent-closedByTypes ; sh:property dash:ScriptConstraintComponent-scriptConstraint ; sh:property dash:SingleLineConstraintComponent-singleLine ; sh:property dash:StemConstraintComponent-stem ; sh:property tosh:Shape-datatypes ; sh:property sh:ClassConstraintComponent-class ; sh:property sh:ClosedConstraintComponent-closed ; sh:property sh:ClosedConstraintComponent-ignoredProperties ; sh:property sh:DatatypeConstraintComponent-datatype ; sh:property sh:HasValueConstraintComponent-hasValue ; sh:property sh:InConstraintComponent-in ; sh:property sh:LanguageInConstraintComponent-languageIn ; sh:property sh:MaxExclusiveConstraintComponent-maxExclusive ; sh:property sh:MaxInclusiveConstraintComponent-maxInclusive ; sh:property sh:MaxLengthConstraintComponent-maxLength ; sh:property sh:MinExclusiveConstraintComponent-minExclusive ; sh:property sh:MinInclusiveConstraintComponent-minInclusive ; sh:property sh:MinLengthConstraintComponent-minLength ; sh:property sh:NodeKindConstraintComponent-nodeKind ; sh:property sh:PatternConstraintComponent-flags ; sh:property sh:PatternConstraintComponent-pattern ; sh:property sh:SPARQLConstraintComponent-sparql ; sh:targetClass sh:NodeShape ; . tosh:NumberOfValuesPropertyGroup a sh:PropertyGroup ; rdfs:label "Number of Values" ; sh:order "40"^^xsd:decimal ; . tosh:OWLAxiomsPropertyGroup a sh:PropertyGroup ; rdfs:label "OWL Axioms" ; sh:order "17"^^xsd:decimal ; . tosh:ObjectPropertyShapeView a sh:NodeShape ; rdfs:comment "The default view shape for property shapes on object values." ; rdfs:label "Relationship view" ; sh:node tosh:PropertyShapeView ; sh:property dash:NonRecursiveConstraintComponent-nonRecursive ; sh:property dash:RootClassConstraintComponent-rootClass ; sh:property dash:StemConstraintComponent-stem ; sh:property dash:SymmetricConstraintComponent-symmetric ; sh:property tosh:ObjectPropertyShapeView-node ; sh:property sh:ClassConstraintComponent-class ; sh:property sh:NodeKindConstraintComponent-nodeKind ; . tosh:ObjectPropertyShapeView-node a sh:PropertyShape ; sh:path sh:node ; dash:reifiableBy dash:ConstraintReificationShape ; sh:class sh:NodeShape ; sh:description "The node shape(s) that all values of the property must conform to." ; sh:group tosh:ValueConstraintsPropertyGroup ; sh:name "node" ; sh:order "0"^^xsd:decimal ; . tosh:Ontology-imports a sh:PropertyShape ; sh:path owl:imports ; sh:description "The (directly) imported graphs." ; sh:name "imports" ; sh:nodeKind sh:IRI ; . tosh:Parameterizable-labelTemplate a sh:PropertyShape ; sh:path sh:labelTemplate ; sh:description "Outlines how human-readable labels of instances of the associated Parameterizable shall be produced. The values can contain {?paramName} as placeholders for the actual values of the given parameter." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "label template" ; sh:or dash:StringOrLangString ; sh:order "25"^^xsd:decimal ; . tosh:Parameterizable-parameter a sh:PropertyShape ; sh:path sh:parameter ; sh:class sh:Parameter ; sh:description "The input parameters." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "parameters" ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order "20"^^xsd:decimal ; . tosh:PathStringViewer a dash:MultiViewer ; dash:hidden true ; rdfs:label "Path string viewer" ; . tosh:PropertiesPropertyGroup a sh:PropertyGroup ; rdfs:comment "The declared and inferred properties of a shape or class." ; rdfs:label "Properties" ; sh:order "10"^^xsd:decimal ; . tosh:Property-domain a sh:PropertyShape ; sh:path rdfs:domain ; graphql:name "domains" ; sh:description "The domain(s) of this property." ; sh:group tosh:PropertyAxiomsPropertyGroup ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order "0"^^xsd:decimal ; . tosh:Property-range a sh:PropertyShape ; sh:path rdfs:range ; graphql:name "ranges" ; sh:description "The range(s) of this property." ; sh:group tosh:PropertyAxiomsPropertyGroup ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order "1"^^xsd:decimal ; . tosh:Property-subPropertyOf a sh:PropertyShape ; sh:path rdfs:subPropertyOf ; graphql:name "superproperties" ; sh:class rdf:Property ; sh:description "The (direct) superproperties of this." ; sh:group tosh:PropertyAxiomsPropertyGroup ; sh:name "superproperties" ; sh:nodeKind sh:IRI ; sh:order "2"^^xsd:decimal ; . tosh:Property-subPropertyOf-inverse a sh:PropertyShape ; sh:path [ sh:inversePath rdfs:subPropertyOf ; ] ; graphql:name "subproperties" ; sh:class rdf:Property ; sh:description "The (direct) subproperties of this." ; sh:group tosh:PropertyAxiomsPropertyGroup ; sh:name "subproperties" ; sh:nodeKind sh:IRI ; sh:order "3"^^xsd:decimal ; . tosh:PropertyAxiomsPropertyGroup a sh:PropertyGroup ; rdfs:label "Property Axioms" ; sh:order "1"^^xsd:decimal ; . tosh:PropertyGroup-order a sh:PropertyShape ; sh:path sh:order ; sh:description "The relative order of this group compared to others." ; sh:group tosh:DisplayPropertyGroup ; sh:maxCount 1 ; sh:name "order" ; sh:or ( [ sh:datatype xsd:decimal ; ] [ sh:datatype xsd:integer ; ] ) ; sh:order "0"^^xsd:decimal ; . tosh:PropertyPairConstraintsPropertyGroup a sh:PropertyGroup ; rdfs:label "Property Pair Constraints" ; sh:order "75"^^xsd:decimal ; . tosh:PropertyShape-defaultValue a sh:PropertyShape ; sh:path sh:defaultValue ; dash:readOnly true ; dash:viewer dash:NodeExpressionViewer ; tosh:useDeclaredDatatype true ; sh:description "The default value to be used for this property if no other value has been asserted. This may be a constant value or a SHACL node expression, in which case the values can be derived from other values. Default values are typically inferred and not stored as RDF statements." ; sh:group tosh:InferencesPropertyGroup ; sh:name "default value" ; sh:order "0"^^xsd:decimal ; . tosh:PropertyShape-description a sh:PropertyShape ; sh:path sh:description ; dash:singleLine false ; graphql:name "descriptions" ; sh:description "The description(s) of the property, possibly in multiple languages." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "descriptions" ; sh:nodeKind sh:Literal ; sh:or dash:StringOrLangStringOrHTML ; sh:order "1"^^xsd:decimal ; sh:sparql [ sh:message "Property shapes cannot have both class and datatype constraints." ; sh:prefixes <http://topbraid.org/tosh> ; sh:select """SELECT $this WHERE { FILTER EXISTS { $this sh:class ?class . $this sh:datatype ?datatype . } }""" ; ] ; . tosh:PropertyShape-detailsEndpoint a sh:PropertyShape ; sh:path dash:detailsEndpoint ; sh:datatype xsd:string ; sh:maxCount 1 ; sh:name "details endpoint" ; . tosh:PropertyShape-editor a sh:PropertyShape ; sh:path dash:editor ; dash:editor dash:InstancesSelectEditor ; sh:class dash:Editor ; sh:description "The editor component that should be used to edit values of this property." ; sh:group tosh:DisplayPropertyGroup ; sh:maxCount 1 ; sh:nodeKind sh:IRI ; sh:order "11"^^xsd:decimal ; . tosh:PropertyShape-group a sh:PropertyShape ; sh:path sh:group ; sh:class sh:PropertyGroup ; sh:description "The group that this property belongs to." ; sh:group tosh:DisplayPropertyGroup ; sh:maxCount 1 ; sh:name "group" ; sh:order "0"^^xsd:decimal ; . tosh:PropertyShape-hidden a sh:PropertyShape ; sh:path dash:hidden ; dash:editor dash:BooleanSelectEditor ; sh:datatype xsd:boolean ; sh:description "True to mark this property as hidden in user interface, yet still used in data tasks." ; sh:group tosh:DisplayPropertyGroup ; sh:maxCount 1 ; sh:order "30"^^xsd:decimal ; . tosh:PropertyShape-indexed a sh:PropertyShape ; sh:path dash:indexed ; sh:datatype xsd:boolean ; sh:description "True to indicate that the values of this shall be indexed, forming ordered arrays." ; sh:maxCount 1 ; sh:name "indexed" ; . tosh:PropertyShape-name a sh:PropertyShape ; sh:path sh:name ; dash:singleLine true ; graphql:name "names" ; sh:description "The display names of the property, possibly in multiple languages." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "names" ; sh:nodeKind sh:Literal ; sh:or dash:StringOrLangString ; sh:order "0"^^xsd:decimal ; . tosh:PropertyShape-neverMaterialize a sh:PropertyShape ; sh:path dash:neverMaterialize ; sh:datatype xsd:boolean ; sh:group tosh:InferencesPropertyGroup ; sh:maxCount 1 ; sh:name "never materialize" ; sh:order "11"^^xsd:decimal ; . tosh:PropertyShape-order a sh:PropertyShape ; sh:path sh:order ; sh:description "The relative order of this property shape compared to others." ; sh:group tosh:DisplayPropertyGroup ; sh:maxCount 1 ; sh:name "order" ; sh:or ( [ sh:datatype xsd:decimal ; ] [ sh:datatype xsd:integer ; ] ) ; sh:order "1"^^xsd:decimal ; . tosh:PropertyShape-path a sh:PropertyShape ; sh:path sh:path ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:minCount 1 ; sh:name "path" ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order "31"^^xsd:decimal ; . tosh:PropertyShape-propertyRole a sh:PropertyShape ; sh:path dash:propertyRole ; sh:class dash:PropertyRole ; sh:group tosh:DisplayPropertyGroup ; sh:maxCount 1 ; sh:name "role" ; sh:order "40"^^xsd:decimal ; . tosh:PropertyShape-readOnly a sh:PropertyShape ; sh:path dash:readOnly ; dash:editor dash:BooleanSelectEditor ; dash:viewer dash:NodeExpressionViewer ; sh:datatype xsd:boolean ; sh:description """If set to true then the values of this property should not be editable in the user interface. Note that low-level access such as source code editors may still allow editing, but form-based editors would not. More generally, the values of this property are SHACL node expressions, e.g. function calls, in which case the property counts as read-only if the expression evaluates to true.""" ; sh:group tosh:DisplayPropertyGroup ; sh:maxCount 1 ; sh:order "20"^^xsd:decimal ; . tosh:PropertyShape-values a sh:PropertyShape ; sh:path sh:values ; dash:viewer dash:NodeExpressionViewer ; sh:group tosh:InferencesPropertyGroup ; sh:name "values" ; sh:order "10"^^xsd:decimal ; sh:sparql [ sh:message "sh:values must be accompanied by a sh:path that is an IRI." ; sh:prefixes <http://topbraid.org/tosh> ; sh:select """SELECT $this ?value WHERE { $this $PATH ?value . FILTER NOT EXISTS { $this sh:path ?path . FILTER isIRI(?path) } }""" ; ] ; . tosh:PropertyShape-viewer a sh:PropertyShape ; sh:path dash:viewer ; dash:editor dash:InstancesSelectEditor ; sh:class dash:Viewer ; sh:description "The viewer component that should be used to render values of this property." ; sh:group tosh:DisplayPropertyGroup ; sh:maxCount 1 ; sh:nodeKind sh:IRI ; sh:order "10"^^xsd:decimal ; . tosh:PropertyShapeView a sh:NodeShape ; rdfs:comment "Base view shape for either datatype or object property shapes." ; rdfs:label "Property shape view" ; sh:property dash:CoExistsWithConstraintComponent-coExistsWith ; sh:property dash:IndexedConstraintComponent-indexed ; sh:property dash:ReifiableByConstraintComponent-reifiableBy ; sh:property dash:ScriptConstraintComponent-scriptConstraint ; sh:property dash:SubSetOfConstraintComponent-subSetOf ; sh:property tosh:PropertyShape-defaultValue ; sh:property tosh:PropertyShape-description ; sh:property tosh:PropertyShape-editor ; sh:property tosh:PropertyShape-group ; sh:property tosh:PropertyShape-hidden ; sh:property tosh:PropertyShape-name ; sh:property tosh:PropertyShape-neverMaterialize ; sh:property tosh:PropertyShape-order ; sh:property tosh:PropertyShape-propertyRole ; sh:property tosh:PropertyShape-readOnly ; sh:property tosh:PropertyShape-values ; sh:property tosh:PropertyShape-viewer ; sh:property tosh:PropertyShapeView-message ; sh:property tosh:PropertyShapeView-pathSystemLabel ; sh:property tosh:PropertyShapeView-qualifiedMaxCount ; sh:property tosh:PropertyShapeView-qualifiedMinCount ; sh:property tosh:PropertyShapeView-qualifiedValueShape ; sh:property tosh:PropertyShapeView-qualifiedValueShapesDisjoint ; sh:property tosh:Shape-deactivated ; sh:property tosh:Shape-severity ; sh:property sh:DisjointConstraintComponent-disjoint ; sh:property sh:EqualsConstraintComponent-equals ; sh:property sh:MaxCountConstraintComponent-maxCount ; sh:property sh:MinCountConstraintComponent-minCount ; sh:property sh:SPARQLConstraintComponent-sparql ; . tosh:PropertyShapeView-indexed a sh:PropertyShape ; sh:path dash:indexed ; sh:datatype xsd:boolean ; sh:description "Indicates whether the values are sorted by an index. The user interface will display them in-order." ; sh:group tosh:ReificationPropertyGroup ; sh:maxCount 1 ; sh:name "indexed" ; sh:order "1"^^xsd:decimal ; . tosh:PropertyShapeView-message a sh:PropertyShape ; sh:path sh:message ; sh:description "The message that shall be generated for all constraint violations produced by this property shape." ; sh:group tosh:ValidationPropertyGroup ; sh:name "messages" ; sh:or dash:StringOrLangString ; sh:order "5"^^xsd:decimal ; . tosh:PropertyShapeView-pathSystemLabel a sh:PropertyShape ; sh:path tosh:pathSystemLabel ; dash:neverMaterialize true ; dash:viewer tosh:PathStringViewer ; sh:datatype xsd:string ; sh:description "A display label of the sh:path based on qnames." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "property path" ; sh:order "2"^^xsd:decimal ; sh:values [ sh:else [ <http://uispin.org/ui#label> ( [ sh:path sh:path ; ] ) ; ] ; sh:if [ <http://datashapes.org/sparql#isIRI> ( [ sh:path sh:path ; ] ) ; ] ; sh:then [ <http://topbraid.org/sparqlmotionfunctions#qname> ( [ sh:path sh:path ; ] ) ; ] ; ] ; . tosh:PropertyShapeView-qualifiedMaxCount a sh:PropertyShape ; sh:path sh:qualifiedMaxCount ; sh:datatype xsd:integer ; sh:description "The maximum number of values that may conform to the qualified value shape." ; sh:group tosh:QualifiedCardinalityConstraintsPropertyGroup ; sh:maxCount 1 ; sh:name "qualified max count" ; sh:order "1"^^xsd:decimal ; . tosh:PropertyShapeView-qualifiedMinCount a sh:PropertyShape ; sh:path sh:qualifiedMinCount ; sh:datatype xsd:integer ; sh:description "The minimum number of values that must conform to the qualified value shape." ; sh:group tosh:QualifiedCardinalityConstraintsPropertyGroup ; sh:maxCount 1 ; sh:name "qualified min count" ; sh:order "0"^^xsd:decimal ; . tosh:PropertyShapeView-qualifiedValueShape a sh:PropertyShape ; sh:path sh:qualifiedValueShape ; sh:class sh:NodeShape ; sh:description "The shape that the specified number of values must conform to." ; sh:group tosh:QualifiedCardinalityConstraintsPropertyGroup ; sh:name "qualified value shape" ; sh:order "2"^^xsd:decimal ; . tosh:PropertyShapeView-qualifiedValueShapesDisjoint a sh:PropertyShape ; sh:path sh:qualifiedValueShapesDisjoint ; sh:datatype xsd:boolean ; sh:description "True to treat all qualified values as disjoint." ; sh:group tosh:QualifiedCardinalityConstraintsPropertyGroup ; sh:maxCount 1 ; sh:name "qualified value shapes disjoint" ; sh:order "3"^^xsd:decimal ; . tosh:PropertyTableViewer a dash:MultiViewer ; dash:hidden true ; rdfs:label "Property table viewer" ; . tosh:QualifiedCardinalityConstraintsPropertyGroup a sh:PropertyGroup ; rdfs:comment "The properties in this group are used together to express that a certain number of values must conform to a given shape." ; rdfs:label "Qualified Cardinality Constraints" ; sh:order "77"^^xsd:decimal ; . tosh:QueryTestCase-expectedResult a sh:PropertyShape ; sh:path dash:expectedResult ; dash:singleLine false ; sh:description "The expected result set, as a JSON string." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:name "expected result" ; sh:or ( [ sh:datatype rdf:JSON ; ] [ sh:datatype xsd:string ; ] ) ; . tosh:RDFSOWLClassView a sh:NodeShape ; dash:applicableToClass rdfs:Class ; rdfs:comment "A node shape collecting RDFS and OWL axioms for classes." ; rdfs:label "RDFS/OWL class view" ; sh:property tosh:Class-disjointWith ; sh:property tosh:Class-domain-inverse ; sh:property tosh:Class-equivalentClass ; sh:property tosh:Class-range-inverse ; sh:property tosh:Class-subClassOf ; sh:property tosh:Class-subClassOf-inverse ; sh:property tosh:Resource-comment ; sh:property tosh:Resource-label ; sh:property tosh:Resource-type ; . tosh:RDFSPropertyAxiomsPropertyGroup a sh:PropertyGroup ; rdfs:label "RDFS Property Axioms" ; sh:order "15"^^xsd:decimal ; . tosh:ReferencesPropertyGroup a sh:PropertyGroup ; rdfs:comment "A property group typically used for incoming references or usages."^^rdf:HTML ; rdfs:label "References" ; sh:order "100"^^xsd:decimal ; . tosh:ReificationPropertyGroup a sh:PropertyGroup ; rdfs:label "Reification (Statements about Statements)" ; sh:order "90"^^xsd:decimal ; . tosh:ReplaceWithDefaultValueSuggestionGenerator a dash:SPARQLUpdateSuggestionGenerator ; rdfs:comment "Produces a suggestion to replace all values of the given predicate (which must exist) at the focus node to the default value declared at the shape that has caused the violation. Does nothing if the shape does not declare a sh:defaultValue. Deletes any old value of the property." ; rdfs:label "Replace with default value suggestion generator" ; sh:message "Replace with default value" ; sh:prefixes <http://topbraid.org/tosh> ; sh:select """SELECT ?defaultValue WHERE { GRAPH $shapesGraph { $sourceShape sh:defaultValue ?defaultValue . } }""" ; sh:update """DELETE { $focusNode $predicate ?oldValue . } INSERT { $focusNode $predicate ?defaultValue . } WHERE { $focusNode $predicate ?oldValue . }""" ; . tosh:Resource-comment a sh:PropertyShape ; sh:path rdfs:comment ; dash:propertyRole dash:DescriptionRole ; dash:singleLine false ; graphql:name "comments" ; sh:description "The comments of this, possibly in multiple languages." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "comments" ; sh:or dash:StringOrLangStringOrHTML ; sh:order "1"^^xsd:decimal ; . tosh:Resource-label a sh:PropertyShape ; sh:path rdfs:label ; dash:propertyRole dash:LabelRole ; graphql:name "labels" ; sh:description "The display name(s) of this, possibly in multiple languages." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "labels" ; sh:or dash:StringOrLangString ; sh:order "0"^^xsd:decimal ; . tosh:Resource-type a sh:PropertyShape ; sh:path rdf:type ; graphql:name "types" ; sh:class rdfs:Class ; sh:description "The type(s) of this." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "types" ; sh:order "10"^^xsd:decimal ; . tosh:ResourceAction-jsCondition a sh:PropertyShape ; sh:path dash:jsCondition ; sh:datatype xsd:string ; sh:description "An (ADS) JavaScript expression that will be executed to determine whether the action is applicable to the selected resource in the current context. The variable focusNode can be queried here. The expression needs to return true for the action to be deemed suitable." ; sh:group tosh:ImplementationPropertyGroup ; sh:name "action pre-condition" ; sh:order "25"^^xsd:decimal ; . tosh:ResourceView a sh:NodeShape ; rdfs:comment "A generic view shape that can be used as fallback to display typical resources that have an rdfs:label and an rdfs:comment." ; rdfs:label "Resource view" ; sh:property tosh:Resource-comment ; sh:property tosh:Resource-label ; . tosh:Rule-condition a sh:PropertyShape ; sh:path sh:condition ; sh:description "The pre-conditions that must apply before a rule gets executed. The focus node must conform to all conditions, which must be shapes." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "conditions" ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order "40"^^xsd:decimal ; . tosh:Rule-deactivated a sh:PropertyShape ; sh:path sh:deactivated ; sh:datatype xsd:boolean ; sh:description "True to deactivate the rule so that it will not get executed." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "deactivated" ; sh:order "30"^^xsd:decimal ; . tosh:Rule-order a sh:PropertyShape ; sh:path sh:order ; sh:description "The order of this rule relative to other rules at the same shape. Rules with lower order are executed first. Default value is 0. Rules with the same order cannot \"see\" each other's inferences." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "order" ; sh:or ( [ sh:datatype xsd:decimal ; ] [ sh:datatype xsd:integer ; ] ) ; sh:order "35"^^xsd:decimal ; . tosh:Rule-rule-inverse a sh:PropertyShape ; sh:path [ sh:inversePath sh:rule ; ] ; sh:class sh:Shape ; sh:description "The shapes or classes that the rule is attached to." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "rule of" ; sh:order "20"^^xsd:decimal ; . tosh:SHMinMaxEditor a dash:SingleEditor ; dash:hidden true ; rdfs:comment "An internally used editor for min/max range values of property shapes."^^rdf:HTML ; rdfs:label "SHACL Min Max Editor" ; . tosh:SPARQLAskExecutable-ask a sh:PropertyShape ; sh:path sh:ask ; dash:singleLine false ; sh:datatype xsd:string ; sh:description "The SPARQL ASK query string." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "ask" ; sh:order "1"^^xsd:decimal ; . tosh:SPARQLConstraint-deactivated a sh:PropertyShape ; sh:path sh:deactivated ; sh:datatype xsd:boolean ; sh:description "True to deactive this constraint." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "deactivated" ; sh:order "30"^^xsd:decimal ; . tosh:SPARQLConstraint-message a sh:PropertyShape ; sh:path sh:message ; sh:description "The message(s) that should be produced for constraint violations. The messages may contain placeholders such as {$value} for any variable returned in the SELECT clause of the SPARQL query." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "messages" ; sh:or dash:StringOrLangString ; sh:order "20"^^xsd:decimal ; . tosh:SPARQLConstructExecutable-construct a sh:PropertyShape ; sh:path sh:construct ; dash:singleLine false ; sh:datatype xsd:string ; sh:description "The SPARQL CONSTRUCT query string." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "construct" ; sh:order "1"^^xsd:decimal ; . tosh:SPARQLExecutable-prefixes a sh:PropertyShape ; sh:path sh:prefixes ; sh:class owl:Ontology ; sh:description "The Ontology declaring the SHACL prefix declarations to use for the SPARQL query." ; sh:group tosh:ImplementationPropertyGroup ; sh:name "prefixes" ; sh:order "0"^^xsd:decimal ; . tosh:SPARQLSelectExecutable-select a sh:PropertyShape ; sh:path sh:select ; dash:singleLine false ; sh:datatype xsd:string ; sh:description "The SPARQL SELECT query string." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "select" ; sh:order "1"^^xsd:decimal ; . tosh:SPARQLUpdateExecutable-update a sh:PropertyShape ; sh:path sh:update ; dash:singleLine false ; sh:datatype xsd:string ; sh:description "The SPARQL UPDATE request string." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "update" ; sh:order "1"^^xsd:decimal ; . tosh:Script-js a sh:PropertyShape ; sh:path dash:js ; sh:datatype xsd:string ; sh:description "The implementation as JavaScript." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "JavaScript code" ; sh:order "20"^^xsd:decimal ; . tosh:Script-onAllValues a sh:PropertyShape ; sh:path dash:onAllValues ; sh:datatype xsd:boolean ; sh:description "If true then all value nodes will be available to the script at once, through the variable \"values\"." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "on all values" ; sh:order "0"^^xsd:decimal ; . tosh:ScriptConstraint-deactivated a sh:PropertyShape ; sh:path sh:deactivated ; sh:datatype xsd:boolean ; sh:description "True to deactivate this constraint." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "deactivated" ; sh:order "30"^^xsd:decimal ; . tosh:ScriptConstraint-message a sh:PropertyShape ; sh:path sh:message ; sh:description "The message(s) to use for violations produced by this script." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "messages" ; sh:or dash:StringOrLangString ; sh:order "20"^^xsd:decimal ; . tosh:ScriptFunction-canWrite a sh:PropertyShape ; sh:path dash:canWrite ; sh:datatype xsd:boolean ; sh:description "True to allow this function to have side effects. By default, functions are not permitted to modify the graph as this would violate SPARQL contracts. However, if canWrite is true then the function will not be available as a SPARQL function and only be injected into the generated API in read/write mode." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "can write" ; sh:order "15"^^xsd:decimal ; . tosh:ScriptTestCase-expectedResult a sh:PropertyShape ; sh:path dash:expectedResult ; sh:description "The expected result of the evaluation, as JSON object as produced by the servlet, or true or false." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:name "expected result" ; sh:or ( [ sh:datatype rdf:JSON ; ] [ sh:datatype xsd:boolean ; ] ) ; sh:order "0"^^xsd:decimal ; . tosh:ScriptTestCase-focusNode a sh:PropertyShape ; sh:path dash:focusNode ; sh:description "The selected resource, which will become value of focusNode for the script, with its \"most suitable\" JavaScript class as type. Defaults to the test case itself." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:name "focus node" ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order "10"^^xsd:decimal ; . tosh:ScriptsPropertyGroup a sh:PropertyGroup ; rdfs:comment "Scripts based on Active Data Shapes." ; rdfs:label "Scripts" ; sh:order "30"^^xsd:decimal ; . tosh:Service-canWrite a sh:PropertyShape ; sh:path dash:canWrite ; sh:datatype xsd:boolean ; sh:description "True if this service can modify the data, i.e. it will execute in read/write mode. By default, all services are read-only." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "can write" ; . tosh:Service-deactivated a sh:PropertyShape ; sh:path sh:deactivated ; sh:datatype xsd:boolean ; sh:description "True to deactivate this service." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "deactivated" ; sh:order "30"^^xsd:decimal ; . tosh:Service-responseContentType a sh:PropertyShape ; sh:path dash:responseContentType ; sh:datatype xsd:string ; sh:description "The content type (mime type) of the service response, defaulting to \"application/json\". Use \"void\" to return nothing." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "response content type" ; sh:order "10"^^xsd:decimal ; . tosh:SetToDefaultValueSuggestionGenerator a dash:SPARQLUpdateSuggestionGenerator ; rdfs:comment "Produces a suggestion to set the given predicate at the focus node to the default value declared at the shape that has caused the violation. Does nothing if the shape does not declare a sh:defaultValue. Deletes any old value of the property." ; rdfs:label "Set to default value suggestion generator" ; sh:message "Set to default value" ; sh:prefixes <http://topbraid.org/tosh> ; sh:select """SELECT ?defaultValue WHERE { GRAPH $shapesGraph { $sourceShape sh:defaultValue ?defaultValue . } }""" ; sh:update """DELETE { $focusNode $predicate ?oldValue . } INSERT { $focusNode $predicate ?defaultValue . } WHERE { OPTIONAL { $focusNode $predicate ?oldValue . } }""" ; . tosh:Shape-datatypes a sh:PropertyShape ; sh:path tosh:datatypes ; dash:neverMaterialize true ; dash:viewer tosh:DatatypesViewer ; sh:description "Zero of more datatypes that value nodes can take. In SHACL, the typical pattern is to either use a single sh:datatype or a sh:or of multiple sh:datatype constraints. This inferred property here provides a unified way to access these two design patterns." ; sh:group tosh:TypeOfValuesPropertyGroup ; sh:name "datatypes" ; sh:nodeKind sh:IRI ; sh:order "0"^^xsd:decimal ; sh:values [ sh:union ( [ sh:path sh:datatype ; ] [ sh:path ( sh:or [ sh:zeroOrMorePath rdf:rest ; ] rdf:first sh:datatype ) ; ] ) ; ] ; . tosh:Shape-deactivated a sh:PropertyShape ; sh:path sh:deactivated ; sh:datatype xsd:boolean ; sh:description "True to deactivate this shape, making it literally invisible and without any effect." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "deactivated" ; sh:order "30"^^xsd:decimal ; . tosh:Shape-severity a sh:PropertyShape ; sh:path sh:severity ; dash:editor dash:InstancesSelectEditor ; sh:class sh:Severity ; sh:description "The severity to be used for validation results produced by the constraints." ; sh:group tosh:ValidationPropertyGroup ; sh:maxCount 1 ; sh:name "severity" ; sh:order "0"^^xsd:decimal ; . tosh:ShapeInGraphConstraintComponent a sh:ConstraintComponent ; dash:propertySuggestionGenerator tosh:DeleteTripleSuggestionGenerator ; rdfs:comment """A constraint component that can be used to verify that the value nodes have a given shape, where the shape validation is executed in a given graph. This can, for example, be used to verify that a given value is declared as an instance of a given class in some specified (not imported) graph. A typical design pattern is as follows: ex:NodeShape sh:property [ sh:path ex:myProperty ; sh:nodeKind sh:IRI ; tosh:graph <http://example.org/externalGraph> ; tosh:shapeInGraph [ sh:class ex:ExternalClass ; ] ; tosh:editor tosh:InstancesInGraphSelectEditor ; tosh:viewer tosh:URIInGraphViewer ; ] .""" ; rdfs:label "Shape in graph constraint component" ; sh:labelTemplate "Values must have shape {$shapeInGraph} defined in graph {$graph}" ; sh:message "Value does not have shape {$shapeInGraph} defined in graph {$graph}" ; sh:parameter [ a sh:Parameter ; sh:path tosh:graph ; sh:nodeKind sh:IRI ; ] ; sh:parameter [ a sh:Parameter ; sh:path tosh:shapeInGraph ; sh:nodeKind sh:BlankNodeOrIRI ; ] ; sh:validator [ a sh:SPARQLAskValidator ; sh:ask """ASK { GRAPH $graph { FILTER tosh:hasShape($value, $shapeInGraph) } }""" ; sh:prefixes <http://topbraid.org/tosh> ; ] ; . tosh:StringConstraintsPropertyGroup a sh:PropertyGroup ; rdfs:label "String Constraints" ; sh:order "70"^^xsd:decimal ; . tosh:SystemNamespaceShape a sh:NodeShape ; rdfs:comment "A shape that detects whether the focus node is a URI that has a namespace from one of the system namespaces - RDF, RDFS, OWL etc. The list of actual system namespaces is represented via tosh:systemNamespace true triples." ; rdfs:label "System namespace shape" ; sh:sparql [ a sh:SPARQLConstraint ; sh:message "Not a IRI from a system namespace" ; sh:prefixes <http://topbraid.org/tosh> ; sh:select """SELECT $this WHERE { FILTER (!isIRI($this) || (isIRI($this) && EXISTS { BIND (IRI(afn:namespace($this)) AS ?ns) . FILTER NOT EXISTS { ?ns tosh:systemNamespace true } . } )) . }""" ; ] ; . tosh:TargetsPropertyGroup a sh:PropertyGroup ; rdfs:label "Targets" ; sh:order "5"^^xsd:decimal ; . tosh:TeamworkPlatform a dash:ExecutionPlatform ; dash:includedExecutionPlatform tosh:TopBraidPlatform ; rdfs:comment "The platform consisting of TopBraid plus any teamwork features used by TopBraid EDG." ; rdfs:label "Teamwork platform" ; . tosh:TestCase-deactivated a sh:PropertyShape ; sh:path sh:deactivated ; sh:datatype xsd:boolean ; sh:description "If set to true, this test case will be skipped." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:name "deactivated" ; sh:order "50"^^xsd:decimal ; . tosh:TestPropertiesPropertyGroup a sh:PropertyGroup ; rdfs:label "Test Properties" ; sh:order "20"^^xsd:decimal ; . tosh:TopBraidPlatform a dash:ExecutionPlatform ; rdfs:comment "The platform consisting of TopBraid." ; rdfs:label "TopBraid platform" ; . tosh:TripleRule-object a sh:PropertyShape ; sh:path sh:object ; dash:viewer dash:NodeExpressionViewer ; sh:description "The node expression producing the object(s) of the triple inferred by the rule." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:minCount 1 ; sh:name "object" ; sh:order 2 ; . tosh:TripleRule-predicate a sh:PropertyShape ; sh:path sh:predicate ; dash:viewer dash:NodeExpressionViewer ; sh:description "The node expression producing the predicate(s) of the triple inferred by the rule." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:minCount 1 ; sh:name "predicate" ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order 1 ; . tosh:TripleRule-subject a sh:PropertyShape ; sh:path sh:subject ; dash:viewer dash:NodeExpressionViewer ; sh:description "The node expression producing the subject(s) of the triple inferred by the rule." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:minCount 1 ; sh:name "subject" ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order 0 ; . tosh:TypeOfValuesPropertyGroup a sh:PropertyGroup ; rdfs:label "Type of Values" ; sh:order "50"^^xsd:decimal ; . tosh:URIInGraphViewer a dash:SingleViewer ; rdfs:comment "A viewer for URI resources that have their data in a given graph that may be outside of the imports closure. The graph must be specified using a tosh:graph constraint for the property." ; rdfs:label "URI in graph viewer" ; . tosh:UseDeclaredDatatypeConstraintComponent a sh:ConstraintComponent ; dash:propertySuggestionGenerator [ a dash:SPARQLUpdateSuggestionGenerator ; sh:message "Change datatype of the invalid value to the specified sh:datatype" ; sh:prefixes <http://topbraid.org/tosh> ; sh:update """DELETE { $subject $predicate $object . } INSERT { $subject $predicate ?newObject . } WHERE { $subject sh:datatype ?datatype . BIND (spif:cast(?object, ?datatype) AS ?newObject) . }""" ; ] ; rdfs:comment "Constrains the value nodes to be either non-literals or literals that have the same datatype as the declared sh:datatype for the given constraint node. This is used, among others, in properties such as sh:hasValue and sh:minExclusive." ; rdfs:label "Use declared datatype constraint component" ; sh:parameter [ a sh:Parameter ; sh:path tosh:useDeclaredDatatype ; sh:datatype xsd:boolean ; sh:description "True to state that the datatype of literal values must be the same as the declared sh:datatype." ; sh:name "use declared datatype" ; ] ; sh:propertyValidator [ a sh:SPARQLSelectValidator ; sh:message "Datatype must match the declared datatype " ; sh:prefixes <http://topbraid.org/tosh> ; sh:select """ SELECT DISTINCT $this ?value ?datatype WHERE { { FILTER ($useDeclaredDatatype) } $this sh:datatype ?datatype . $this $PATH ?value . FILTER (isLiteral(?value) && datatype(?value) != ?datatype) . }""" ; ] ; sh:targetClass sh:PropertyShape ; . tosh:ValidationPropertyGroup a sh:PropertyGroup ; rdfs:label "Validation" ; sh:order "30"^^xsd:decimal ; . tosh:ValidationTestCase-expectedResult a sh:PropertyShape ; sh:path dash:expectedResult ; sh:description "The expected validation report, either as instance of sh:ValidationReport or a Turtle string with one instance of sh:ValidationReport in it when parsed." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:name "expected result" ; sh:or ( [ sh:datatype xsd:string ; ] [ sh:class sh:ValidationReport ; ] ) ; sh:order "10"^^xsd:decimal ; . tosh:ValidationTestCase-includeSuggestions a sh:PropertyShape ; sh:path dash:includeSuggestions ; sh:datatype xsd:boolean ; sh:description "True to also generate and verify suggestions." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:name "include suggestions" ; sh:order "0"^^xsd:decimal ; . tosh:ValidationTestCase-validateShapes a sh:PropertyShape ; sh:path dash:validateShapes ; sh:datatype xsd:boolean ; sh:description "True to also validate shapes themselves." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:name "validate shapes" ; sh:order "5"^^xsd:decimal ; . tosh:ValueConstraintsPropertyGroup a sh:PropertyGroup ; rdfs:label "Value Constraints" ; sh:order "60"^^xsd:decimal ; . tosh:ValueRangePropertyGroup a sh:PropertyGroup ; rdfs:label "Value Range" ; sh:order "60"^^xsd:decimal ; . tosh:countShapesWithMatchResult a sh:SPARQLFunction ; rdfs:comment "Counts the number of shapes from a given rdf:List (?arg2) defined in a given shapes graph (?arg3) where tosh:hasShape returns the provided match value (true or false, ?arg4) for a given focus node (?arg1). The function produces a failure if one of the shapes validated to a failure." ; rdfs:label "count shapes with match result" ; sh:parameter [ a sh:Parameter ; sh:path sh:expectedValue ; sh:datatype xsd:boolean ; sh:description "The expected value of tosh:hasShape to count." ; sh:order 3.0 ; ] ; sh:parameter [ a sh:Parameter ; sh:path sh:focusNode ; sh:class rdfs:Resource ; sh:description "The focus node." ; sh:order 0.0 ; ] ; sh:parameter [ a sh:Parameter ; sh:path sh:shapes ; sh:class rdf:List ; sh:description "The list of shapes to walk through." ; sh:order 1.0 ; ] ; sh:parameter [ a sh:Parameter ; sh:path sh:shapesGraph ; sh:class rdfs:Resource ; sh:description "The shapes graph." ; sh:order 2.0 ; ] ; sh:prefixes <http://topbraid.org/tosh> ; sh:returnType xsd:integer ; sh:select """ # The SUM will fail with an error if one of the operands is not a number # (this mechanism is used to propagate errors from tosh:hasShape calls) SELECT (SUM(?s) AS ?result) WHERE { GRAPH $shapesGraph { $shapes rdf:rest*/rdf:first ?shape . } BIND (tosh:hasShape($focusNode, ?shape, true) AS ?hasShape) . BIND (IF(bound(?hasShape), IF(?hasShape = $expectedValue, 1, 0), 'error') AS ?s) . } """ ; . tosh:editGroupDescription a rdf:Property ; rdfs:comment "A description of the property group when in \"edit\" mode." ; rdfs:domain sh:PropertyGroup ; rdfs:label "edit group description" ; rdfs:range xsd:string ; . tosh:graph a rdf:Property ; rdfs:comment "The graph that the shape is validated in." ; rdfs:label "graph" ; . tosh:hasDatatype a sh:SPARQLAskValidator ; rdfs:comment "Checks whether a given node ($value) is a literal with a given datatype ($datatype), and that the literal is well-formed." ; rdfs:label "has datatype" ; sh:ask """ ASK { FILTER (datatype($value) = $datatype && spif:isValidForDatatype($value, $datatype)) . } """ ; sh:prefixes <http://topbraid.org/tosh> ; . tosh:hasShape a sh:Function ; dash:apiStatus dash:Experimental ; rdfs:comment """A built-in function of the TopBraid SHACL implementation. Can be used to validate a given (focus) node against a given shape, returning <code>true</code> if the node is valid. If executed within a SHACL validation engine, this uses the shapes graph that was provided when the engine started. If executed in other contexts, e.g. in a stand-alone SPARQL query, the function attempts to use the URI of the current default graph as the shapes graph. This may not always be supported. If called from within an SWP engine, the shapes graph is the current query graph."""^^rdf:HTML ; rdfs:label "has shape" ; sh:parameter [ a sh:Parameter ; sh:path tosh:node ; sh:description "The node to validate." ; ] ; sh:parameter [ a sh:Parameter ; sh:path tosh:shape ; sh:description "The shape that the node is supposed to have." ; ] ; sh:returnType xsd:boolean
51
Merge branch 'compact'
4
.ttl
ttl
apache-2.0
TopQuadrant/shacl
360
<NME> ValidationEngineConfiguration.java <BEF> package org.topbraid.shacl.validation; import java.util.HashSet; import java.util.Set; import org.apache.jena.rdf.model.Resource; /** * Configures the behavior of the validation engine. */ public class ValidationEngineConfiguration { // By default don't produce sh:detail private boolean reportDetails = false; // By default validate all constraints private Set<Resource> skippedConstraintComponents = new HashSet<>(); // By default validate shapes private boolean validateShapes = true; // By default collect all possible errors private int validationErrorBatch = -1; /** * Creates a clone of this, with exactly the same values. */ public ValidationEngineConfiguration clone() { ValidationEngineConfiguration c = new ValidationEngineConfiguration(); c.reportDetails = this.reportDetails; c.skippedConstraintComponents = new HashSet<>(this.skippedConstraintComponents); c.validateShapes = this.validateShapes; c.validationErrorBatch = this.validationErrorBatch; return c; } /** * Checks whether the report shall include sh:detail triples (for sh:node etc). * @return true to report details (false is default) */ public boolean getReportDetails() { return reportDetails; } /** * Specifies whether the report shall include sh:detail triples where supported. * @param reportDetails true to produce sh:details, false for the default * @return current configuration after modification */ public ValidationEngineConfiguration setReportDetails(boolean reportDetails) { this.reportDetails = reportDetails; return this; } /** * Maximum number of validations before returning the report. * @return number of validations or -1 to mean all validations */ public int getValidationErrorBatch() { return validationErrorBatch; } /** * Set the maximum number of validations before returning the report. * @param validationErrorBatch maximum number of validations or -1 for all validations * @return current configuration after modification */ public ValidationEngineConfiguration setValidationErrorBatch(int validationErrorBatch) { this.validationErrorBatch = validationErrorBatch; return this; } /** * Should the engine validates shapes * @return boolean flag for shapes validation */ public boolean getValidateShapes() { return validateShapes; } /** * Sets an option for the engine to validate shapes * @param validateShapes boolean flat indicating if shapes must be validated * @return current configuration after modification */ public ValidationEngineConfiguration setValidateShapes(boolean validateShapes) { this.validateShapes = validateShapes; return this; } /** * Checks whether the engine should skip constraints of a given constraint component. * @param component the constraint component * @return true if component shall be skipped */ public boolean isSkippedConstraintComponent(Resource component) { return skippedConstraintComponents.contains(component); } public void addSkippedConstraintComponent(Resource component) { skippedConstraintComponents.add(component); } } <MSG> Removed SHACLC support (jena-shacl already has that) <DFF> @@ -34,7 +34,7 @@ public class ValidationEngineConfiguration { c.validationErrorBatch = this.validationErrorBatch; return c; } - + /** * Checks whether the report shall include sh:detail triples (for sh:node etc).
1
Removed SHACLC support (jena-shacl already has that)
1
.java
java
apache-2.0
TopQuadrant/shacl
361
<NME> ValidationEngineConfiguration.java <BEF> package org.topbraid.shacl.validation; import java.util.HashSet; import java.util.Set; import org.apache.jena.rdf.model.Resource; /** * Configures the behavior of the validation engine. */ public class ValidationEngineConfiguration { // By default don't produce sh:detail private boolean reportDetails = false; // By default validate all constraints private Set<Resource> skippedConstraintComponents = new HashSet<>(); // By default validate shapes private boolean validateShapes = true; // By default collect all possible errors private int validationErrorBatch = -1; /** * Creates a clone of this, with exactly the same values. */ public ValidationEngineConfiguration clone() { ValidationEngineConfiguration c = new ValidationEngineConfiguration(); c.reportDetails = this.reportDetails; c.skippedConstraintComponents = new HashSet<>(this.skippedConstraintComponents); c.validateShapes = this.validateShapes; c.validationErrorBatch = this.validationErrorBatch; return c; } /** * Checks whether the report shall include sh:detail triples (for sh:node etc). * @return true to report details (false is default) */ public boolean getReportDetails() { return reportDetails; } /** * Specifies whether the report shall include sh:detail triples where supported. * @param reportDetails true to produce sh:details, false for the default * @return current configuration after modification */ public ValidationEngineConfiguration setReportDetails(boolean reportDetails) { this.reportDetails = reportDetails; return this; } /** * Maximum number of validations before returning the report. * @return number of validations or -1 to mean all validations */ public int getValidationErrorBatch() { return validationErrorBatch; } /** * Set the maximum number of validations before returning the report. * @param validationErrorBatch maximum number of validations or -1 for all validations * @return current configuration after modification */ public ValidationEngineConfiguration setValidationErrorBatch(int validationErrorBatch) { this.validationErrorBatch = validationErrorBatch; return this; } /** * Should the engine validates shapes * @return boolean flag for shapes validation */ public boolean getValidateShapes() { return validateShapes; } /** * Sets an option for the engine to validate shapes * @param validateShapes boolean flat indicating if shapes must be validated * @return current configuration after modification */ public ValidationEngineConfiguration setValidateShapes(boolean validateShapes) { this.validateShapes = validateShapes; return this; } /** * Checks whether the engine should skip constraints of a given constraint component. * @param component the constraint component * @return true if component shall be skipped */ public boolean isSkippedConstraintComponent(Resource component) { return skippedConstraintComponents.contains(component); } public void addSkippedConstraintComponent(Resource component) { skippedConstraintComponents.add(component); } } <MSG> Removed SHACLC support (jena-shacl already has that) <DFF> @@ -34,7 +34,7 @@ public class ValidationEngineConfiguration { c.validationErrorBatch = this.validationErrorBatch; return c; } - + /** * Checks whether the report shall include sh:detail triples (for sh:node etc).
1
Removed SHACLC support (jena-shacl already has that)
1
.java
java
apache-2.0
TopQuadrant/shacl
362
<NME> targetObjectsOf-001.test.ttl <BEF> ADDFILE <MSG> Support for sh:prefixes (switched off by default) <DFF> @@ -0,0 +1,55 @@ +# baseURI: http://datashapes.org/sh/tests/core/target/targetObjectsOf-001.test +# imports: http://datashapes.org/dash +# prefix: ex + +@prefix dash: <http://datashapes.org/dash#> . +@prefix ex: <http://datashapes.org/sh/tests/core/target/targetObjectsOf-001.test#> . +@prefix owl: <http://www.w3.org/2002/07/owl#> . +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix sh: <http://www.w3.org/ns/shacl#> . +@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . + +<http://datashapes.org/sh/tests/core/target/targetObjectsOf-001.test> + rdf:type owl:Ontology ; + rdfs:label "Test of targetObjectsOf-001" ; + owl:imports <http://datashapes.org/dash> ; + owl:versionInfo "Created with TopBraid Composer" ; +. +ex:GraphValidationTestCase + rdf:type dash:GraphValidationTestCase ; + dash:expectedResult [ + rdf:type sh:ValidationResult ; + sh:focusNode rdfs:Resource ; + sh:severity sh:Violation ; + sh:sourceConstraintComponent sh:DatatypeConstraintComponent ; + sh:value rdfs:Resource ; + ] ; + dash:expectedResult [ + rdf:type sh:ValidationResult ; + sh:focusNode "String" ; + sh:severity sh:Violation ; + sh:sourceConstraintComponent sh:DatatypeConstraintComponent ; + sh:value "String" ; + ] ; +. +ex:InvalidResource1 + ex:testProperty "String" ; +. +ex:InvalidResource2 + ex:testProperty rdfs:Resource ; +. +ex:TestShape + rdf:type sh:Shape ; + rdfs:label "Test shape" ; + sh:datatype xsd:integer ; + sh:targetObjectsOf ex:testProperty ; +. +ex:ValidResource1 + ex:testProperty 100 ; + ex:testProperty 42 ; +. +ex:testProperty + rdf:type rdf:Property ; + rdfs:label "test property" ; +.
55
Support for sh:prefixes (switched off by default)
0
.ttl
test
apache-2.0
TopQuadrant/shacl
363
<NME> targetObjectsOf-001.test.ttl <BEF> ADDFILE <MSG> Support for sh:prefixes (switched off by default) <DFF> @@ -0,0 +1,55 @@ +# baseURI: http://datashapes.org/sh/tests/core/target/targetObjectsOf-001.test +# imports: http://datashapes.org/dash +# prefix: ex + +@prefix dash: <http://datashapes.org/dash#> . +@prefix ex: <http://datashapes.org/sh/tests/core/target/targetObjectsOf-001.test#> . +@prefix owl: <http://www.w3.org/2002/07/owl#> . +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix sh: <http://www.w3.org/ns/shacl#> . +@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . + +<http://datashapes.org/sh/tests/core/target/targetObjectsOf-001.test> + rdf:type owl:Ontology ; + rdfs:label "Test of targetObjectsOf-001" ; + owl:imports <http://datashapes.org/dash> ; + owl:versionInfo "Created with TopBraid Composer" ; +. +ex:GraphValidationTestCase + rdf:type dash:GraphValidationTestCase ; + dash:expectedResult [ + rdf:type sh:ValidationResult ; + sh:focusNode rdfs:Resource ; + sh:severity sh:Violation ; + sh:sourceConstraintComponent sh:DatatypeConstraintComponent ; + sh:value rdfs:Resource ; + ] ; + dash:expectedResult [ + rdf:type sh:ValidationResult ; + sh:focusNode "String" ; + sh:severity sh:Violation ; + sh:sourceConstraintComponent sh:DatatypeConstraintComponent ; + sh:value "String" ; + ] ; +. +ex:InvalidResource1 + ex:testProperty "String" ; +. +ex:InvalidResource2 + ex:testProperty rdfs:Resource ; +. +ex:TestShape + rdf:type sh:Shape ; + rdfs:label "Test shape" ; + sh:datatype xsd:integer ; + sh:targetObjectsOf ex:testProperty ; +. +ex:ValidResource1 + ex:testProperty 100 ; + ex:testProperty 42 ; +. +ex:testProperty + rdf:type rdf:Property ; + rdfs:label "test property" ; +.
55
Support for sh:prefixes (switched off by default)
0
.ttl
test
apache-2.0
TopQuadrant/shacl
364
<NME> TestValidatorConfiguration.java <BEF> package org.topbraid.shacl; import org.apache.jena.rdf.model.Model; import org.apache.jena.rdf.model.Resource; import org.apache.jena.util.FileUtils; import org.junit.Test; import org.topbraid.jenax.util.JenaUtil; import org.topbraid.shacl.validation.ValidationEngineConfiguration; import org.topbraid.shacl.validation.ValidationUtil; import org.topbraid.shacl.vocabulary.SH; public class TestValidatorConfiguration { @Test public void testMaxErrors() { Model dataModel = JenaUtil.createMemoryModel(); dataModel.read(ValidationExample.class.getResourceAsStream("/sh/tests/core/property/class-001.test.ttl"), "urn:dummy", FileUtils.langTurtle); ValidationEngineConfiguration configuration = new ValidationEngineConfiguration(); configuration.setValidationErrorBatch(-1); Resource reportNoMaximum = ValidationUtil.validateModel(dataModel, dataModel, configuration); Model resultModel = reportNoMaximum.getModel(); assert(resultModel.listStatements(null, SH.resultSeverity, SH.Violation).toList().size() == 2); configuration.setValidationErrorBatch(1); Resource reportMaximum = ValidationUtil.validateModel(dataModel, dataModel, configuration); resultModel = reportMaximum.getModel(); System.out.println("FOUND " + resultModel.listStatements(null, SH.resultSeverity, SH.Violation).toList().size() ); assert(resultModel.listStatements(null, SH.resultSeverity, SH.Violation).toList().size() == 1); } } <MSG> Merge branch 'shacl-1.4.0' <DFF> @@ -5,6 +5,8 @@ import org.apache.jena.rdf.model.Resource; import org.apache.jena.util.FileUtils; import org.junit.Test; import org.topbraid.jenax.util.JenaUtil; +import org.topbraid.jenax.util.SystemTriples; +import org.topbraid.shacl.util.SHACLSystemModel; import org.topbraid.shacl.validation.ValidationEngineConfiguration; import org.topbraid.shacl.validation.ValidationUtil; import org.topbraid.shacl.vocabulary.SH; @@ -15,6 +17,8 @@ public class TestValidatorConfiguration { public void testMaxErrors() { Model dataModel = JenaUtil.createMemoryModel(); dataModel.read(ValidationExample.class.getResourceAsStream("/sh/tests/core/property/class-001.test.ttl"), "urn:dummy", FileUtils.langTurtle); + dataModel.add(SystemTriples.getVocabularyModel()); + dataModel.add(SHACLSystemModel.getSHACLModel()); ValidationEngineConfiguration configuration = new ValidationEngineConfiguration(); configuration.setValidationErrorBatch(-1); @@ -22,15 +26,13 @@ public class TestValidatorConfiguration { Resource reportNoMaximum = ValidationUtil.validateModel(dataModel, dataModel, configuration); Model resultModel = reportNoMaximum.getModel(); + assert(resultModel.listStatements(null, SH.resultSeverity, SH.Violation).toList().size() == 2); - configuration.setValidationErrorBatch(1); Resource reportMaximum = ValidationUtil.validateModel(dataModel, dataModel, configuration); resultModel = reportMaximum.getModel(); - System.out.println("FOUND " + resultModel.listStatements(null, SH.resultSeverity, SH.Violation).toList().size() ); assert(resultModel.listStatements(null, SH.resultSeverity, SH.Violation).toList().size() == 1); - } }
5
Merge branch 'shacl-1.4.0'
3
.java
java
apache-2.0
TopQuadrant/shacl
365
<NME> TestValidatorConfiguration.java <BEF> package org.topbraid.shacl; import org.apache.jena.rdf.model.Model; import org.apache.jena.rdf.model.Resource; import org.apache.jena.util.FileUtils; import org.junit.Test; import org.topbraid.jenax.util.JenaUtil; import org.topbraid.shacl.validation.ValidationEngineConfiguration; import org.topbraid.shacl.validation.ValidationUtil; import org.topbraid.shacl.vocabulary.SH; public class TestValidatorConfiguration { @Test public void testMaxErrors() { Model dataModel = JenaUtil.createMemoryModel(); dataModel.read(ValidationExample.class.getResourceAsStream("/sh/tests/core/property/class-001.test.ttl"), "urn:dummy", FileUtils.langTurtle); ValidationEngineConfiguration configuration = new ValidationEngineConfiguration(); configuration.setValidationErrorBatch(-1); Resource reportNoMaximum = ValidationUtil.validateModel(dataModel, dataModel, configuration); Model resultModel = reportNoMaximum.getModel(); assert(resultModel.listStatements(null, SH.resultSeverity, SH.Violation).toList().size() == 2); configuration.setValidationErrorBatch(1); Resource reportMaximum = ValidationUtil.validateModel(dataModel, dataModel, configuration); resultModel = reportMaximum.getModel(); System.out.println("FOUND " + resultModel.listStatements(null, SH.resultSeverity, SH.Violation).toList().size() ); assert(resultModel.listStatements(null, SH.resultSeverity, SH.Violation).toList().size() == 1); } } <MSG> Merge branch 'shacl-1.4.0' <DFF> @@ -5,6 +5,8 @@ import org.apache.jena.rdf.model.Resource; import org.apache.jena.util.FileUtils; import org.junit.Test; import org.topbraid.jenax.util.JenaUtil; +import org.topbraid.jenax.util.SystemTriples; +import org.topbraid.shacl.util.SHACLSystemModel; import org.topbraid.shacl.validation.ValidationEngineConfiguration; import org.topbraid.shacl.validation.ValidationUtil; import org.topbraid.shacl.vocabulary.SH; @@ -15,6 +17,8 @@ public class TestValidatorConfiguration { public void testMaxErrors() { Model dataModel = JenaUtil.createMemoryModel(); dataModel.read(ValidationExample.class.getResourceAsStream("/sh/tests/core/property/class-001.test.ttl"), "urn:dummy", FileUtils.langTurtle); + dataModel.add(SystemTriples.getVocabularyModel()); + dataModel.add(SHACLSystemModel.getSHACLModel()); ValidationEngineConfiguration configuration = new ValidationEngineConfiguration(); configuration.setValidationErrorBatch(-1); @@ -22,15 +26,13 @@ public class TestValidatorConfiguration { Resource reportNoMaximum = ValidationUtil.validateModel(dataModel, dataModel, configuration); Model resultModel = reportNoMaximum.getModel(); + assert(resultModel.listStatements(null, SH.resultSeverity, SH.Violation).toList().size() == 2); - configuration.setValidationErrorBatch(1); Resource reportMaximum = ValidationUtil.validateModel(dataModel, dataModel, configuration); resultModel = reportMaximum.getModel(); - System.out.println("FOUND " + resultModel.listStatements(null, SH.resultSeverity, SH.Violation).toList().size() ); assert(resultModel.listStatements(null, SH.resultSeverity, SH.Violation).toList().size() == 1); - } }
5
Merge branch 'shacl-1.4.0'
3
.java
java
apache-2.0
TopQuadrant/shacl
366
<NME> tosh.ttl <BEF> # baseURI: http://topbraid.org/tosh # imports: http://datashapes.org/dash # prefix: tosh @prefix dash: <http://datashapes.org/dash#> . @prefix graphql: <http://datashapes.org/graphql#> . @prefix owl: <http://www.w3.org/2002/07/owl#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix sh: <http://www.w3.org/ns/shacl#> . @prefix swa: <http://topbraid.org/swa#> . @prefix tosh: <http://topbraid.org/tosh#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . dash: tosh:systemNamespace true ; . dash:Action sh:property tosh:Action-actionGroup ; sh:property tosh:Action-actionIconClass ; sh:property tosh:Action-deactivated ; . dash:ActionGroup sh:property tosh:ActionGroup-order ; sh:property tosh:Resource-comment ; sh:property tosh:Resource-label ; . dash:ActionTestCase sh:property tosh:ActionTestCase-action ; sh:property tosh:ActionTestCase-expectedResult ; sh:property tosh:ActionTestCase-focusNode ; sh:property tosh:ActionTestCase-variables ; . dash:ChangeScript sh:property tosh:ChangeScript-deactivated ; sh:property tosh:ChangeScript-order ; . dash:ClosedByTypesConstraintComponent-closedByTypes sh:group tosh:ValidationPropertyGroup ; . dash:CoExistsWithConstraintComponent-coExistsWith sh:group tosh:PropertyPairConstraintsPropertyGroup ; sh:order "0"^^xsd:decimal ; . dash:DetailsEditor dash:hidden true ; owl:versionInfo "This is not yet supported by TopBraid." ; . dash:FunctionTestCase sh:property tosh:FunctionTestCase-expectedResult ; sh:property tosh:FunctionTestCase-expression ; . dash:GraphStoreTestCase sh:property tosh:GraphStoreTestCase-expectedResult ; sh:property tosh:GraphStoreTestCase-uri ; . dash:IndexedConstraintComponent-indexed sh:group tosh:ReificationPropertyGroup ; sh:order "1"^^xsd:decimal ; . dash:InferencingTestCase sh:property tosh:InferencingTestCase-expectedResult ; sh:namespace "http://spinrdf.org/spif#"^^xsd:anyURI ; sh:prefix "spif" ; ] ; sh:declare [ rdf:type sh:PrefixDeclaration ; sh:namespace "http://topbraid.org/tosh#"^^xsd:anyURI ; dash:NonRecursiveConstraintComponent-nonRecursive sh:group tosh:ValueConstraintsPropertyGroup ; sh:order "5"^^xsd:decimal ; . dash:PrimaryKeyConstraintComponent-uriStart sh:group tosh:StringConstraintsPropertyGroup ; sh:order "40"^^xsd:decimal ; . dash:PropertyRole sh:property tosh:Resource-comment ; sh:property tosh:Resource-label ; . dash:QueryTestCase sh:property tosh:QueryTestCase-expectedResult ; . . tosh:ComplexConstraintPropertyGroup rdf:type sh:PropertyGroup ; tosh:openable "true"^^xsd:boolean ; rdfs:label "Complex Constraints" ; sh:order 9 ; dash:RootClassConstraintComponent dash:propertySuggestionGenerator tosh:DeleteTripleSuggestionGenerator ; . dash:RootClassConstraintComponent-rootClass . tosh:DeleteTripleSuggestionGenerator rdf:type dash:SPARQLUpdateSuggestionGenerator ; rdfs:label "Delete triple suggestion generator" ; sh:message "Delete the invalid statement" ; sh:update """DELETE { $focusNode $predicate $value . } WHERE { }""" ; . tosh:DisplayPropertyGroup . dash:ScriptConstraint sh:property tosh:Script-onAllValues ; sh:property tosh:ScriptConstraint-deactivated ; sh:property tosh:ScriptConstraint-message ; . dash:ScriptConstraintComponent-scriptConstraint sh:group tosh:AdvancedPropertyGroup ; sh:order "20"^^xsd:decimal ; . dash:ScriptFunction sh:property tosh:ScriptFunction-canWrite ; . dash:ScriptTestCase sh:property tosh:ScriptTestCase-expectedResult ; sh:property tosh:ScriptTestCase-focusNode ; . dash:ScriptValidator sh:property tosh:Script-onAllValues ; . dash:Service sh:property tosh:Service-canWrite ; sh:property tosh:Service-deactivated ; sh:property tosh:Service-responseContentType ; . dash:StemConstraintComponent-stem sh:group tosh:StringConstraintsPropertyGroup ; sh:order "45"^^xsd:decimal ; . dash:SubSetOfConstraintComponent-subSetOf sh:group tosh:PropertyPairConstraintsPropertyGroup ; sh:order "20"^^xsd:decimal ; . dash:SymmetricConstraintComponent dash:propertySuggestionGenerator tosh:DeleteTripleSuggestionGenerator ; dash:propertySuggestionGenerator [ a dash:SPARQLUpdateSuggestionGenerator ; sh:message "Add symmetric value." ; sh:order "0"^^xsd:decimal ; sh:prefixes <http://topbraid.org/tosh> ; sh:update """INSERT { $value $predicate $focusNode . } WHERE { }""" ; ] ; . dash:SymmetricConstraintComponent-symmetric sh:group tosh:ValueConstraintsPropertyGroup ; sh:order "10"^^xsd:decimal ; . dash:TestCase sh:property tosh:TestCase-deactivated ; . dash:TestCaseResult sh:property [ a sh:PropertyShape ; sh:path dash:testCase ; sh:class dash:TestCase ; sh:description "The dash:TestCase that was executed." ; sh:maxCount 1 ; sh:minCount 1 ; sh:name "test case" ; ] ; sh:property [ a sh:PropertyShape ; sh:path dash:testGraph ; sh:class rdfs:Resource ; sh:description "The graph containing the test case." ; sh:maxCount 1 ; sh:minCount 1 ; sh:name "test graph" ; sh:nodeKind sh:IRI ; ] ; . dash:UniqueValueForClassConstraintComponent-uniqueValueForClass sh:group tosh:ValueConstraintsPropertyGroup ; sh:order "20"^^xsd:decimal ; . dash:ValidationTestCase sh:property tosh:ValidationTestCase-expectedResult ; sh:property tosh:ValidationTestCase-includeSuggestions ; sh:property tosh:ValidationTestCase-validateShapes ; . dash:Widget sh:property tosh:Resource-comment ; sh:property tosh:Resource-label ; . dash:Widget-hidden sh:group tosh:DisplayPropertyGroup ; . <http://spinrdf.org/sp#> tosh:systemNamespace true ; . <http://spinrdf.org/spin#> tosh:systemNamespace true ; . <http://spinrdf.org/spl#> tosh:systemNamespace true ; . <http://topbraid.org/tosh> a owl:Ontology ; dash:generateClass dash:ConstraintReificationShape ; dash:generateClass rdf:Property ; dash:generateClass rdfs:Class ; dash:generateClass rdfs:Datatype ; dash:generateClass owl:Class ; dash:generateClass owl:Ontology ; dash:generateClass sh:ConstraintComponent ; dash:generateClass sh:PropertyGroup ; dash:generateClass sh:Rule ; dash:generateClass sh:Shape ; dash:generatePrefixConstants "dash" ; dash:generatePrefixConstants "owl" ; dash:generatePrefixConstants "rdf" ; dash:generatePrefixConstants "rdfs" ; dash:generatePrefixConstants "sh" ; dash:generatePrefixConstants "xsd" ; rdfs:comment """A collection of SHACL features that are available whenever SHACL graphs are used within TopBraid Suite products. In particular this includes shape definitions for the \"system\" classes such as rdfs:Class, sh:PropertyShape etc. These shapes are used by TopBraid products to validate ontology definitions and to drive user interface forms. The TOSH namespace also includes things like suggestions, Active Data Shapes scripts and a couple of SPARQL functions. Some of these may be of general use outside of TopBraid too.""" ; rdfs:label "TopBraid Data Shapes Library" ; owl:imports <http://datashapes.org/dash> ; sh:declare [ a sh:PrefixDeclaration ; sh:namespace "http://jena.hpl.hp.com/ARQ/function#"^^xsd:anyURI ; sh:prefix "afn" ; ] ; sh:declare [ a sh:PrefixDeclaration ; sh:namespace "http://spinrdf.org/spif#"^^xsd:anyURI ; sh:prefix "spif" ; ] ; sh:declare [ a sh:PrefixDeclaration ; sh:namespace "http://topbraid.org/sparqlmotionfunctions#"^^xsd:anyURI ; sh:prefix "smf" ; ] ; sh:declare [ a sh:PrefixDeclaration ; sh:namespace "http://topbraid.org/tosh#"^^xsd:anyURI ; rdfs:label "Relationship" ; sh:order 8 ; . tosh:ShapeShape rdf:type sh:NodeShape ; rdfs:label "Shape of shapes" ; sh:name "focus node" ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order "5"^^xsd:decimal ; . tosh:ActionTestCase-variables a sh:PropertyShape ; sh:path dash:variables ; sh:datatype xsd:string ; sh:description """A JSON object (string) with name-value pairs for the variable bindings. This must be in the same format as expected by the script servlet. For parameters that declare dash:mimeTypes (i.e. file upload parameters), the value needs to be the path to a file relative to the workspace root. This file will be temporarily uploaded for the duration of the test case execution.""" ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:name "variables" ; sh:order "2"^^xsd:decimal ; . tosh:AdvancedPropertyGroup a sh:PropertyGroup ; rdfs:label "Advanced" ; sh:order "95"^^xsd:decimal ; . tosh:ChangeScript-deactivated a sh:PropertyShape ; sh:path sh:deactivated ; sh:datatype xsd:boolean ; sh:description "True to deactivate this script, for example for testing purposes, without having to delete it." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "deactivated" ; sh:order "10"^^xsd:decimal ; . tosh:ChangeScript-order a sh:PropertyShape ; sh:path sh:order ; sh:description "The relative order of this script compared to other change scripts. The default value is 0. Scripts with lower numbers are executed first." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "order" ; sh:or ( [ sh:datatype xsd:decimal ; ] [ sh:datatype xsd:integer ; ] ) ; sh:order "40"^^xsd:decimal ; . tosh:Class-ShapeScript a dash:ShapeScript ; dash:propertySuggestionGenerator [ rdf:type dash:SPARQLUpdateSuggestionGenerator ; sh:message "Change datatype of the invalid value to the specified sh:datatype" ; sh:update """DELETE { $subject $predicate $object . } return sh.asNodeShape(this); } /** * @callback rdfs_Class_callback * @param {rdfs_Class} class the visited class */ /** * Performs a depth-first traversal this class and its superclasses, visiting each (super) class * once until the callback function returns a non-null/undefined result. This becomes the result of this function. * The order in which sibling classes are traversed is undefined, so results may be inconsistent in * multiple-inheritance scenarios. * @param {rdfs_Class_callback} callback the callback for each class * @param {Set} [reached] the Set of reached URI strings, used internally * @returns the return value of the first callback that returned any value */ walkSuperclasses(callback, reached) { if(!reached) { reached = new Set(); } if(!reached.has(this.uri)) { reached.add(this.uri); let result = callback(this); if(result !== undefined && result !== null) { return result; } let supers = this.superclasses; for(let i = 0; i < supers.length; i++) { result = supers[i].walkSuperclasses(callback, reached); if(result !== undefined && result !== null) { return result; } } } } """ ; . tosh:Class-abstract a sh:PropertyShape ; sh:path dash:abstract ; sh:datatype xsd:boolean ; sh:description "States whether this class is abstract, i.e. cannot have direct instances. Abstract classes are typically used to defined shared properties of its subclasses." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "abstract" ; sh:order "30"^^xsd:decimal ; . tosh:Class-classIcon a sh:PropertyShape ; sh:path tosh:classIcon ; dash:hidden true ; dash:propertyRole dash:IconRole ; sh:datatype xsd:string ; sh:defaultValue "http://datashapes.org/icons/class.svg" ; sh:description "Used to return the default icon for all classes." ; sh:group tosh:DisplayPropertyGroup ; sh:maxCount 1 ; sh:name "class icon" ; sh:order "1"^^xsd:decimal ; . tosh:Class-constructor a sh:PropertyShape ; sh:path dash:constructor ; graphql:name "constructorScript" ; sh:class dash:Constructor ; sh:description "The Constructor that shall be used to create new instances of this class or its subclasses." ; sh:group tosh:ScriptsPropertyGroup ; sh:maxCount 1 ; sh:name "constructor" ; sh:order "20"^^xsd:decimal ; . tosh:Class-disjointWith a sh:PropertyShape ; sh:path owl:disjointWith ; sh:class owl:Class ; sh:group tosh:OWLAxiomsPropertyGroup ; sh:name "disjoint with" ; sh:order "1"^^xsd:decimal ; . tosh:Class-domain-inverse a sh:PropertyShape ; sh:path [ sh:inversePath rdfs:domain ; ] ; dash:editor dash:PropertyAutoCompleteEditor ; sh:class rdf:Property ; sh:description "The properties that declare to have this class in their domain." ; sh:group tosh:RDFSPropertyAxiomsPropertyGroup ; sh:name "domain of" ; sh:nodeKind sh:IRI ; sh:order "0"^^xsd:decimal ; . tosh:Class-equivalentClass a sh:PropertyShape ; sh:path owl:equivalentClass ; sh:class owl:Class ; sh:group tosh:OWLAxiomsPropertyGroup ; rdfs:label "edit widget" ; rdfs:range swa:ObjectEditorClass ; . tosh:hasDatatype rdf:type sh:SPARQLAskValidator ; rdfs:comment "Checks whether a given node ($value) is a literal with a given datatype ($datatype), and that the literal is well-formed." ; sh:order "0"^^xsd:decimal ; . tosh:Class-range-inverse a sh:PropertyShape ; sh:path [ sh:inversePath rdfs:range ; ] ; dash:editor dash:PropertyAutoCompleteEditor ; sh:class rdf:Property ; sh:description "The properties that have this class in their rdfs:range." ; sh:group tosh:RDFSPropertyAxiomsPropertyGroup ; sh:name "range of" ; sh:nodeKind sh:IRI ; sh:order "1"^^xsd:decimal ; . tosh:Class-resourceAction a sh:PropertyShape ; sh:path dash:resourceAction ; graphql:name "resourceActions" ; sh:class dash:ResourceAction ; sh:description "The Resource Actions that can be applied to instances of this class." ; sh:group tosh:ScriptsPropertyGroup ; sh:name "resource actions" ; sh:order "0"^^xsd:decimal ; . tosh:Class-resourceService a sh:PropertyShape ; sh:path dash:resourceService ; graphql:name "resourceServices" ; sh:class dash:ResourceService ; sh:description "The Services that can be applied to instances of this class (as focusNode)." ; sh:group tosh:ScriptsPropertyGroup ; sh:name "resource services" ; sh:order "10"^^xsd:decimal ; . tosh:Class-subClassOf a sh:PropertyShape ; sh:path rdfs:subClassOf ; graphql:name "superclasses" ; sh:class rdfs:Class ; sh:description "The (direct) parent classes of this class." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "superclasses" ; sh:order "20"^^xsd:decimal ; . tosh:Class-subClassOf-inverse a sh:PropertyShape ; sh:path [ sh:inversePath rdfs:subClassOf ; ] ; dash:hidden true ; graphql:name "subclasses" ; sh:class rdfs:Class ; sh:description "The (direct) subclasses of this class." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "subclasses" ; sh:order "21"^^xsd:decimal ; . tosh:ConstraintComponent-localConstraint a sh:PropertyShape ; sh:path dash:localConstraint ; sh:datatype xsd:boolean ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "local constraint" ; sh:order "10"^^xsd:decimal ; . tosh:ConstraintComponent-message rdfs:label "SHACL exists" ; sh:returnType xsd:boolean ; . tosh:systemNamespace rdf:type rdf:Property ; rdfs:comment "Can be used to mark namespace resources (subjects) to count as \"system namespace\" that should be filtered by tosh:SystemNamespaceShape. Search for the usage of this predicate for examples. Anyone can add their own namespaces to their graphs." ; sh:class sh:Validator ; sh:description "The validator(s) used to evaluate a constraint in the context of a node shape." ; sh:group tosh:ImplementationPropertyGroup ; sh:name "node validators" ; sh:order "2"^^xsd:decimal ; . tosh:ConstraintComponent-propertySuggestionGenerator a sh:PropertyShape ; sh:path dash:propertySuggestionGenerator ; sh:class dash:SuggestionGenerator ; sh:group tosh:ImplementationPropertyGroup ; sh:name "property suggestion generators" ; sh:order "20"^^xsd:decimal ; . tosh:ConstraintComponent-propertyValidator a sh:PropertyShape ; sh:path sh:propertyValidator ; sh:class sh:Validator ; sh:description "The validator(s) used to evaluate a constraint in the context of a property shape." ; sh:group tosh:ImplementationPropertyGroup ; sh:name "property validators" ; sh:order "1"^^xsd:decimal ; . tosh:ConstraintComponent-staticConstraint a sh:PropertyShape ; sh:path dash:staticConstraint ; sh:datatype xsd:boolean ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "static constraint" ; sh:order "11"^^xsd:decimal ; . tosh:ConstraintComponent-validator a sh:PropertyShape ; sh:path sh:validator ; sh:class sh:Validator ; sh:description "The validator(s) used to evaluate constraints of either node or property shapes, unless more specific validators are available." ; sh:group tosh:ImplementationPropertyGroup ; sh:name "validators" ; sh:order "0"^^xsd:decimal ; . tosh:DatatypePropertyShapeView a sh:NodeShape ; rdfs:comment "The default view shape for property shapes on datatype values." ; rdfs:label "Attribute view" ; sh:node tosh:PropertyShapeView ; sh:property dash:PrimaryKeyConstraintComponent-uriStart ; sh:property dash:SingleLineConstraintComponent-singleLine ; sh:property tosh:Shape-datatypes ; sh:property sh:LanguageInConstraintComponent-languageIn ; sh:property sh:LessThanConstraintComponent-lessThan ; sh:property sh:LessThanOrEqualsConstraintComponent-lessThanOrEquals ; sh:property sh:MaxExclusiveConstraintComponent-maxExclusive ; sh:property sh:MaxInclusiveConstraintComponent-maxInclusive ; sh:property sh:MaxLengthConstraintComponent-maxLength ; sh:property sh:MinExclusiveConstraintComponent-minExclusive ; sh:property sh:MinInclusiveConstraintComponent-minInclusive ; sh:property sh:MinLengthConstraintComponent-minLength ; sh:property sh:PatternConstraintComponent-flags ; sh:property sh:PatternConstraintComponent-pattern ; sh:property sh:UniqueLangConstraintComponent-uniqueLang ; . tosh:DatatypesViewer a dash:MultiViewer ; dash:hidden true ; rdfs:label "Datatypes viewer" ; . tosh:DefinitionPropertyGroup a sh:PropertyGroup ; rdfs:label "Definition" ; sh:order "0"^^xsd:decimal ; . tosh:DeleteTripleSuggestionGenerator a dash:SPARQLUpdateSuggestionGenerator ; rdfs:comment "Produces a suggestion that would delete the offending value in the validation result from the focus node." ; rdfs:label "Delete triple suggestion generator" ; sh:message "Delete the invalid statement" ; sh:order 100.0 ; sh:update """DELETE { $focusNode $predicate $value . } WHERE { $focusNode $predicate $value . }""" ; . tosh:DependentEnumSelectEditor a dash:SingleEditor ; rdfs:comment """A drop-down editor for enumerated values that are dynamically determined via a node shape that has sh:target dash:HasValueTarget. Example: states:USAddressShape rdf:type sh:NodeShape ; rdfs:label \"US Address shape\" ; sh:property [ rdf:type sh:PropertyShape ; sh:path states:state ; sh:in ( \"AZ\" \"CA\" \"FL\" ) ; ] ; sh:target [ rdf:type dash:HasValueTarget ; dash:object \"USA\" ; dash:predicate states:country ; ] . """ ; rdfs:label "Dependent enum select editor" ; . tosh:DisplayPropertyGroup a sh:PropertyGroup ; rdfs:label "Display" ; sh:order "30"^^xsd:decimal ; . tosh:Function-apiStatus a sh:PropertyShape ; sh:path dash:apiStatus ; sh:class dash:APIStatus ; sh:description "Declares the status of this function within the TopBraid API. The usual life cycle is to start with no value (meaning: not part of the API at all), then experimental from which it later either moves to stable or deprecated. Stable functions may also get deprecated and have no api status after at least one release cycle." ; sh:group tosh:DefinitionPropertyGroup ; sh:in ( dash:Experimental dash:Stable dash:Deprecated ) ; sh:maxCount 1 ; sh:name "API status" ; sh:order "15"^^xsd:decimal ; . tosh:Function-cachable a sh:PropertyShape ; sh:path dash:cachable ; sh:datatype xsd:boolean ; sh:description "True to indicate that this function will always return the same values for the same combination of arguments, regardless of the query graphs. Engines can use this information to cache and reuse previous function calls." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "cachable" ; sh:order "10"^^xsd:decimal ; . tosh:Function-returnType . sh:ClassConstraintComponent dash:propertySuggestionGenerator tosh:DeleteTripleSuggestionGenerator ; . sh:ClassConstraintComponent-class sh:group tosh:ValueTypeConstraintPropertyGroup ; . tosh:FunctionTestCase-expectedResult a sh:PropertyShape ; sh:path dash:expectedResult ; sh:description "The expected result of a function call." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:name "expected result" ; sh:order "10"^^xsd:decimal ; . sh:DatatypeConstraintComponent dash:propertySuggestionGenerator tosh:DeleteTripleSuggestionGenerator ; dash:propertySuggestionGenerator [ rdf:type dash:SPARQLUpdateSuggestionGenerator ; sh:message "Change the datatype of the invalid value to {$datatype}" ; sh:order -2 ; sh:update """DELETE { $focusNode $predicate $value . } a dash:SingleEditor ; rdfs:label "Governance role editor" ; . tosh:GovernanceRoleViewer a dash:SingleViewer ; rdfs:label "Governance role viewer" ; . tosh:GraphStoreTestCase-expectedResult a sh:PropertyShape ; rdf:type dash:SPARQLUpdateSuggestionGenerator ; sh:message "Convert the invalid date/time value into a date value" ; sh:order -1 ; sh:update """DELETE { $subject $predicate $object } . tosh:GraphStoreTestCase-uri a sh:PropertyShape ; sh:path dash:uri ; sh:datatype xsd:anyURI ; sh:description "The URI of the graph to load." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:minCount 1 ; sh:name "uri" ; sh:order "0"^^xsd:decimal ; . tosh:ImplementationPropertyGroup a sh:PropertyGroup ; rdfs:label "Implementation" ; sh:order "10"^^xsd:decimal ; . tosh:IncludedScript-exports a sh:PropertyShape ; sh:path dash:exports ; sh:datatype xsd:string ; sh:description "Declares the symbols that shall be exported from the surrounding module, e.g. for use in Node.js applications." ; sh:group tosh:ImplementationPropertyGroup ; sh:name "exports" ; sh:order "30"^^xsd:decimal ; . tosh:InferenceRulesShape a sh:NodeShape ; rdfs:comment "A node shape for classes and node shapes, declaring the sh:rule property." ; rdfs:label "Inference rules" ; sh:property tosh:InferenceRulesShape-rule ; sh:targetClass sh:NodeShape ; . tosh:InferenceRulesShape-rule a sh:PropertyShape ; sh:path sh:rule ; sh:class sh:Rule ; sh:description "The inference rules associated with this node shape or class." ; sh:group tosh:InferencesPropertyGroup ; sh:name "rule" ; . tosh:InferencesPropertyGroup a sh:PropertyGroup ; rdfs:label "Inferences" ; sh:order "80"^^xsd:decimal ; . tosh:InferencingTestCase-expectedResult a sh:PropertyShape ; . sh:InConstraintComponent dash:propertySuggestionGenerator tosh:DeleteTripleSuggestionGenerator ; dash:propertySuggestionGenerator [ rdf:type dash:SPARQLUpdateSuggestionGenerator ; sh:message "Replace invalid value with {$newObject}" ; a dash:SingleEditor ; rdfs:comment "A drop-down editor for all instances of a class (based on tosh:shapeInGraph/sh:class of the property) in a graph specified using tosh:graph." ; rdfs:label "Instances in graph select editor" ; . tosh:JSTestCase-expectedResult a sh:PropertyShape ; sh:path dash:expectedResult ; sh:description "The expected result of the JavaScript function call, as an RDF node." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:name "expected result" ; . tosh:MemberShapeConstraintComponent a sh:ConstraintComponent ; rdfs:comment "Can be used to specify constraints on the members of a given list, assuming that the given sh:property has rdf:Lists as values. A violation is reported for each member of the list that does not comply with the constraints specified by the given shape." ; rdfs:label "Member shape constraint component" ; sh:parameter tosh:MemberShapeConstraintComponent-memberShape ; sh:propertyValidator [ a sh:SPARQLSelectValidator ; sh:message "List member does not have the shape {$memberShape}" ; sh:prefixes <http://topbraid.org/tosh> ; sh:select """ SELECT DISTINCT $this ?value ?failure ?member WHERE { $this $PATH ?value . ?value rdf:rest*/rdf:first ?member . BIND (tosh:hasShape(?member, $memberShape) AS ?hasShape) . BIND (!bound(?hasShape) AS ?failure) . FILTER (?failure || !?hasShape) . } """ ; ] ; sh:targetClass sh:PropertyShape ; . tosh:MemberShapeConstraintComponent-memberShape a sh:Parameter ; sh:path tosh:memberShape ; sh:class sh:Shape ; sh:description "The shape that the list members must have." ; sh:name "member shape" ; . tosh:ModifyAction-skipPreview a sh:PropertyShape ; sh:path dash:skipPreview ; sh:datatype xsd:boolean ; sh:description "For actions that take no parameters, this can be set to true to skip any means for the user to preview the action. It will instead directly execute the modification." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "skip preview" ; sh:order "11"^^xsd:decimal ; . tosh:MultiFunction-resultVariable a sh:PropertyShape ; sh:path dash:resultVariable ; sh:class sh:Parameter ; sh:description "The result variables." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "result variables" ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order "30"^^xsd:decimal ; . tosh:NodeShape-ShapeScript a dash:ShapeScript ; dash:js """ /** * Returns this class as an instance of rdfs_Class, assuming this node shape is also a class. * @returns {rdfs_Class} */ asClass() { return rdfs.asClass(this); } /** * Gets the \"nearest\" constraint of a given type and a given path property. Deactivated shapes are skipped. * For example, call it with (ex.myProperty, sh.datatype) to find the closest sh:datatype constraint for ex:myProperty. * @param {NamedNode} path the property that is the sh:path of matching property shapes * @param {NamedNode} predicate the property to fetch the nearest value of */ . sh:MaxLengthConstraintComponent dash:propertySuggestionGenerator tosh:DeleteTripleSuggestionGenerator ; dash:propertySuggestionGenerator [ rdf:type dash:SPARQLUpdateSuggestionGenerator ; sh:message "Prune string to only {$maxLength} characters" ; sh:order 1 ; sh:update """DELETE { $focusNode $predicate $value . } } }) } /** * @callback sh_NodeShape_callback * @param {sh_NodeShape} nodeShape the visited node shape */ /** * Performs a depth-first traversal of this and its superclasses (via rdfs:subClassOf) and supershapes (via sh:node), * visiting each (super) shape once until the callback function returns a non-null/undefined result. This becomes the result of this function. * The order in which sibling parents are traversed is undefined. * @param {sh_NodeShape_callback} callback the callback for each shape * @param {Set} [reached] the Set of reached URI strings, used internally but may also be used to terminate at certain supers * @returns the return value of the first callback that returned any value */ walkSupershapes(callback, reached) { if(!reached) { reached = new Set(); } if(!reached.has(this.uri)) { reached.add(this.uri); let result = callback(this); if(result !== undefined && result !== null) { return result; } let superClasses = this.asClass().superclasses; for(let i = 0; i < superClasses.length; i++) { result = superClasses[i].asNodeShape().walkSupershapes(callback, reached); if(result !== undefined && result !== null) { return result; } } let superShapes = this.supershapes; for(let i = 0; i < superShapes.length; i++) { result = superShapes[i].walkSupershapes(callback, reached); if(result !== undefined && result !== null) { return result; } } } } """ ; . tosh:NodeShape-applicableToClass a sh:PropertyShape ; sh:path dash:applicableToClass ; sh:class rdfs:Class ; sh:description "Links a node shape with the classes that it can be applied to." ; sh:group tosh:TargetsPropertyGroup ; sh:name "applicable to classes" ; sh:nodeKind sh:IRI ; sh:order "10"^^xsd:decimal ; . tosh:NodeShape-defaultViewForRole a sh:PropertyShape ; sh:path dash:defaultViewForRole ; dash:editor tosh:GovernanceRoleSelectEditor ; dash:viewer tosh:GovernanceRoleViewer ; sh:description "The user roles that this shape shall be used as default view for." ; sh:group tosh:TargetsPropertyGroup ; sh:name "default view for roles" ; sh:nodeKind sh:IRI ; sh:order "20"^^xsd:decimal ; . tosh:NodeShape-inheritedProperty a sh:PropertyShape ; sh:path tosh:inheritedProperty ; dash:neverMaterialize true ; dash:viewer tosh:PropertyTableViewer ; sh:description "Returns all property shapes that have been declared at \"super-shapes\" (via sh:node) or \"superclasses\" (via rdfs:subClassOf), including the indirect supers, recursively." ; sh:group tosh:PropertiesPropertyGroup ; sh:name "inherited properties" ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order "1"^^xsd:decimal ; sh:values [ sh:path sh:property ; sh:nodes [ sh:minus sh:this ; sh:nodes [ sh:distinct [ sh:path [ sh:oneOrMorePath [ sh:alternativePath ( rdfs:subClassOf sh:node ) ; ] ; ] ; ] ; ] ; ] ; ] ; . tosh:NodeShape-node a sh:PropertyShape ; sh:path sh:node ; graphql:name "supershapes" ; sh:description "The node shapes that this must also conform to, forming a kind of inheritance between shapes similar to a subclass-of relationship." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "node (super shapes)" ; sh:node sh:NodeShape ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order "20"^^xsd:decimal ; . tosh:NodeShape-targetClass a sh:PropertyShape ; sh:path sh:targetClass ; graphql:name "targetClasses" ; sh:class rdfs:Class ; sh:description "The types of instances that this shape is targeted at." ; sh:group tosh:TargetsPropertyGroup ; sh:name "target classes" ; sh:nodeKind sh:IRI ; sh:order "0"^^xsd:decimal ; . tosh:NodeShape-targetObjectsOf a sh:PropertyShape ; sh:path sh:targetObjectsOf ; sh:group tosh:TargetsPropertyGroup ; sh:name "target objects of" ; sh:node rdf:Property ; sh:nodeKind sh:IRI ; sh:order "1"^^xsd:decimal ; . tosh:NodeShape-targetSubjectsOf a sh:PropertyShape ; sh:path sh:targetSubjectsOf ; sh:group tosh:TargetsPropertyGroup ; sh:name "target subjects of" ; sh:node rdf:Property ; sh:nodeKind sh:IRI ; sh:order "2"^^xsd:decimal ; . tosh:NodeShapeConstraintsShape a sh:NodeShape ; rdfs:comment "A shape that can be used to validate the syntax of node shapes, and to enter constraints for node shapes on forms." ; rdfs:label "Node shape constraints" ; sh:property dash:ClosedByTypesConstraintComponent-closedByTypes ; sh:property dash:ScriptConstraintComponent-scriptConstraint ; sh:property dash:SingleLineConstraintComponent-singleLine ; sh:property dash:StemConstraintComponent-stem ; sh:property tosh:Shape-datatypes ; sh:property sh:ClassConstraintComponent-class ; sh:property sh:ClosedConstraintComponent-closed ; sh:property sh:ClosedConstraintComponent-ignoredProperties ; sh:property sh:DatatypeConstraintComponent-datatype ; sh:property sh:HasValueConstraintComponent-hasValue ; sh:property sh:InConstraintComponent-in ; sh:property sh:LanguageInConstraintComponent-languageIn ; sh:group tosh:ComplexConstraintPropertyGroup ; sh:order 12 ; . sh:PatternConstraintComponent-flags tosh:editWidget <http://topbraid.org/tosh.ui#FlagsEditor> ; sh:group tosh:StringBasedConstraintPropertyGroup ; sh:targetClass sh:NodeShape ; . tosh:NumberOfValuesPropertyGroup a sh:PropertyGroup ; rdfs:label "Number of Values" ; sh:order "40"^^xsd:decimal ; . tosh:OWLAxiomsPropertyGroup a sh:PropertyGroup ; rdfs:label "OWL Axioms" ; sh:order "17"^^xsd:decimal ; . tosh:ObjectPropertyShapeView a sh:NodeShape ; rdfs:comment "The default view shape for property shapes on object values." ; rdfs:label "Relationship view" ; sh:node tosh:PropertyShapeView ; sh:property dash:NonRecursiveConstraintComponent-nonRecursive ; sh:property dash:RootClassConstraintComponent-rootClass ; sh:property dash:StemConstraintComponent-stem ; sh:property dash:SymmetricConstraintComponent-symmetric ; sh:property tosh:ObjectPropertyShapeView-node ; sh:property sh:ClassConstraintComponent-class ; sh:property sh:NodeKindConstraintComponent-nodeKind ; . tosh:ObjectPropertyShapeView-node a sh:PropertyShape ; sh:path sh:node ; dash:reifiableBy dash:ConstraintReificationShape ; sh:class sh:NodeShape ; sh:description "The node shape(s) that all values of the property must conform to." ; sh:group tosh:ValueConstraintsPropertyGroup ; sh:name "node" ; sh:order "0"^^xsd:decimal ; . tosh:Ontology-imports a sh:PropertyShape ; sh:path owl:imports ; sh:description "The (directly) imported graphs." ; sh:name "imports" ; sh:nodeKind sh:IRI ; . tosh:Parameterizable-labelTemplate a sh:PropertyShape ; sh:path sh:labelTemplate ; sh:description "Outlines how human-readable labels of instances of the associated Parameterizable shall be produced. The values can contain {?paramName} as placeholders for the actual values of the given parameter." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "label template" ; sh:or dash:StringOrLangString ; sh:order "25"^^xsd:decimal ; . tosh:Parameterizable-parameter a sh:PropertyShape ; sh:path sh:parameter ; sh:class sh:Parameter ; sh:description "The input parameters." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "parameters" ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order "20"^^xsd:decimal ; . tosh:PathStringViewer a dash:MultiViewer ; dash:hidden true ; rdfs:label "Path string viewer" ; . tosh:PropertiesPropertyGroup a sh:PropertyGroup ; rdfs:comment "The declared and inferred properties of a shape or class." ; rdfs:label "Properties" ; sh:order "10"^^xsd:decimal ; . tosh:Property-domain a sh:PropertyShape ; sh:path rdfs:domain ; graphql:name "domains" ; sh:description "The domain(s) of this property." ; sh:group tosh:PropertyAxiomsPropertyGroup ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order "0"^^xsd:decimal ; . tosh:Property-range a sh:PropertyShape ; sh:path rdfs:range ; graphql:name "ranges" ; sh:description "The range(s) of this property." ; sh:group tosh:PropertyAxiomsPropertyGroup ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order "1"^^xsd:decimal ; . tosh:Property-subPropertyOf a sh:PropertyShape ; sh:path rdfs:subPropertyOf ; graphql:name "superproperties" ; sh:class rdf:Property ; sh:description "The (direct) superproperties of this." ; sh:group tosh:PropertyAxiomsPropertyGroup ; sh:name "superproperties" ; sh:nodeKind sh:IRI ; sh:order "2"^^xsd:decimal ; . tosh:Property-subPropertyOf-inverse a sh:PropertyShape ; sh:path [ sh:inversePath rdfs:subPropertyOf ; ] ; graphql:name "subproperties" ; sh:class rdf:Property ; sh:description "The (direct) subproperties of this." ; sh:group tosh:PropertyAxiomsPropertyGroup ; sh:name "subproperties" ; sh:nodeKind sh:IRI ; sh:order "3"^^xsd:decimal ; . tosh:PropertyAxiomsPropertyGroup a sh:PropertyGroup ; rdfs:label "Property Axioms" ; sh:order "1"^^xsd:decimal ; . tosh:PropertyGroup-order a sh:PropertyShape ; sh:path sh:order ; sh:description "The relative order of this group compared to others." ; sh:group tosh:DisplayPropertyGroup ; sh:maxCount 1 ; sh:name "order" ; sh:or ( [ sh:datatype xsd:decimal ; ] [ sh:datatype xsd:integer ; ] ) ; sh:order "0"^^xsd:decimal ; . tosh:PropertyPairConstraintsPropertyGroup a sh:PropertyGroup ; rdfs:label "Property Pair Constraints" ; sh:order "75"^^xsd:decimal ; . tosh:PropertyShape-defaultValue a sh:PropertyShape ; sh:path sh:defaultValue ; dash:readOnly true ; dash:viewer dash:NodeExpressionViewer ; tosh:useDeclaredDatatype true ; sh:description "The default value to be used for this property if no other value has been asserted. This may be a constant value or a SHACL node expression, in which case the values can be derived from other values. Default values are typically inferred and not stored as RDF statements." ; sh:group tosh:InferencesPropertyGroup ; sh:name "default value" ; sh:order "0"^^xsd:decimal ; . tosh:PropertyShape-description a sh:PropertyShape ; sh:path sh:description ; dash:singleLine false ; graphql:name "descriptions" ; sh:description "The description(s) of the property, possibly in multiple languages." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "descriptions" ; sh:nodeKind sh:Literal ; sh:or dash:StringOrLangStringOrHTML ; sh:order "1"^^xsd:decimal ; sh:sparql [ sh:message "Property shapes cannot have both class and datatype constraints." ; sh:prefixes <http://topbraid.org/tosh> ; sh:select """SELECT $this WHERE { FILTER EXISTS { $this sh:class ?class . $this sh:datatype ?datatype . } }""" ; ] ; . tosh:PropertyShape-detailsEndpoint a sh:PropertyShape ; sh:path dash:detailsEndpoint ; sh:datatype xsd:string ; sh:maxCount 1 ; sh:name "details endpoint" ; . tosh:PropertyShape-editor a sh:PropertyShape ; sh:path dash:editor ; dash:editor dash:InstancesSelectEditor ; sh:class dash:Editor ; sh:description "The editor component that should be used to edit values of this property." ; sh:group tosh:DisplayPropertyGroup ; sh:maxCount 1 ; sh:nodeKind sh:IRI ; sh:order "11"^^xsd:decimal ; . tosh:PropertyShape-group a sh:PropertyShape ; sh:path sh:group ; sh:class sh:PropertyGroup ; sh:description "The group that this property belongs to." ; sh:group tosh:DisplayPropertyGroup ; sh:maxCount 1 ; sh:name "group" ; sh:order "0"^^xsd:decimal ; . tosh:PropertyShape-hidden a sh:PropertyShape ; sh:path dash:hidden ; dash:editor dash:BooleanSelectEditor ; sh:datatype xsd:boolean ; sh:description "True to mark this property as hidden in user interface, yet still used in data tasks." ; sh:group tosh:DisplayPropertyGroup ; sh:maxCount 1 ; sh:order "30"^^xsd:decimal ; . tosh:PropertyShape-indexed a sh:PropertyShape ; sh:path dash:indexed ; sh:datatype xsd:boolean ; sh:description "True to indicate that the values of this shall be indexed, forming ordered arrays." ; sh:maxCount 1 ; sh:name "indexed" ; . tosh:PropertyShape-name a sh:PropertyShape ; sh:path sh:name ; dash:singleLine true ; graphql:name "names" ; sh:description "The display names of the property, possibly in multiple languages." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "names" ; sh:nodeKind sh:Literal ; sh:or dash:StringOrLangString ; sh:order "0"^^xsd:decimal ; . tosh:PropertyShape-neverMaterialize a sh:PropertyShape ; sh:path dash:neverMaterialize ; sh:datatype xsd:boolean ; sh:group tosh:InferencesPropertyGroup ; sh:maxCount 1 ; sh:name "never materialize" ; sh:order "11"^^xsd:decimal ; . tosh:PropertyShape-order a sh:PropertyShape ; sh:path sh:order ; sh:description "The relative order of this property shape compared to others." ; sh:group tosh:DisplayPropertyGroup ; sh:maxCount 1 ; sh:name "order" ; sh:or ( [ sh:datatype xsd:decimal ; ] [ sh:datatype xsd:integer ; ] ) ; sh:order "1"^^xsd:decimal ; . tosh:PropertyShape-path a sh:PropertyShape ; sh:path sh:path ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:minCount 1 ; sh:name "path" ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order "31"^^xsd:decimal ; . tosh:PropertyShape-propertyRole a sh:PropertyShape ; sh:path dash:propertyRole ; sh:class dash:PropertyRole ; sh:group tosh:DisplayPropertyGroup ; sh:maxCount 1 ; sh:name "role" ; sh:order "40"^^xsd:decimal ; . tosh:PropertyShape-readOnly a sh:PropertyShape ; sh:path dash:readOnly ; dash:editor dash:BooleanSelectEditor ; dash:viewer dash:NodeExpressionViewer ; sh:datatype xsd:boolean ; sh:description """If set to true then the values of this property should not be editable in the user interface. Note that low-level access such as source code editors may still allow editing, but form-based editors would not. More generally, the values of this property are SHACL node expressions, e.g. function calls, in which case the property counts as read-only if the expression evaluates to true.""" ; sh:group tosh:DisplayPropertyGroup ; sh:maxCount 1 ; sh:order "20"^^xsd:decimal ; . tosh:PropertyShape-values a sh:PropertyShape ; sh:path sh:values ; dash:viewer dash:NodeExpressionViewer ; sh:group tosh:InferencesPropertyGroup ; sh:name "values" ; sh:order "10"^^xsd:decimal ; sh:sparql [ sh:message "sh:values must be accompanied by a sh:path that is an IRI." ; sh:prefixes <http://topbraid.org/tosh> ; sh:select """SELECT $this ?value WHERE { $this $PATH ?value . FILTER NOT EXISTS { $this sh:path ?path . FILTER isIRI(?path) } }""" ; ] ; . tosh:PropertyShape-viewer a sh:PropertyShape ; sh:path dash:viewer ; dash:editor dash:InstancesSelectEditor ; sh:class dash:Viewer ; sh:description "The viewer component that should be used to render values of this property." ; sh:group tosh:DisplayPropertyGroup ; sh:maxCount 1 ; sh:nodeKind sh:IRI ; sh:order "10"^^xsd:decimal ; . tosh:PropertyShapeView a sh:NodeShape ; rdfs:comment "Base view shape for either datatype or object property shapes." ; rdfs:label "Property shape view" ; sh:property dash:CoExistsWithConstraintComponent-coExistsWith ; sh:property dash:IndexedConstraintComponent-indexed ; sh:property dash:ReifiableByConstraintComponent-reifiableBy ; sh:property dash:ScriptConstraintComponent-scriptConstraint ; sh:property dash:SubSetOfConstraintComponent-subSetOf ; sh:property tosh:PropertyShape-defaultValue ; sh:property tosh:PropertyShape-description ; sh:property tosh:PropertyShape-editor ; sh:property tosh:PropertyShape-group ; sh:property tosh:PropertyShape-hidden ; sh:property tosh:PropertyShape-name ; sh:property tosh:PropertyShape-neverMaterialize ; sh:property tosh:PropertyShape-order ; sh:property tosh:PropertyShape-propertyRole ; sh:property tosh:PropertyShape-readOnly ; sh:property tosh:PropertyShape-values ; sh:property tosh:PropertyShape-viewer ; sh:property tosh:PropertyShapeView-message ; sh:property tosh:PropertyShapeView-pathSystemLabel ; sh:property tosh:PropertyShapeView-qualifiedMaxCount ; sh:property tosh:PropertyShapeView-qualifiedMinCount ; sh:property tosh:PropertyShapeView-qualifiedValueShape ; sh:property tosh:PropertyShapeView-qualifiedValueShapesDisjoint ; sh:property tosh:Shape-deactivated ; sh:property tosh:Shape-severity ; sh:property sh:DisjointConstraintComponent-disjoint ; sh:property sh:EqualsConstraintComponent-equals ; sh:property sh:MaxCountConstraintComponent-maxCount ; sh:property sh:MinCountConstraintComponent-minCount ; sh:property sh:SPARQLConstraintComponent-sparql ; . tosh:PropertyShapeView-indexed a sh:PropertyShape ; sh:path dash:indexed ; sh:datatype xsd:boolean ; sh:description "Indicates whether the values are sorted by an index. The user interface will display them in-order." ; sh:group tosh:ReificationPropertyGroup ; sh:maxCount 1 ; sh:name "indexed" ; sh:order "1"^^xsd:decimal ; . tosh:PropertyShapeView-message a sh:PropertyShape ; sh:path sh:message ; sh:description "The message that shall be generated for all constraint violations produced by this property shape." ; sh:group tosh:ValidationPropertyGroup ; sh:name "messages" ; sh:or dash:StringOrLangString ; sh:order "5"^^xsd:decimal ; . tosh:PropertyShapeView-pathSystemLabel a sh:PropertyShape ; sh:path tosh:pathSystemLabel ; dash:neverMaterialize true ; dash:viewer tosh:PathStringViewer ; sh:datatype xsd:string ; sh:description "A display label of the sh:path based on qnames." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "property path" ; sh:order "2"^^xsd:decimal ; sh:values [ sh:else [ <http://uispin.org/ui#label> ( [ sh:path sh:path ; ] ) ; ] ; sh:if [ <http://datashapes.org/sparql#isIRI> ( [ sh:path sh:path ; ] ) ; ] ; sh:then [ <http://topbraid.org/sparqlmotionfunctions#qname> ( [ sh:path sh:path ; ] ) ; ] ; ] ; . tosh:PropertyShapeView-qualifiedMaxCount a sh:PropertyShape ; sh:path sh:qualifiedMaxCount ; sh:datatype xsd:integer ; sh:description "The maximum number of values that may conform to the qualified value shape." ; sh:group tosh:QualifiedCardinalityConstraintsPropertyGroup ; sh:maxCount 1 ; sh:name "qualified max count" ; sh:order "1"^^xsd:decimal ; . tosh:PropertyShapeView-qualifiedMinCount a sh:PropertyShape ; sh:path sh:qualifiedMinCount ; sh:datatype xsd:integer ; sh:description "The minimum number of values that must conform to the qualified value shape." ; sh:group tosh:QualifiedCardinalityConstraintsPropertyGroup ; sh:maxCount 1 ; sh:name "qualified min count" ; sh:order "0"^^xsd:decimal ; . tosh:PropertyShapeView-qualifiedValueShape a sh:PropertyShape ; sh:path sh:qualifiedValueShape ; sh:class sh:NodeShape ; sh:description "The shape that the specified number of values must conform to." ; sh:group tosh:QualifiedCardinalityConstraintsPropertyGroup ; sh:name "qualified value shape" ; sh:order "2"^^xsd:decimal ; . tosh:PropertyShapeView-qualifiedValueShapesDisjoint a sh:PropertyShape ; sh:path sh:qualifiedValueShapesDisjoint ; sh:datatype xsd:boolean ; sh:description "True to treat all qualified values as disjoint." ; sh:group tosh:QualifiedCardinalityConstraintsPropertyGroup ; sh:maxCount 1 ; sh:name "qualified value shapes disjoint" ; sh:order "3"^^xsd:decimal ; . tosh:PropertyTableViewer a dash:MultiViewer ; dash:hidden true ; rdfs:label "Property table viewer" ; . tosh:QualifiedCardinalityConstraintsPropertyGroup a sh:PropertyGroup ; rdfs:comment "The properties in this group are used together to express that a certain number of values must conform to a given shape." ; rdfs:label "Qualified Cardinality Constraints" ; sh:order "77"^^xsd:decimal ; . tosh:QueryTestCase-expectedResult a sh:PropertyShape ; sh:path dash:expectedResult ; dash:singleLine false ; sh:description "The expected result set, as a JSON string." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:name "expected result" ; sh:or ( [ sh:datatype rdf:JSON ; ] [ sh:datatype xsd:string ; ] ) ; . tosh:RDFSOWLClassView a sh:NodeShape ; dash:applicableToClass rdfs:Class ; rdfs:comment "A node shape collecting RDFS and OWL axioms for classes." ; rdfs:label "RDFS/OWL class view" ; sh:property tosh:Class-disjointWith ; sh:property tosh:Class-domain-inverse ; sh:property tosh:Class-equivalentClass ; sh:property tosh:Class-range-inverse ; sh:property tosh:Class-subClassOf ; sh:property tosh:Class-subClassOf-inverse ; sh:property tosh:Resource-comment ; sh:property tosh:Resource-label ; sh:property tosh:Resource-type ; . tosh:RDFSPropertyAxiomsPropertyGroup a sh:PropertyGroup ; rdfs:label "RDFS Property Axioms" ; sh:order "15"^^xsd:decimal ; . tosh:ReferencesPropertyGroup a sh:PropertyGroup ; rdfs:comment "A property group typically used for incoming references or usages."^^rdf:HTML ; rdfs:label "References" ; sh:order "100"^^xsd:decimal ; . tosh:ReificationPropertyGroup a sh:PropertyGroup ; rdfs:label "Reification (Statements about Statements)" ; sh:order "90"^^xsd:decimal ; . tosh:ReplaceWithDefaultValueSuggestionGenerator a dash:SPARQLUpdateSuggestionGenerator ; rdfs:comment "Produces a suggestion to replace all values of the given predicate (which must exist) at the focus node to the default value declared at the shape that has caused the violation. Does nothing if the shape does not declare a sh:defaultValue. Deletes any old value of the property." ; rdfs:label "Replace with default value suggestion generator" ; sh:message "Replace with default value" ; sh:prefixes <http://topbraid.org/tosh> ; sh:select """SELECT ?defaultValue WHERE { GRAPH $shapesGraph { $sourceShape sh:defaultValue ?defaultValue . } }""" ; sh:update """DELETE { $focusNode $predicate ?oldValue . } INSERT { $focusNode $predicate ?defaultValue . } WHERE { $focusNode $predicate ?oldValue . }""" ; . tosh:Resource-comment a sh:PropertyShape ; sh:path rdfs:comment ; dash:propertyRole dash:DescriptionRole ; dash:singleLine false ; graphql:name "comments" ; sh:description "The comments of this, possibly in multiple languages." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "comments" ; sh:or dash:StringOrLangStringOrHTML ; sh:order "1"^^xsd:decimal ; . tosh:Resource-label a sh:PropertyShape ; sh:path rdfs:label ; dash:propertyRole dash:LabelRole ; graphql:name "labels" ; sh:description "The display name(s) of this, possibly in multiple languages." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "labels" ; sh:or dash:StringOrLangString ; sh:order "0"^^xsd:decimal ; . tosh:Resource-type a sh:PropertyShape ; sh:path rdf:type ; graphql:name "types" ; sh:class rdfs:Class ; sh:description "The type(s) of this." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "types" ; sh:order "10"^^xsd:decimal ; . tosh:ResourceAction-jsCondition a sh:PropertyShape ; sh:path dash:jsCondition ; sh:datatype xsd:string ; sh:description "An (ADS) JavaScript expression that will be executed to determine whether the action is applicable to the selected resource in the current context. The variable focusNode can be queried here. The expression needs to return true for the action to be deemed suitable." ; sh:group tosh:ImplementationPropertyGroup ; sh:name "action pre-condition" ; sh:order "25"^^xsd:decimal ; . tosh:ResourceView a sh:NodeShape ; rdfs:comment "A generic view shape that can be used as fallback to display typical resources that have an rdfs:label and an rdfs:comment." ; rdfs:label "Resource view" ; sh:property tosh:Resource-comment ; sh:property tosh:Resource-label ; . tosh:Rule-condition a sh:PropertyShape ; sh:path sh:condition ; sh:description "The pre-conditions that must apply before a rule gets executed. The focus node must conform to all conditions, which must be shapes." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "conditions" ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order "40"^^xsd:decimal ; . tosh:Rule-deactivated a sh:PropertyShape ; sh:path sh:deactivated ; sh:datatype xsd:boolean ; sh:description "True to deactivate the rule so that it will not get executed." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "deactivated" ; sh:order "30"^^xsd:decimal ; . tosh:Rule-order a sh:PropertyShape ; sh:path sh:order ; sh:description "The order of this rule relative to other rules at the same shape. Rules with lower order are executed first. Default value is 0. Rules with the same order cannot \"see\" each other's inferences." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "order" ; sh:or ( [ sh:datatype xsd:decimal ; ] [ sh:datatype xsd:integer ; ] ) ; sh:order "35"^^xsd:decimal ; . tosh:Rule-rule-inverse a sh:PropertyShape ; sh:path [ sh:inversePath sh:rule ; ] ; sh:class sh:Shape ; sh:description "The shapes or classes that the rule is attached to." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "rule of" ; sh:order "20"^^xsd:decimal ; . tosh:SHMinMaxEditor a dash:SingleEditor ; dash:hidden true ; rdfs:comment "An internally used editor for min/max range values of property shapes."^^rdf:HTML ; rdfs:label "SHACL Min Max Editor" ; . tosh:SPARQLAskExecutable-ask a sh:PropertyShape ; sh:path sh:ask ; dash:singleLine false ; sh:datatype xsd:string ; sh:description "The SPARQL ASK query string." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "ask" ; sh:order "1"^^xsd:decimal ; . tosh:SPARQLConstraint-deactivated a sh:PropertyShape ; sh:path sh:deactivated ; sh:datatype xsd:boolean ; sh:description "True to deactive this constraint." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "deactivated" ; sh:order "30"^^xsd:decimal ; . tosh:SPARQLConstraint-message a sh:PropertyShape ; sh:path sh:message ; sh:description "The message(s) that should be produced for constraint violations. The messages may contain placeholders such as {$value} for any variable returned in the SELECT clause of the SPARQL query." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "messages" ; sh:or dash:StringOrLangString ; sh:order "20"^^xsd:decimal ; . tosh:SPARQLConstructExecutable-construct a sh:PropertyShape ; sh:path sh:construct ; dash:singleLine false ; sh:datatype xsd:string ; sh:description "The SPARQL CONSTRUCT query string." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "construct" ; sh:order "1"^^xsd:decimal ; . tosh:SPARQLExecutable-prefixes a sh:PropertyShape ; sh:path sh:prefixes ; sh:class owl:Ontology ; sh:description "The Ontology declaring the SHACL prefix declarations to use for the SPARQL query." ; sh:group tosh:ImplementationPropertyGroup ; sh:name "prefixes" ; sh:order "0"^^xsd:decimal ; . tosh:SPARQLSelectExecutable-select a sh:PropertyShape ; sh:path sh:select ; dash:singleLine false ; sh:datatype xsd:string ; sh:description "The SPARQL SELECT query string." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "select" ; sh:order "1"^^xsd:decimal ; . tosh:SPARQLUpdateExecutable-update a sh:PropertyShape ; sh:path sh:update ; dash:singleLine false ; sh:datatype xsd:string ; sh:description "The SPARQL UPDATE request string." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "update" ; sh:order "1"^^xsd:decimal ; . tosh:Script-js a sh:PropertyShape ; sh:path dash:js ; sh:datatype xsd:string ; sh:description "The implementation as JavaScript." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "JavaScript code" ; sh:order "20"^^xsd:decimal ; . tosh:Script-onAllValues a sh:PropertyShape ; sh:path dash:onAllValues ; sh:datatype xsd:boolean ; sh:description "If true then all value nodes will be available to the script at once, through the variable \"values\"." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "on all values" ; sh:order "0"^^xsd:decimal ; . tosh:ScriptConstraint-deactivated a sh:PropertyShape ; sh:path sh:deactivated ; sh:datatype xsd:boolean ; sh:description "True to deactivate this constraint." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "deactivated" ; sh:order "30"^^xsd:decimal ; . tosh:ScriptConstraint-message a sh:PropertyShape ; sh:path sh:message ; sh:description "The message(s) to use for violations produced by this script." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "messages" ; sh:or dash:StringOrLangString ; sh:order "20"^^xsd:decimal ; . tosh:ScriptFunction-canWrite a sh:PropertyShape ; sh:path dash:canWrite ; sh:datatype xsd:boolean ; sh:description "True to allow this function to have side effects. By default, functions are not permitted to modify the graph as this would violate SPARQL contracts. However, if canWrite is true then the function will not be available as a SPARQL function and only be injected into the generated API in read/write mode." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "can write" ; sh:order "15"^^xsd:decimal ; . tosh:ScriptTestCase-expectedResult a sh:PropertyShape ; sh:path dash:expectedResult ; sh:description "The expected result of the evaluation, as JSON object as produced by the servlet, or true or false." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:name "expected result" ; sh:or ( [ sh:datatype rdf:JSON ; ] [ sh:datatype xsd:boolean ; ] ) ; sh:order "0"^^xsd:decimal ; . tosh:ScriptTestCase-focusNode a sh:PropertyShape ; sh:path dash:focusNode ; sh:description "The selected resource, which will become value of focusNode for the script, with its \"most suitable\" JavaScript class as type. Defaults to the test case itself." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:name "focus node" ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order "10"^^xsd:decimal ; . tosh:ScriptsPropertyGroup a sh:PropertyGroup ; rdfs:comment "Scripts based on Active Data Shapes." ; rdfs:label "Scripts" ; sh:order "30"^^xsd:decimal ; . tosh:Service-canWrite a sh:PropertyShape ; sh:path dash:canWrite ; sh:datatype xsd:boolean ; sh:description "True if this service can modify the data, i.e. it will execute in read/write mode. By default, all services are read-only." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "can write" ; . tosh:Service-deactivated a sh:PropertyShape ; sh:path sh:deactivated ; sh:datatype xsd:boolean ; sh:description "True to deactivate this service." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "deactivated" ; sh:order "30"^^xsd:decimal ; . tosh:Service-responseContentType a sh:PropertyShape ; sh:path dash:responseContentType ; sh:datatype xsd:string ; sh:description "The content type (mime type) of the service response, defaulting to \"application/json\". Use \"void\" to return nothing." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "response content type" ; sh:order "10"^^xsd:decimal ; . tosh:SetToDefaultValueSuggestionGenerator a dash:SPARQLUpdateSuggestionGenerator ; rdfs:comment "Produces a suggestion to set the given predicate at the focus node to the default value declared at the shape that has caused the violation. Does nothing if the shape does not declare a sh:defaultValue. Deletes any old value of the property." ; rdfs:label "Set to default value suggestion generator" ; sh:message "Set to default value" ; sh:prefixes <http://topbraid.org/tosh> ; sh:select """SELECT ?defaultValue WHERE { GRAPH $shapesGraph { $sourceShape sh:defaultValue ?defaultValue . } }""" ; sh:update """DELETE { $focusNode $predicate ?oldValue . } INSERT { $focusNode $predicate ?defaultValue . } WHERE { OPTIONAL { $focusNode $predicate ?oldValue . } }""" ; . tosh:Shape-datatypes a sh:PropertyShape ; sh:path tosh:datatypes ; dash:neverMaterialize true ; dash:viewer tosh:DatatypesViewer ; sh:description "Zero of more datatypes that value nodes can take. In SHACL, the typical pattern is to either use a single sh:datatype or a sh:or of multiple sh:datatype constraints. This inferred property here provides a unified way to access these two design patterns." ; sh:group tosh:TypeOfValuesPropertyGroup ; sh:name "datatypes" ; sh:nodeKind sh:IRI ; sh:order "0"^^xsd:decimal ; sh:values [ sh:union ( [ sh:path sh:datatype ; ] [ sh:path ( sh:or [ sh:zeroOrMorePath rdf:rest ; ] rdf:first sh:datatype ) ; ] ) ; ] ; . tosh:Shape-deactivated a sh:PropertyShape ; sh:path sh:deactivated ; sh:datatype xsd:boolean ; sh:description "True to deactivate this shape, making it literally invisible and without any effect." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "deactivated" ; sh:order "30"^^xsd:decimal ; . tosh:Shape-severity a sh:PropertyShape ; sh:path sh:severity ; dash:editor dash:InstancesSelectEditor ; sh:class sh:Severity ; sh:description "The severity to be used for validation results produced by the constraints." ; sh:group tosh:ValidationPropertyGroup ; sh:maxCount 1 ; sh:name "severity" ; sh:order "0"^^xsd:decimal ; . tosh:ShapeInGraphConstraintComponent a sh:ConstraintComponent ; dash:propertySuggestionGenerator tosh:DeleteTripleSuggestionGenerator ; rdfs:comment """A constraint component that can be used to verify that the value nodes have a given shape, where the shape validation is executed in a given graph. This can, for example, be used to verify that a given value is declared as an instance of a given class in some specified (not imported) graph. A typical design pattern is as follows: ex:NodeShape sh:property [ sh:path ex:myProperty ; sh:nodeKind sh:IRI ; tosh:graph <http://example.org/externalGraph> ; tosh:shapeInGraph [ sh:class ex:ExternalClass ; ] ; tosh:editor tosh:InstancesInGraphSelectEditor ; tosh:viewer tosh:URIInGraphViewer ; ] .""" ; rdfs:label "Shape in graph constraint component" ; sh:labelTemplate "Values must have shape {$shapeInGraph} defined in graph {$graph}" ; sh:message "Value does not have shape {$shapeInGraph} defined in graph {$graph}" ; sh:parameter [ a sh:Parameter ; sh:path tosh:graph ; sh:nodeKind sh:IRI ; ] ; sh:parameter [ a sh:Parameter ; sh:path tosh:shapeInGraph ; sh:nodeKind sh:BlankNodeOrIRI ; ] ; sh:validator [ a sh:SPARQLAskValidator ; sh:ask """ASK { GRAPH $graph { FILTER tosh:hasShape($value, $shapeInGraph) } }""" ; sh:prefixes <http://topbraid.org/tosh> ; ] ; . tosh:StringConstraintsPropertyGroup a sh:PropertyGroup ; rdfs:label "String Constraints" ; sh:order "70"^^xsd:decimal ; . tosh:SystemNamespaceShape a sh:NodeShape ; rdfs:comment "A shape that detects whether the focus node is a URI that has a namespace from one of the system namespaces - RDF, RDFS, OWL etc. The list of actual system namespaces is represented via tosh:systemNamespace true triples." ; rdfs:label "System namespace shape" ; sh:sparql [ a sh:SPARQLConstraint ; sh:message "Not a IRI from a system namespace" ; sh:prefixes <http://topbraid.org/tosh> ; sh:select """SELECT $this WHERE { FILTER (!isIRI($this) || (isIRI($this) && EXISTS { BIND (IRI(afn:namespace($this)) AS ?ns) . FILTER NOT EXISTS { ?ns tosh:systemNamespace true } . } )) . }""" ; ] ; . tosh:TargetsPropertyGroup a sh:PropertyGroup ; rdfs:label "Targets" ; sh:order "5"^^xsd:decimal ; . tosh:TeamworkPlatform a dash:ExecutionPlatform ; dash:includedExecutionPlatform tosh:TopBraidPlatform ; rdfs:comment "The platform consisting of TopBraid plus any teamwork features used by TopBraid EDG." ; rdfs:label "Teamwork platform" ; . tosh:TestCase-deactivated a sh:PropertyShape ; sh:path sh:deactivated ; sh:datatype xsd:boolean ; sh:description "If set to true, this test case will be skipped." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:name "deactivated" ; sh:order "50"^^xsd:decimal ; . tosh:TestPropertiesPropertyGroup a sh:PropertyGroup ; rdfs:label "Test Properties" ; sh:order "20"^^xsd:decimal ; . tosh:TopBraidPlatform a dash:ExecutionPlatform ; rdfs:comment "The platform consisting of TopBraid." ; rdfs:label "TopBraid platform" ; . tosh:TripleRule-object a sh:PropertyShape ; sh:path sh:object ; dash:viewer dash:NodeExpressionViewer ; sh:description "The node expression producing the object(s) of the triple inferred by the rule." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:minCount 1 ; sh:name "object" ; sh:order 2 ; . tosh:TripleRule-predicate a sh:PropertyShape ; sh:path sh:predicate ; dash:viewer dash:NodeExpressionViewer ; sh:description "The node expression producing the predicate(s) of the triple inferred by the rule." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:minCount 1 ; sh:name "predicate" ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order 1 ; . tosh:TripleRule-subject a sh:PropertyShape ; sh:path sh:subject ; dash:viewer dash:NodeExpressionViewer ; sh:description "The node expression producing the subject(s) of the triple inferred by the rule." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:minCount 1 ; sh:name "subject" ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order 0 ; . tosh:TypeOfValuesPropertyGroup a sh:PropertyGroup ; rdfs:label "Type of Values" ; sh:order "50"^^xsd:decimal ; . tosh:URIInGraphViewer a dash:SingleViewer ; rdfs:comment "A viewer for URI resources that have their data in a given graph that may be outside of the imports closure. The graph must be specified using a tosh:graph constraint for the property." ; rdfs:label "URI in graph viewer" ; . tosh:UseDeclaredDatatypeConstraintComponent a sh:ConstraintComponent ; dash:propertySuggestionGenerator [ a dash:SPARQLUpdateSuggestionGenerator ; sh:message "Change datatype of the invalid value to the specified sh:datatype" ; sh:prefixes <http://topbraid.org/tosh> ; sh:update """DELETE { $subject $predicate $object . } INSERT { $subject $predicate ?newObject . } WHERE { $subject sh:datatype ?datatype . BIND (spif:cast(?object, ?datatype) AS ?newObject) . }""" ; ] ; rdfs:comment "Constrains the value nodes to be either non-literals or literals that have the same datatype as the declared sh:datatype for the given constraint node. This is used, among others, in properties such as sh:hasValue and sh:minExclusive." ; rdfs:label "Use declared datatype constraint component" ; sh:parameter [ a sh:Parameter ; sh:path tosh:useDeclaredDatatype ; sh:datatype xsd:boolean ; sh:description "True to state that the datatype of literal values must be the same as the declared sh:datatype." ; sh:name "use declared datatype" ; ] ; sh:propertyValidator [ a sh:SPARQLSelectValidator ; sh:message "Datatype must match the declared datatype " ; sh:prefixes <http://topbraid.org/tosh> ; sh:select """ SELECT DISTINCT $this ?value ?datatype WHERE { { FILTER ($useDeclaredDatatype) } $this sh:datatype ?datatype . $this $PATH ?value . FILTER (isLiteral(?value) && datatype(?value) != ?datatype) . }""" ; ] ; sh:targetClass sh:PropertyShape ; . tosh:ValidationPropertyGroup a sh:PropertyGroup ; rdfs:label "Validation" ; sh:order "30"^^xsd:decimal ; . tosh:ValidationTestCase-expectedResult a sh:PropertyShape ; sh:path dash:expectedResult ; sh:description "The expected validation report, either as instance of sh:ValidationReport or a Turtle string with one instance of sh:ValidationReport in it when parsed." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:name "expected result" ; sh:or ( [ sh:datatype xsd:string ; ] [ sh:class sh:ValidationReport ; ] ) ; sh:order "10"^^xsd:decimal ; . tosh:ValidationTestCase-includeSuggestions a sh:PropertyShape ; sh:path dash:includeSuggestions ; sh:datatype xsd:boolean ; sh:description "True to also generate and verify suggestions." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:name "include suggestions" ; sh:order "0"^^xsd:decimal ; . tosh:ValidationTestCase-validateShapes a sh:PropertyShape ; sh:path dash:validateShapes ; sh:datatype xsd:boolean ; sh:description "True to also validate shapes themselves." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:name "validate shapes" ; sh:order "5"^^xsd:decimal ; . tosh:ValueConstraintsPropertyGroup a sh:PropertyGroup ; rdfs:label "Value Constraints" ; sh:order "60"^^xsd:decimal ; . tosh:ValueRangePropertyGroup a sh:PropertyGroup ; rdfs:label "Value Range" ; sh:order "60"^^xsd:decimal ; . tosh:countShapesWithMatchResult a sh:SPARQLFunction ; rdfs:comment "Counts the number of shapes from a given rdf:List (?arg2) defined in a given shapes graph (?arg3) where tosh:hasShape returns the provided match value (true or false, ?arg4) for a given focus node (?arg1). The function produces a failure if one of the shapes validated to a failure." ; rdfs:label "count shapes with match result" ; sh:parameter [ a sh:Parameter ; sh:path sh:expectedValue ; sh:datatype xsd:boolean ; sh:description "The expected value of tosh:hasShape to count." ; sh:order 3.0 ; ] ; sh:parameter [ a sh:Parameter ; sh:path sh:focusNode ; sh:class rdfs:Resource ; sh:description "The focus node." ; sh:order 0.0 ; ] ; sh:parameter [ a sh:Parameter ; sh:path sh:shapes ; sh:class rdf:List ; sh:description "The list of shapes to walk through." ; sh:order 1.0 ; ] ; sh:parameter [ a sh:Parameter ; sh:path sh:shapesGraph ; sh:class rdfs:Resource ; sh:description "The shapes graph." ; sh:order 2.0 ; ] ; sh:prefixes <http://topbraid.org/tosh> ; sh:returnType xsd:integer ; sh:select """ # The SUM will fail with an error if one of the operands is not a number # (this mechanism is used to propagate errors from tosh:hasShape calls) SELECT (SUM(?s) AS ?result) WHERE { GRAPH $shapesGraph { $shapes rdf:rest*/rdf:first ?shape . } BIND (tosh:hasShape($focusNode, ?shape, true) AS ?hasShape) . BIND (IF(bound(?hasShape), IF(?hasShape = $expectedValue, 1, 0), 'error') AS ?s) . } """ ; . tosh:editGroupDescription a rdf:Property ; rdfs:comment "A description of the property group when in \"edit\" mode." ; rdfs:domain sh:PropertyGroup ; rdfs:label "edit group description" ; rdfs:range xsd:string ; . tosh:graph a rdf:Property ; rdfs:comment "The graph that the shape is validated in." ; rdfs:label "graph" ; . tosh:hasDatatype a sh:SPARQLAskValidator ; rdfs:comment "Checks whether a given node ($value) is a literal with a given datatype ($datatype), and that the literal is well-formed." ; rdfs:label "has datatype" ; sh:ask """ ASK { FILTER (datatype($value) = $datatype && spif:isValidForDatatype($value, $datatype)) . } """ ; sh:prefixes <http://topbraid.org/tosh> ; . tosh:hasShape a sh:Function ; dash:apiStatus dash:Experimental ; rdfs:comment """A built-in function of the TopBraid SHACL implementation. Can be used to validate a given (focus) node against a given shape, returning <code>true</code> if the node is valid. If executed within a SHACL validation engine, this uses the shapes graph that was provided when the engine started. If executed in other contexts, e.g. in a stand-alone SPARQL query, the function attempts to use the URI of the current default graph as the shapes graph. This may not always be supported. If called from within an SWP engine, the shapes graph is the current query graph."""^^rdf:HTML ; rdfs:label "has shape" ; sh:parameter [ a sh:Parameter ; sh:path tosh:node ; sh:description "The node to validate." ; ] ; sh:parameter [ a sh:Parameter ; sh:path tosh:shape ; sh:description "The shape that the node is supposed to have." ; ] ; sh:returnType xsd:boolean ; . tosh:isHiddenClass a sh:SPARQLFunction ; dash:apiStatus dash:Experimental ; rdfs:comment "Checks if a given resource is supposed to be hidden in typical class displays. This applies to owl:Nothing, owl:NamedIndividual and owl:Restriction and any class that has dash:hidden true." ; rdfs:label "is hidden class" ; sh:ask """ASK { ?resource dash:hidden true . }""" ; sh:parameter [ a sh:Parameter ; sh:path tosh:resource ; sh:description "The node to check." ; sh:name "resource" ; sh:nodeKind sh:BlankNodeOrIRI ; ] ; sh:prefixes <http://topbraid.org/tosh> ; sh:returnType xsd:boolean ; . tosh:isInTargetOf a sh:Function ; dash:apiStatus dash:Experimental ; rdfs:comment "Checks whether a given node is in the target of
102
Misc clean up, updates to dash and tosh files
0
.ttl
ttl
apache-2.0
TopQuadrant/shacl
367
<NME> tosh.ttl <BEF> # baseURI: http://topbraid.org/tosh # imports: http://datashapes.org/dash # prefix: tosh @prefix dash: <http://datashapes.org/dash#> . @prefix graphql: <http://datashapes.org/graphql#> . @prefix owl: <http://www.w3.org/2002/07/owl#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix sh: <http://www.w3.org/ns/shacl#> . @prefix swa: <http://topbraid.org/swa#> . @prefix tosh: <http://topbraid.org/tosh#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . dash: tosh:systemNamespace true ; . dash:Action sh:property tosh:Action-actionGroup ; sh:property tosh:Action-actionIconClass ; sh:property tosh:Action-deactivated ; . dash:ActionGroup sh:property tosh:ActionGroup-order ; sh:property tosh:Resource-comment ; sh:property tosh:Resource-label ; . dash:ActionTestCase sh:property tosh:ActionTestCase-action ; sh:property tosh:ActionTestCase-expectedResult ; sh:property tosh:ActionTestCase-focusNode ; sh:property tosh:ActionTestCase-variables ; . dash:ChangeScript sh:property tosh:ChangeScript-deactivated ; sh:property tosh:ChangeScript-order ; . dash:ClosedByTypesConstraintComponent-closedByTypes sh:group tosh:ValidationPropertyGroup ; . dash:CoExistsWithConstraintComponent-coExistsWith sh:group tosh:PropertyPairConstraintsPropertyGroup ; sh:order "0"^^xsd:decimal ; . dash:DetailsEditor dash:hidden true ; owl:versionInfo "This is not yet supported by TopBraid." ; . dash:FunctionTestCase sh:property tosh:FunctionTestCase-expectedResult ; sh:property tosh:FunctionTestCase-expression ; . dash:GraphStoreTestCase sh:property tosh:GraphStoreTestCase-expectedResult ; sh:property tosh:GraphStoreTestCase-uri ; . dash:IndexedConstraintComponent-indexed sh:group tosh:ReificationPropertyGroup ; sh:order "1"^^xsd:decimal ; . dash:InferencingTestCase sh:property tosh:InferencingTestCase-expectedResult ; sh:namespace "http://spinrdf.org/spif#"^^xsd:anyURI ; sh:prefix "spif" ; ] ; sh:declare [ rdf:type sh:PrefixDeclaration ; sh:namespace "http://topbraid.org/tosh#"^^xsd:anyURI ; dash:NonRecursiveConstraintComponent-nonRecursive sh:group tosh:ValueConstraintsPropertyGroup ; sh:order "5"^^xsd:decimal ; . dash:PrimaryKeyConstraintComponent-uriStart sh:group tosh:StringConstraintsPropertyGroup ; sh:order "40"^^xsd:decimal ; . dash:PropertyRole sh:property tosh:Resource-comment ; sh:property tosh:Resource-label ; . dash:QueryTestCase sh:property tosh:QueryTestCase-expectedResult ; . . tosh:ComplexConstraintPropertyGroup rdf:type sh:PropertyGroup ; tosh:openable "true"^^xsd:boolean ; rdfs:label "Complex Constraints" ; sh:order 9 ; dash:RootClassConstraintComponent dash:propertySuggestionGenerator tosh:DeleteTripleSuggestionGenerator ; . dash:RootClassConstraintComponent-rootClass . tosh:DeleteTripleSuggestionGenerator rdf:type dash:SPARQLUpdateSuggestionGenerator ; rdfs:label "Delete triple suggestion generator" ; sh:message "Delete the invalid statement" ; sh:update """DELETE { $focusNode $predicate $value . } WHERE { }""" ; . tosh:DisplayPropertyGroup . dash:ScriptConstraint sh:property tosh:Script-onAllValues ; sh:property tosh:ScriptConstraint-deactivated ; sh:property tosh:ScriptConstraint-message ; . dash:ScriptConstraintComponent-scriptConstraint sh:group tosh:AdvancedPropertyGroup ; sh:order "20"^^xsd:decimal ; . dash:ScriptFunction sh:property tosh:ScriptFunction-canWrite ; . dash:ScriptTestCase sh:property tosh:ScriptTestCase-expectedResult ; sh:property tosh:ScriptTestCase-focusNode ; . dash:ScriptValidator sh:property tosh:Script-onAllValues ; . dash:Service sh:property tosh:Service-canWrite ; sh:property tosh:Service-deactivated ; sh:property tosh:Service-responseContentType ; . dash:StemConstraintComponent-stem sh:group tosh:StringConstraintsPropertyGroup ; sh:order "45"^^xsd:decimal ; . dash:SubSetOfConstraintComponent-subSetOf sh:group tosh:PropertyPairConstraintsPropertyGroup ; sh:order "20"^^xsd:decimal ; . dash:SymmetricConstraintComponent dash:propertySuggestionGenerator tosh:DeleteTripleSuggestionGenerator ; dash:propertySuggestionGenerator [ a dash:SPARQLUpdateSuggestionGenerator ; sh:message "Add symmetric value." ; sh:order "0"^^xsd:decimal ; sh:prefixes <http://topbraid.org/tosh> ; sh:update """INSERT { $value $predicate $focusNode . } WHERE { }""" ; ] ; . dash:SymmetricConstraintComponent-symmetric sh:group tosh:ValueConstraintsPropertyGroup ; sh:order "10"^^xsd:decimal ; . dash:TestCase sh:property tosh:TestCase-deactivated ; . dash:TestCaseResult sh:property [ a sh:PropertyShape ; sh:path dash:testCase ; sh:class dash:TestCase ; sh:description "The dash:TestCase that was executed." ; sh:maxCount 1 ; sh:minCount 1 ; sh:name "test case" ; ] ; sh:property [ a sh:PropertyShape ; sh:path dash:testGraph ; sh:class rdfs:Resource ; sh:description "The graph containing the test case." ; sh:maxCount 1 ; sh:minCount 1 ; sh:name "test graph" ; sh:nodeKind sh:IRI ; ] ; . dash:UniqueValueForClassConstraintComponent-uniqueValueForClass sh:group tosh:ValueConstraintsPropertyGroup ; sh:order "20"^^xsd:decimal ; . dash:ValidationTestCase sh:property tosh:ValidationTestCase-expectedResult ; sh:property tosh:ValidationTestCase-includeSuggestions ; sh:property tosh:ValidationTestCase-validateShapes ; . dash:Widget sh:property tosh:Resource-comment ; sh:property tosh:Resource-label ; . dash:Widget-hidden sh:group tosh:DisplayPropertyGroup ; . <http://spinrdf.org/sp#> tosh:systemNamespace true ; . <http://spinrdf.org/spin#> tosh:systemNamespace true ; . <http://spinrdf.org/spl#> tosh:systemNamespace true ; . <http://topbraid.org/tosh> a owl:Ontology ; dash:generateClass dash:ConstraintReificationShape ; dash:generateClass rdf:Property ; dash:generateClass rdfs:Class ; dash:generateClass rdfs:Datatype ; dash:generateClass owl:Class ; dash:generateClass owl:Ontology ; dash:generateClass sh:ConstraintComponent ; dash:generateClass sh:PropertyGroup ; dash:generateClass sh:Rule ; dash:generateClass sh:Shape ; dash:generatePrefixConstants "dash" ; dash:generatePrefixConstants "owl" ; dash:generatePrefixConstants "rdf" ; dash:generatePrefixConstants "rdfs" ; dash:generatePrefixConstants "sh" ; dash:generatePrefixConstants "xsd" ; rdfs:comment """A collection of SHACL features that are available whenever SHACL graphs are used within TopBraid Suite products. In particular this includes shape definitions for the \"system\" classes such as rdfs:Class, sh:PropertyShape etc. These shapes are used by TopBraid products to validate ontology definitions and to drive user interface forms. The TOSH namespace also includes things like suggestions, Active Data Shapes scripts and a couple of SPARQL functions. Some of these may be of general use outside of TopBraid too.""" ; rdfs:label "TopBraid Data Shapes Library" ; owl:imports <http://datashapes.org/dash> ; sh:declare [ a sh:PrefixDeclaration ; sh:namespace "http://jena.hpl.hp.com/ARQ/function#"^^xsd:anyURI ; sh:prefix "afn" ; ] ; sh:declare [ a sh:PrefixDeclaration ; sh:namespace "http://spinrdf.org/spif#"^^xsd:anyURI ; sh:prefix "spif" ; ] ; sh:declare [ a sh:PrefixDeclaration ; sh:namespace "http://topbraid.org/sparqlmotionfunctions#"^^xsd:anyURI ; sh:prefix "smf" ; ] ; sh:declare [ a sh:PrefixDeclaration ; sh:namespace "http://topbraid.org/tosh#"^^xsd:anyURI ; rdfs:label "Relationship" ; sh:order 8 ; . tosh:ShapeShape rdf:type sh:NodeShape ; rdfs:label "Shape of shapes" ; sh:name "focus node" ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order "5"^^xsd:decimal ; . tosh:ActionTestCase-variables a sh:PropertyShape ; sh:path dash:variables ; sh:datatype xsd:string ; sh:description """A JSON object (string) with name-value pairs for the variable bindings. This must be in the same format as expected by the script servlet. For parameters that declare dash:mimeTypes (i.e. file upload parameters), the value needs to be the path to a file relative to the workspace root. This file will be temporarily uploaded for the duration of the test case execution.""" ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:name "variables" ; sh:order "2"^^xsd:decimal ; . tosh:AdvancedPropertyGroup a sh:PropertyGroup ; rdfs:label "Advanced" ; sh:order "95"^^xsd:decimal ; . tosh:ChangeScript-deactivated a sh:PropertyShape ; sh:path sh:deactivated ; sh:datatype xsd:boolean ; sh:description "True to deactivate this script, for example for testing purposes, without having to delete it." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "deactivated" ; sh:order "10"^^xsd:decimal ; . tosh:ChangeScript-order a sh:PropertyShape ; sh:path sh:order ; sh:description "The relative order of this script compared to other change scripts. The default value is 0. Scripts with lower numbers are executed first." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "order" ; sh:or ( [ sh:datatype xsd:decimal ; ] [ sh:datatype xsd:integer ; ] ) ; sh:order "40"^^xsd:decimal ; . tosh:Class-ShapeScript a dash:ShapeScript ; dash:propertySuggestionGenerator [ rdf:type dash:SPARQLUpdateSuggestionGenerator ; sh:message "Change datatype of the invalid value to the specified sh:datatype" ; sh:update """DELETE { $subject $predicate $object . } return sh.asNodeShape(this); } /** * @callback rdfs_Class_callback * @param {rdfs_Class} class the visited class */ /** * Performs a depth-first traversal this class and its superclasses, visiting each (super) class * once until the callback function returns a non-null/undefined result. This becomes the result of this function. * The order in which sibling classes are traversed is undefined, so results may be inconsistent in * multiple-inheritance scenarios. * @param {rdfs_Class_callback} callback the callback for each class * @param {Set} [reached] the Set of reached URI strings, used internally * @returns the return value of the first callback that returned any value */ walkSuperclasses(callback, reached) { if(!reached) { reached = new Set(); } if(!reached.has(this.uri)) { reached.add(this.uri); let result = callback(this); if(result !== undefined && result !== null) { return result; } let supers = this.superclasses; for(let i = 0; i < supers.length; i++) { result = supers[i].walkSuperclasses(callback, reached); if(result !== undefined && result !== null) { return result; } } } } """ ; . tosh:Class-abstract a sh:PropertyShape ; sh:path dash:abstract ; sh:datatype xsd:boolean ; sh:description "States whether this class is abstract, i.e. cannot have direct instances. Abstract classes are typically used to defined shared properties of its subclasses." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "abstract" ; sh:order "30"^^xsd:decimal ; . tosh:Class-classIcon a sh:PropertyShape ; sh:path tosh:classIcon ; dash:hidden true ; dash:propertyRole dash:IconRole ; sh:datatype xsd:string ; sh:defaultValue "http://datashapes.org/icons/class.svg" ; sh:description "Used to return the default icon for all classes." ; sh:group tosh:DisplayPropertyGroup ; sh:maxCount 1 ; sh:name "class icon" ; sh:order "1"^^xsd:decimal ; . tosh:Class-constructor a sh:PropertyShape ; sh:path dash:constructor ; graphql:name "constructorScript" ; sh:class dash:Constructor ; sh:description "The Constructor that shall be used to create new instances of this class or its subclasses." ; sh:group tosh:ScriptsPropertyGroup ; sh:maxCount 1 ; sh:name "constructor" ; sh:order "20"^^xsd:decimal ; . tosh:Class-disjointWith a sh:PropertyShape ; sh:path owl:disjointWith ; sh:class owl:Class ; sh:group tosh:OWLAxiomsPropertyGroup ; sh:name "disjoint with" ; sh:order "1"^^xsd:decimal ; . tosh:Class-domain-inverse a sh:PropertyShape ; sh:path [ sh:inversePath rdfs:domain ; ] ; dash:editor dash:PropertyAutoCompleteEditor ; sh:class rdf:Property ; sh:description "The properties that declare to have this class in their domain." ; sh:group tosh:RDFSPropertyAxiomsPropertyGroup ; sh:name "domain of" ; sh:nodeKind sh:IRI ; sh:order "0"^^xsd:decimal ; . tosh:Class-equivalentClass a sh:PropertyShape ; sh:path owl:equivalentClass ; sh:class owl:Class ; sh:group tosh:OWLAxiomsPropertyGroup ; rdfs:label "edit widget" ; rdfs:range swa:ObjectEditorClass ; . tosh:hasDatatype rdf:type sh:SPARQLAskValidator ; rdfs:comment "Checks whether a given node ($value) is a literal with a given datatype ($datatype), and that the literal is well-formed." ; sh:order "0"^^xsd:decimal ; . tosh:Class-range-inverse a sh:PropertyShape ; sh:path [ sh:inversePath rdfs:range ; ] ; dash:editor dash:PropertyAutoCompleteEditor ; sh:class rdf:Property ; sh:description "The properties that have this class in their rdfs:range." ; sh:group tosh:RDFSPropertyAxiomsPropertyGroup ; sh:name "range of" ; sh:nodeKind sh:IRI ; sh:order "1"^^xsd:decimal ; . tosh:Class-resourceAction a sh:PropertyShape ; sh:path dash:resourceAction ; graphql:name "resourceActions" ; sh:class dash:ResourceAction ; sh:description "The Resource Actions that can be applied to instances of this class." ; sh:group tosh:ScriptsPropertyGroup ; sh:name "resource actions" ; sh:order "0"^^xsd:decimal ; . tosh:Class-resourceService a sh:PropertyShape ; sh:path dash:resourceService ; graphql:name "resourceServices" ; sh:class dash:ResourceService ; sh:description "The Services that can be applied to instances of this class (as focusNode)." ; sh:group tosh:ScriptsPropertyGroup ; sh:name "resource services" ; sh:order "10"^^xsd:decimal ; . tosh:Class-subClassOf a sh:PropertyShape ; sh:path rdfs:subClassOf ; graphql:name "superclasses" ; sh:class rdfs:Class ; sh:description "The (direct) parent classes of this class." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "superclasses" ; sh:order "20"^^xsd:decimal ; . tosh:Class-subClassOf-inverse a sh:PropertyShape ; sh:path [ sh:inversePath rdfs:subClassOf ; ] ; dash:hidden true ; graphql:name "subclasses" ; sh:class rdfs:Class ; sh:description "The (direct) subclasses of this class." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "subclasses" ; sh:order "21"^^xsd:decimal ; . tosh:ConstraintComponent-localConstraint a sh:PropertyShape ; sh:path dash:localConstraint ; sh:datatype xsd:boolean ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "local constraint" ; sh:order "10"^^xsd:decimal ; . tosh:ConstraintComponent-message rdfs:label "SHACL exists" ; sh:returnType xsd:boolean ; . tosh:systemNamespace rdf:type rdf:Property ; rdfs:comment "Can be used to mark namespace resources (subjects) to count as \"system namespace\" that should be filtered by tosh:SystemNamespaceShape. Search for the usage of this predicate for examples. Anyone can add their own namespaces to their graphs." ; sh:class sh:Validator ; sh:description "The validator(s) used to evaluate a constraint in the context of a node shape." ; sh:group tosh:ImplementationPropertyGroup ; sh:name "node validators" ; sh:order "2"^^xsd:decimal ; . tosh:ConstraintComponent-propertySuggestionGenerator a sh:PropertyShape ; sh:path dash:propertySuggestionGenerator ; sh:class dash:SuggestionGenerator ; sh:group tosh:ImplementationPropertyGroup ; sh:name "property suggestion generators" ; sh:order "20"^^xsd:decimal ; . tosh:ConstraintComponent-propertyValidator a sh:PropertyShape ; sh:path sh:propertyValidator ; sh:class sh:Validator ; sh:description "The validator(s) used to evaluate a constraint in the context of a property shape." ; sh:group tosh:ImplementationPropertyGroup ; sh:name "property validators" ; sh:order "1"^^xsd:decimal ; . tosh:ConstraintComponent-staticConstraint a sh:PropertyShape ; sh:path dash:staticConstraint ; sh:datatype xsd:boolean ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "static constraint" ; sh:order "11"^^xsd:decimal ; . tosh:ConstraintComponent-validator a sh:PropertyShape ; sh:path sh:validator ; sh:class sh:Validator ; sh:description "The validator(s) used to evaluate constraints of either node or property shapes, unless more specific validators are available." ; sh:group tosh:ImplementationPropertyGroup ; sh:name "validators" ; sh:order "0"^^xsd:decimal ; . tosh:DatatypePropertyShapeView a sh:NodeShape ; rdfs:comment "The default view shape for property shapes on datatype values." ; rdfs:label "Attribute view" ; sh:node tosh:PropertyShapeView ; sh:property dash:PrimaryKeyConstraintComponent-uriStart ; sh:property dash:SingleLineConstraintComponent-singleLine ; sh:property tosh:Shape-datatypes ; sh:property sh:LanguageInConstraintComponent-languageIn ; sh:property sh:LessThanConstraintComponent-lessThan ; sh:property sh:LessThanOrEqualsConstraintComponent-lessThanOrEquals ; sh:property sh:MaxExclusiveConstraintComponent-maxExclusive ; sh:property sh:MaxInclusiveConstraintComponent-maxInclusive ; sh:property sh:MaxLengthConstraintComponent-maxLength ; sh:property sh:MinExclusiveConstraintComponent-minExclusive ; sh:property sh:MinInclusiveConstraintComponent-minInclusive ; sh:property sh:MinLengthConstraintComponent-minLength ; sh:property sh:PatternConstraintComponent-flags ; sh:property sh:PatternConstraintComponent-pattern ; sh:property sh:UniqueLangConstraintComponent-uniqueLang ; . tosh:DatatypesViewer a dash:MultiViewer ; dash:hidden true ; rdfs:label "Datatypes viewer" ; . tosh:DefinitionPropertyGroup a sh:PropertyGroup ; rdfs:label "Definition" ; sh:order "0"^^xsd:decimal ; . tosh:DeleteTripleSuggestionGenerator a dash:SPARQLUpdateSuggestionGenerator ; rdfs:comment "Produces a suggestion that would delete the offending value in the validation result from the focus node." ; rdfs:label "Delete triple suggestion generator" ; sh:message "Delete the invalid statement" ; sh:order 100.0 ; sh:update """DELETE { $focusNode $predicate $value . } WHERE { $focusNode $predicate $value . }""" ; . tosh:DependentEnumSelectEditor a dash:SingleEditor ; rdfs:comment """A drop-down editor for enumerated values that are dynamically determined via a node shape that has sh:target dash:HasValueTarget. Example: states:USAddressShape rdf:type sh:NodeShape ; rdfs:label \"US Address shape\" ; sh:property [ rdf:type sh:PropertyShape ; sh:path states:state ; sh:in ( \"AZ\" \"CA\" \"FL\" ) ; ] ; sh:target [ rdf:type dash:HasValueTarget ; dash:object \"USA\" ; dash:predicate states:country ; ] . """ ; rdfs:label "Dependent enum select editor" ; . tosh:DisplayPropertyGroup a sh:PropertyGroup ; rdfs:label "Display" ; sh:order "30"^^xsd:decimal ; . tosh:Function-apiStatus a sh:PropertyShape ; sh:path dash:apiStatus ; sh:class dash:APIStatus ; sh:description "Declares the status of this function within the TopBraid API. The usual life cycle is to start with no value (meaning: not part of the API at all), then experimental from which it later either moves to stable or deprecated. Stable functions may also get deprecated and have no api status after at least one release cycle." ; sh:group tosh:DefinitionPropertyGroup ; sh:in ( dash:Experimental dash:Stable dash:Deprecated ) ; sh:maxCount 1 ; sh:name "API status" ; sh:order "15"^^xsd:decimal ; . tosh:Function-cachable a sh:PropertyShape ; sh:path dash:cachable ; sh:datatype xsd:boolean ; sh:description "True to indicate that this function will always return the same values for the same combination of arguments, regardless of the query graphs. Engines can use this information to cache and reuse previous function calls." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "cachable" ; sh:order "10"^^xsd:decimal ; . tosh:Function-returnType . sh:ClassConstraintComponent dash:propertySuggestionGenerator tosh:DeleteTripleSuggestionGenerator ; . sh:ClassConstraintComponent-class sh:group tosh:ValueTypeConstraintPropertyGroup ; . tosh:FunctionTestCase-expectedResult a sh:PropertyShape ; sh:path dash:expectedResult ; sh:description "The expected result of a function call." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:name "expected result" ; sh:order "10"^^xsd:decimal ; . sh:DatatypeConstraintComponent dash:propertySuggestionGenerator tosh:DeleteTripleSuggestionGenerator ; dash:propertySuggestionGenerator [ rdf:type dash:SPARQLUpdateSuggestionGenerator ; sh:message "Change the datatype of the invalid value to {$datatype}" ; sh:order -2 ; sh:update """DELETE { $focusNode $predicate $value . } a dash:SingleEditor ; rdfs:label "Governance role editor" ; . tosh:GovernanceRoleViewer a dash:SingleViewer ; rdfs:label "Governance role viewer" ; . tosh:GraphStoreTestCase-expectedResult a sh:PropertyShape ; rdf:type dash:SPARQLUpdateSuggestionGenerator ; sh:message "Convert the invalid date/time value into a date value" ; sh:order -1 ; sh:update """DELETE { $subject $predicate $object } . tosh:GraphStoreTestCase-uri a sh:PropertyShape ; sh:path dash:uri ; sh:datatype xsd:anyURI ; sh:description "The URI of the graph to load." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:minCount 1 ; sh:name "uri" ; sh:order "0"^^xsd:decimal ; . tosh:ImplementationPropertyGroup a sh:PropertyGroup ; rdfs:label "Implementation" ; sh:order "10"^^xsd:decimal ; . tosh:IncludedScript-exports a sh:PropertyShape ; sh:path dash:exports ; sh:datatype xsd:string ; sh:description "Declares the symbols that shall be exported from the surrounding module, e.g. for use in Node.js applications." ; sh:group tosh:ImplementationPropertyGroup ; sh:name "exports" ; sh:order "30"^^xsd:decimal ; . tosh:InferenceRulesShape a sh:NodeShape ; rdfs:comment "A node shape for classes and node shapes, declaring the sh:rule property." ; rdfs:label "Inference rules" ; sh:property tosh:InferenceRulesShape-rule ; sh:targetClass sh:NodeShape ; . tosh:InferenceRulesShape-rule a sh:PropertyShape ; sh:path sh:rule ; sh:class sh:Rule ; sh:description "The inference rules associated with this node shape or class." ; sh:group tosh:InferencesPropertyGroup ; sh:name "rule" ; . tosh:InferencesPropertyGroup a sh:PropertyGroup ; rdfs:label "Inferences" ; sh:order "80"^^xsd:decimal ; . tosh:InferencingTestCase-expectedResult a sh:PropertyShape ; . sh:InConstraintComponent dash:propertySuggestionGenerator tosh:DeleteTripleSuggestionGenerator ; dash:propertySuggestionGenerator [ rdf:type dash:SPARQLUpdateSuggestionGenerator ; sh:message "Replace invalid value with {$newObject}" ; a dash:SingleEditor ; rdfs:comment "A drop-down editor for all instances of a class (based on tosh:shapeInGraph/sh:class of the property) in a graph specified using tosh:graph." ; rdfs:label "Instances in graph select editor" ; . tosh:JSTestCase-expectedResult a sh:PropertyShape ; sh:path dash:expectedResult ; sh:description "The expected result of the JavaScript function call, as an RDF node." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:name "expected result" ; . tosh:MemberShapeConstraintComponent a sh:ConstraintComponent ; rdfs:comment "Can be used to specify constraints on the members of a given list, assuming that the given sh:property has rdf:Lists as values. A violation is reported for each member of the list that does not comply with the constraints specified by the given shape." ; rdfs:label "Member shape constraint component" ; sh:parameter tosh:MemberShapeConstraintComponent-memberShape ; sh:propertyValidator [ a sh:SPARQLSelectValidator ; sh:message "List member does not have the shape {$memberShape}" ; sh:prefixes <http://topbraid.org/tosh> ; sh:select """ SELECT DISTINCT $this ?value ?failure ?member WHERE { $this $PATH ?value . ?value rdf:rest*/rdf:first ?member . BIND (tosh:hasShape(?member, $memberShape) AS ?hasShape) . BIND (!bound(?hasShape) AS ?failure) . FILTER (?failure || !?hasShape) . } """ ; ] ; sh:targetClass sh:PropertyShape ; . tosh:MemberShapeConstraintComponent-memberShape a sh:Parameter ; sh:path tosh:memberShape ; sh:class sh:Shape ; sh:description "The shape that the list members must have." ; sh:name "member shape" ; . tosh:ModifyAction-skipPreview a sh:PropertyShape ; sh:path dash:skipPreview ; sh:datatype xsd:boolean ; sh:description "For actions that take no parameters, this can be set to true to skip any means for the user to preview the action. It will instead directly execute the modification." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "skip preview" ; sh:order "11"^^xsd:decimal ; . tosh:MultiFunction-resultVariable a sh:PropertyShape ; sh:path dash:resultVariable ; sh:class sh:Parameter ; sh:description "The result variables." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "result variables" ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order "30"^^xsd:decimal ; . tosh:NodeShape-ShapeScript a dash:ShapeScript ; dash:js """ /** * Returns this class as an instance of rdfs_Class, assuming this node shape is also a class. * @returns {rdfs_Class} */ asClass() { return rdfs.asClass(this); } /** * Gets the \"nearest\" constraint of a given type and a given path property. Deactivated shapes are skipped. * For example, call it with (ex.myProperty, sh.datatype) to find the closest sh:datatype constraint for ex:myProperty. * @param {NamedNode} path the property that is the sh:path of matching property shapes * @param {NamedNode} predicate the property to fetch the nearest value of */ . sh:MaxLengthConstraintComponent dash:propertySuggestionGenerator tosh:DeleteTripleSuggestionGenerator ; dash:propertySuggestionGenerator [ rdf:type dash:SPARQLUpdateSuggestionGenerator ; sh:message "Prune string to only {$maxLength} characters" ; sh:order 1 ; sh:update """DELETE { $focusNode $predicate $value . } } }) } /** * @callback sh_NodeShape_callback * @param {sh_NodeShape} nodeShape the visited node shape */ /** * Performs a depth-first traversal of this and its superclasses (via rdfs:subClassOf) and supershapes (via sh:node), * visiting each (super) shape once until the callback function returns a non-null/undefined result. This becomes the result of this function. * The order in which sibling parents are traversed is undefined. * @param {sh_NodeShape_callback} callback the callback for each shape * @param {Set} [reached] the Set of reached URI strings, used internally but may also be used to terminate at certain supers * @returns the return value of the first callback that returned any value */ walkSupershapes(callback, reached) { if(!reached) { reached = new Set(); } if(!reached.has(this.uri)) { reached.add(this.uri); let result = callback(this); if(result !== undefined && result !== null) { return result; } let superClasses = this.asClass().superclasses; for(let i = 0; i < superClasses.length; i++) { result = superClasses[i].asNodeShape().walkSupershapes(callback, reached); if(result !== undefined && result !== null) { return result; } } let superShapes = this.supershapes; for(let i = 0; i < superShapes.length; i++) { result = superShapes[i].walkSupershapes(callback, reached); if(result !== undefined && result !== null) { return result; } } } } """ ; . tosh:NodeShape-applicableToClass a sh:PropertyShape ; sh:path dash:applicableToClass ; sh:class rdfs:Class ; sh:description "Links a node shape with the classes that it can be applied to." ; sh:group tosh:TargetsPropertyGroup ; sh:name "applicable to classes" ; sh:nodeKind sh:IRI ; sh:order "10"^^xsd:decimal ; . tosh:NodeShape-defaultViewForRole a sh:PropertyShape ; sh:path dash:defaultViewForRole ; dash:editor tosh:GovernanceRoleSelectEditor ; dash:viewer tosh:GovernanceRoleViewer ; sh:description "The user roles that this shape shall be used as default view for." ; sh:group tosh:TargetsPropertyGroup ; sh:name "default view for roles" ; sh:nodeKind sh:IRI ; sh:order "20"^^xsd:decimal ; . tosh:NodeShape-inheritedProperty a sh:PropertyShape ; sh:path tosh:inheritedProperty ; dash:neverMaterialize true ; dash:viewer tosh:PropertyTableViewer ; sh:description "Returns all property shapes that have been declared at \"super-shapes\" (via sh:node) or \"superclasses\" (via rdfs:subClassOf), including the indirect supers, recursively." ; sh:group tosh:PropertiesPropertyGroup ; sh:name "inherited properties" ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order "1"^^xsd:decimal ; sh:values [ sh:path sh:property ; sh:nodes [ sh:minus sh:this ; sh:nodes [ sh:distinct [ sh:path [ sh:oneOrMorePath [ sh:alternativePath ( rdfs:subClassOf sh:node ) ; ] ; ] ; ] ; ] ; ] ; ] ; . tosh:NodeShape-node a sh:PropertyShape ; sh:path sh:node ; graphql:name "supershapes" ; sh:description "The node shapes that this must also conform to, forming a kind of inheritance between shapes similar to a subclass-of relationship." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "node (super shapes)" ; sh:node sh:NodeShape ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order "20"^^xsd:decimal ; . tosh:NodeShape-targetClass a sh:PropertyShape ; sh:path sh:targetClass ; graphql:name "targetClasses" ; sh:class rdfs:Class ; sh:description "The types of instances that this shape is targeted at." ; sh:group tosh:TargetsPropertyGroup ; sh:name "target classes" ; sh:nodeKind sh:IRI ; sh:order "0"^^xsd:decimal ; . tosh:NodeShape-targetObjectsOf a sh:PropertyShape ; sh:path sh:targetObjectsOf ; sh:group tosh:TargetsPropertyGroup ; sh:name "target objects of" ; sh:node rdf:Property ; sh:nodeKind sh:IRI ; sh:order "1"^^xsd:decimal ; . tosh:NodeShape-targetSubjectsOf a sh:PropertyShape ; sh:path sh:targetSubjectsOf ; sh:group tosh:TargetsPropertyGroup ; sh:name "target subjects of" ; sh:node rdf:Property ; sh:nodeKind sh:IRI ; sh:order "2"^^xsd:decimal ; . tosh:NodeShapeConstraintsShape a sh:NodeShape ; rdfs:comment "A shape that can be used to validate the syntax of node shapes, and to enter constraints for node shapes on forms." ; rdfs:label "Node shape constraints" ; sh:property dash:ClosedByTypesConstraintComponent-closedByTypes ; sh:property dash:ScriptConstraintComponent-scriptConstraint ; sh:property dash:SingleLineConstraintComponent-singleLine ; sh:property dash:StemConstraintComponent-stem ; sh:property tosh:Shape-datatypes ; sh:property sh:ClassConstraintComponent-class ; sh:property sh:ClosedConstraintComponent-closed ; sh:property sh:ClosedConstraintComponent-ignoredProperties ; sh:property sh:DatatypeConstraintComponent-datatype ; sh:property sh:HasValueConstraintComponent-hasValue ; sh:property sh:InConstraintComponent-in ; sh:property sh:LanguageInConstraintComponent-languageIn ; sh:group tosh:ComplexConstraintPropertyGroup ; sh:order 12 ; . sh:PatternConstraintComponent-flags tosh:editWidget <http://topbraid.org/tosh.ui#FlagsEditor> ; sh:group tosh:StringBasedConstraintPropertyGroup ; sh:targetClass sh:NodeShape ; . tosh:NumberOfValuesPropertyGroup a sh:PropertyGroup ; rdfs:label "Number of Values" ; sh:order "40"^^xsd:decimal ; . tosh:OWLAxiomsPropertyGroup a sh:PropertyGroup ; rdfs:label "OWL Axioms" ; sh:order "17"^^xsd:decimal ; . tosh:ObjectPropertyShapeView a sh:NodeShape ; rdfs:comment "The default view shape for property shapes on object values." ; rdfs:label "Relationship view" ; sh:node tosh:PropertyShapeView ; sh:property dash:NonRecursiveConstraintComponent-nonRecursive ; sh:property dash:RootClassConstraintComponent-rootClass ; sh:property dash:StemConstraintComponent-stem ; sh:property dash:SymmetricConstraintComponent-symmetric ; sh:property tosh:ObjectPropertyShapeView-node ; sh:property sh:ClassConstraintComponent-class ; sh:property sh:NodeKindConstraintComponent-nodeKind ; . tosh:ObjectPropertyShapeView-node a sh:PropertyShape ; sh:path sh:node ; dash:reifiableBy dash:ConstraintReificationShape ; sh:class sh:NodeShape ; sh:description "The node shape(s) that all values of the property must conform to." ; sh:group tosh:ValueConstraintsPropertyGroup ; sh:name "node" ; sh:order "0"^^xsd:decimal ; . tosh:Ontology-imports a sh:PropertyShape ; sh:path owl:imports ; sh:description "The (directly) imported graphs." ; sh:name "imports" ; sh:nodeKind sh:IRI ; . tosh:Parameterizable-labelTemplate a sh:PropertyShape ; sh:path sh:labelTemplate ; sh:description "Outlines how human-readable labels of instances of the associated Parameterizable shall be produced. The values can contain {?paramName} as placeholders for the actual values of the given parameter." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "label template" ; sh:or dash:StringOrLangString ; sh:order "25"^^xsd:decimal ; . tosh:Parameterizable-parameter a sh:PropertyShape ; sh:path sh:parameter ; sh:class sh:Parameter ; sh:description "The input parameters." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "parameters" ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order "20"^^xsd:decimal ; . tosh:PathStringViewer a dash:MultiViewer ; dash:hidden true ; rdfs:label "Path string viewer" ; . tosh:PropertiesPropertyGroup a sh:PropertyGroup ; rdfs:comment "The declared and inferred properties of a shape or class." ; rdfs:label "Properties" ; sh:order "10"^^xsd:decimal ; . tosh:Property-domain a sh:PropertyShape ; sh:path rdfs:domain ; graphql:name "domains" ; sh:description "The domain(s) of this property." ; sh:group tosh:PropertyAxiomsPropertyGroup ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order "0"^^xsd:decimal ; . tosh:Property-range a sh:PropertyShape ; sh:path rdfs:range ; graphql:name "ranges" ; sh:description "The range(s) of this property." ; sh:group tosh:PropertyAxiomsPropertyGroup ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order "1"^^xsd:decimal ; . tosh:Property-subPropertyOf a sh:PropertyShape ; sh:path rdfs:subPropertyOf ; graphql:name "superproperties" ; sh:class rdf:Property ; sh:description "The (direct) superproperties of this." ; sh:group tosh:PropertyAxiomsPropertyGroup ; sh:name "superproperties" ; sh:nodeKind sh:IRI ; sh:order "2"^^xsd:decimal ; . tosh:Property-subPropertyOf-inverse a sh:PropertyShape ; sh:path [ sh:inversePath rdfs:subPropertyOf ; ] ; graphql:name "subproperties" ; sh:class rdf:Property ; sh:description "The (direct) subproperties of this." ; sh:group tosh:PropertyAxiomsPropertyGroup ; sh:name "subproperties" ; sh:nodeKind sh:IRI ; sh:order "3"^^xsd:decimal ; . tosh:PropertyAxiomsPropertyGroup a sh:PropertyGroup ; rdfs:label "Property Axioms" ; sh:order "1"^^xsd:decimal ; . tosh:PropertyGroup-order a sh:PropertyShape ; sh:path sh:order ; sh:description "The relative order of this group compared to others." ; sh:group tosh:DisplayPropertyGroup ; sh:maxCount 1 ; sh:name "order" ; sh:or ( [ sh:datatype xsd:decimal ; ] [ sh:datatype xsd:integer ; ] ) ; sh:order "0"^^xsd:decimal ; . tosh:PropertyPairConstraintsPropertyGroup a sh:PropertyGroup ; rdfs:label "Property Pair Constraints" ; sh:order "75"^^xsd:decimal ; . tosh:PropertyShape-defaultValue a sh:PropertyShape ; sh:path sh:defaultValue ; dash:readOnly true ; dash:viewer dash:NodeExpressionViewer ; tosh:useDeclaredDatatype true ; sh:description "The default value to be used for this property if no other value has been asserted. This may be a constant value or a SHACL node expression, in which case the values can be derived from other values. Default values are typically inferred and not stored as RDF statements." ; sh:group tosh:InferencesPropertyGroup ; sh:name "default value" ; sh:order "0"^^xsd:decimal ; . tosh:PropertyShape-description a sh:PropertyShape ; sh:path sh:description ; dash:singleLine false ; graphql:name "descriptions" ; sh:description "The description(s) of the property, possibly in multiple languages." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "descriptions" ; sh:nodeKind sh:Literal ; sh:or dash:StringOrLangStringOrHTML ; sh:order "1"^^xsd:decimal ; sh:sparql [ sh:message "Property shapes cannot have both class and datatype constraints." ; sh:prefixes <http://topbraid.org/tosh> ; sh:select """SELECT $this WHERE { FILTER EXISTS { $this sh:class ?class . $this sh:datatype ?datatype . } }""" ; ] ; . tosh:PropertyShape-detailsEndpoint a sh:PropertyShape ; sh:path dash:detailsEndpoint ; sh:datatype xsd:string ; sh:maxCount 1 ; sh:name "details endpoint" ; . tosh:PropertyShape-editor a sh:PropertyShape ; sh:path dash:editor ; dash:editor dash:InstancesSelectEditor ; sh:class dash:Editor ; sh:description "The editor component that should be used to edit values of this property." ; sh:group tosh:DisplayPropertyGroup ; sh:maxCount 1 ; sh:nodeKind sh:IRI ; sh:order "11"^^xsd:decimal ; . tosh:PropertyShape-group a sh:PropertyShape ; sh:path sh:group ; sh:class sh:PropertyGroup ; sh:description "The group that this property belongs to." ; sh:group tosh:DisplayPropertyGroup ; sh:maxCount 1 ; sh:name "group" ; sh:order "0"^^xsd:decimal ; . tosh:PropertyShape-hidden a sh:PropertyShape ; sh:path dash:hidden ; dash:editor dash:BooleanSelectEditor ; sh:datatype xsd:boolean ; sh:description "True to mark this property as hidden in user interface, yet still used in data tasks." ; sh:group tosh:DisplayPropertyGroup ; sh:maxCount 1 ; sh:order "30"^^xsd:decimal ; . tosh:PropertyShape-indexed a sh:PropertyShape ; sh:path dash:indexed ; sh:datatype xsd:boolean ; sh:description "True to indicate that the values of this shall be indexed, forming ordered arrays." ; sh:maxCount 1 ; sh:name "indexed" ; . tosh:PropertyShape-name a sh:PropertyShape ; sh:path sh:name ; dash:singleLine true ; graphql:name "names" ; sh:description "The display names of the property, possibly in multiple languages." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "names" ; sh:nodeKind sh:Literal ; sh:or dash:StringOrLangString ; sh:order "0"^^xsd:decimal ; . tosh:PropertyShape-neverMaterialize a sh:PropertyShape ; sh:path dash:neverMaterialize ; sh:datatype xsd:boolean ; sh:group tosh:InferencesPropertyGroup ; sh:maxCount 1 ; sh:name "never materialize" ; sh:order "11"^^xsd:decimal ; . tosh:PropertyShape-order a sh:PropertyShape ; sh:path sh:order ; sh:description "The relative order of this property shape compared to others." ; sh:group tosh:DisplayPropertyGroup ; sh:maxCount 1 ; sh:name "order" ; sh:or ( [ sh:datatype xsd:decimal ; ] [ sh:datatype xsd:integer ; ] ) ; sh:order "1"^^xsd:decimal ; . tosh:PropertyShape-path a sh:PropertyShape ; sh:path sh:path ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:minCount 1 ; sh:name "path" ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order "31"^^xsd:decimal ; . tosh:PropertyShape-propertyRole a sh:PropertyShape ; sh:path dash:propertyRole ; sh:class dash:PropertyRole ; sh:group tosh:DisplayPropertyGroup ; sh:maxCount 1 ; sh:name "role" ; sh:order "40"^^xsd:decimal ; . tosh:PropertyShape-readOnly a sh:PropertyShape ; sh:path dash:readOnly ; dash:editor dash:BooleanSelectEditor ; dash:viewer dash:NodeExpressionViewer ; sh:datatype xsd:boolean ; sh:description """If set to true then the values of this property should not be editable in the user interface. Note that low-level access such as source code editors may still allow editing, but form-based editors would not. More generally, the values of this property are SHACL node expressions, e.g. function calls, in which case the property counts as read-only if the expression evaluates to true.""" ; sh:group tosh:DisplayPropertyGroup ; sh:maxCount 1 ; sh:order "20"^^xsd:decimal ; . tosh:PropertyShape-values a sh:PropertyShape ; sh:path sh:values ; dash:viewer dash:NodeExpressionViewer ; sh:group tosh:InferencesPropertyGroup ; sh:name "values" ; sh:order "10"^^xsd:decimal ; sh:sparql [ sh:message "sh:values must be accompanied by a sh:path that is an IRI." ; sh:prefixes <http://topbraid.org/tosh> ; sh:select """SELECT $this ?value WHERE { $this $PATH ?value . FILTER NOT EXISTS { $this sh:path ?path . FILTER isIRI(?path) } }""" ; ] ; . tosh:PropertyShape-viewer a sh:PropertyShape ; sh:path dash:viewer ; dash:editor dash:InstancesSelectEditor ; sh:class dash:Viewer ; sh:description "The viewer component that should be used to render values of this property." ; sh:group tosh:DisplayPropertyGroup ; sh:maxCount 1 ; sh:nodeKind sh:IRI ; sh:order "10"^^xsd:decimal ; . tosh:PropertyShapeView a sh:NodeShape ; rdfs:comment "Base view shape for either datatype or object property shapes." ; rdfs:label "Property shape view" ; sh:property dash:CoExistsWithConstraintComponent-coExistsWith ; sh:property dash:IndexedConstraintComponent-indexed ; sh:property dash:ReifiableByConstraintComponent-reifiableBy ; sh:property dash:ScriptConstraintComponent-scriptConstraint ; sh:property dash:SubSetOfConstraintComponent-subSetOf ; sh:property tosh:PropertyShape-defaultValue ; sh:property tosh:PropertyShape-description ; sh:property tosh:PropertyShape-editor ; sh:property tosh:PropertyShape-group ; sh:property tosh:PropertyShape-hidden ; sh:property tosh:PropertyShape-name ; sh:property tosh:PropertyShape-neverMaterialize ; sh:property tosh:PropertyShape-order ; sh:property tosh:PropertyShape-propertyRole ; sh:property tosh:PropertyShape-readOnly ; sh:property tosh:PropertyShape-values ; sh:property tosh:PropertyShape-viewer ; sh:property tosh:PropertyShapeView-message ; sh:property tosh:PropertyShapeView-pathSystemLabel ; sh:property tosh:PropertyShapeView-qualifiedMaxCount ; sh:property tosh:PropertyShapeView-qualifiedMinCount ; sh:property tosh:PropertyShapeView-qualifiedValueShape ; sh:property tosh:PropertyShapeView-qualifiedValueShapesDisjoint ; sh:property tosh:Shape-deactivated ; sh:property tosh:Shape-severity ; sh:property sh:DisjointConstraintComponent-disjoint ; sh:property sh:EqualsConstraintComponent-equals ; sh:property sh:MaxCountConstraintComponent-maxCount ; sh:property sh:MinCountConstraintComponent-minCount ; sh:property sh:SPARQLConstraintComponent-sparql ; . tosh:PropertyShapeView-indexed a sh:PropertyShape ; sh:path dash:indexed ; sh:datatype xsd:boolean ; sh:description "Indicates whether the values are sorted by an index. The user interface will display them in-order." ; sh:group tosh:ReificationPropertyGroup ; sh:maxCount 1 ; sh:name "indexed" ; sh:order "1"^^xsd:decimal ; . tosh:PropertyShapeView-message a sh:PropertyShape ; sh:path sh:message ; sh:description "The message that shall be generated for all constraint violations produced by this property shape." ; sh:group tosh:ValidationPropertyGroup ; sh:name "messages" ; sh:or dash:StringOrLangString ; sh:order "5"^^xsd:decimal ; . tosh:PropertyShapeView-pathSystemLabel a sh:PropertyShape ; sh:path tosh:pathSystemLabel ; dash:neverMaterialize true ; dash:viewer tosh:PathStringViewer ; sh:datatype xsd:string ; sh:description "A display label of the sh:path based on qnames." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "property path" ; sh:order "2"^^xsd:decimal ; sh:values [ sh:else [ <http://uispin.org/ui#label> ( [ sh:path sh:path ; ] ) ; ] ; sh:if [ <http://datashapes.org/sparql#isIRI> ( [ sh:path sh:path ; ] ) ; ] ; sh:then [ <http://topbraid.org/sparqlmotionfunctions#qname> ( [ sh:path sh:path ; ] ) ; ] ; ] ; . tosh:PropertyShapeView-qualifiedMaxCount a sh:PropertyShape ; sh:path sh:qualifiedMaxCount ; sh:datatype xsd:integer ; sh:description "The maximum number of values that may conform to the qualified value shape." ; sh:group tosh:QualifiedCardinalityConstraintsPropertyGroup ; sh:maxCount 1 ; sh:name "qualified max count" ; sh:order "1"^^xsd:decimal ; . tosh:PropertyShapeView-qualifiedMinCount a sh:PropertyShape ; sh:path sh:qualifiedMinCount ; sh:datatype xsd:integer ; sh:description "The minimum number of values that must conform to the qualified value shape." ; sh:group tosh:QualifiedCardinalityConstraintsPropertyGroup ; sh:maxCount 1 ; sh:name "qualified min count" ; sh:order "0"^^xsd:decimal ; . tosh:PropertyShapeView-qualifiedValueShape a sh:PropertyShape ; sh:path sh:qualifiedValueShape ; sh:class sh:NodeShape ; sh:description "The shape that the specified number of values must conform to." ; sh:group tosh:QualifiedCardinalityConstraintsPropertyGroup ; sh:name "qualified value shape" ; sh:order "2"^^xsd:decimal ; . tosh:PropertyShapeView-qualifiedValueShapesDisjoint a sh:PropertyShape ; sh:path sh:qualifiedValueShapesDisjoint ; sh:datatype xsd:boolean ; sh:description "True to treat all qualified values as disjoint." ; sh:group tosh:QualifiedCardinalityConstraintsPropertyGroup ; sh:maxCount 1 ; sh:name "qualified value shapes disjoint" ; sh:order "3"^^xsd:decimal ; . tosh:PropertyTableViewer a dash:MultiViewer ; dash:hidden true ; rdfs:label "Property table viewer" ; . tosh:QualifiedCardinalityConstraintsPropertyGroup a sh:PropertyGroup ; rdfs:comment "The properties in this group are used together to express that a certain number of values must conform to a given shape." ; rdfs:label "Qualified Cardinality Constraints" ; sh:order "77"^^xsd:decimal ; . tosh:QueryTestCase-expectedResult a sh:PropertyShape ; sh:path dash:expectedResult ; dash:singleLine false ; sh:description "The expected result set, as a JSON string." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:name "expected result" ; sh:or ( [ sh:datatype rdf:JSON ; ] [ sh:datatype xsd:string ; ] ) ; . tosh:RDFSOWLClassView a sh:NodeShape ; dash:applicableToClass rdfs:Class ; rdfs:comment "A node shape collecting RDFS and OWL axioms for classes." ; rdfs:label "RDFS/OWL class view" ; sh:property tosh:Class-disjointWith ; sh:property tosh:Class-domain-inverse ; sh:property tosh:Class-equivalentClass ; sh:property tosh:Class-range-inverse ; sh:property tosh:Class-subClassOf ; sh:property tosh:Class-subClassOf-inverse ; sh:property tosh:Resource-comment ; sh:property tosh:Resource-label ; sh:property tosh:Resource-type ; . tosh:RDFSPropertyAxiomsPropertyGroup a sh:PropertyGroup ; rdfs:label "RDFS Property Axioms" ; sh:order "15"^^xsd:decimal ; . tosh:ReferencesPropertyGroup a sh:PropertyGroup ; rdfs:comment "A property group typically used for incoming references or usages."^^rdf:HTML ; rdfs:label "References" ; sh:order "100"^^xsd:decimal ; . tosh:ReificationPropertyGroup a sh:PropertyGroup ; rdfs:label "Reification (Statements about Statements)" ; sh:order "90"^^xsd:decimal ; . tosh:ReplaceWithDefaultValueSuggestionGenerator a dash:SPARQLUpdateSuggestionGenerator ; rdfs:comment "Produces a suggestion to replace all values of the given predicate (which must exist) at the focus node to the default value declared at the shape that has caused the violation. Does nothing if the shape does not declare a sh:defaultValue. Deletes any old value of the property." ; rdfs:label "Replace with default value suggestion generator" ; sh:message "Replace with default value" ; sh:prefixes <http://topbraid.org/tosh> ; sh:select """SELECT ?defaultValue WHERE { GRAPH $shapesGraph { $sourceShape sh:defaultValue ?defaultValue . } }""" ; sh:update """DELETE { $focusNode $predicate ?oldValue . } INSERT { $focusNode $predicate ?defaultValue . } WHERE { $focusNode $predicate ?oldValue . }""" ; . tosh:Resource-comment a sh:PropertyShape ; sh:path rdfs:comment ; dash:propertyRole dash:DescriptionRole ; dash:singleLine false ; graphql:name "comments" ; sh:description "The comments of this, possibly in multiple languages." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "comments" ; sh:or dash:StringOrLangStringOrHTML ; sh:order "1"^^xsd:decimal ; . tosh:Resource-label a sh:PropertyShape ; sh:path rdfs:label ; dash:propertyRole dash:LabelRole ; graphql:name "labels" ; sh:description "The display name(s) of this, possibly in multiple languages." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "labels" ; sh:or dash:StringOrLangString ; sh:order "0"^^xsd:decimal ; . tosh:Resource-type a sh:PropertyShape ; sh:path rdf:type ; graphql:name "types" ; sh:class rdfs:Class ; sh:description "The type(s) of this." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "types" ; sh:order "10"^^xsd:decimal ; . tosh:ResourceAction-jsCondition a sh:PropertyShape ; sh:path dash:jsCondition ; sh:datatype xsd:string ; sh:description "An (ADS) JavaScript expression that will be executed to determine whether the action is applicable to the selected resource in the current context. The variable focusNode can be queried here. The expression needs to return true for the action to be deemed suitable." ; sh:group tosh:ImplementationPropertyGroup ; sh:name "action pre-condition" ; sh:order "25"^^xsd:decimal ; . tosh:ResourceView a sh:NodeShape ; rdfs:comment "A generic view shape that can be used as fallback to display typical resources that have an rdfs:label and an rdfs:comment." ; rdfs:label "Resource view" ; sh:property tosh:Resource-comment ; sh:property tosh:Resource-label ; . tosh:Rule-condition a sh:PropertyShape ; sh:path sh:condition ; sh:description "The pre-conditions that must apply before a rule gets executed. The focus node must conform to all conditions, which must be shapes." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "conditions" ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order "40"^^xsd:decimal ; . tosh:Rule-deactivated a sh:PropertyShape ; sh:path sh:deactivated ; sh:datatype xsd:boolean ; sh:description "True to deactivate the rule so that it will not get executed." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "deactivated" ; sh:order "30"^^xsd:decimal ; . tosh:Rule-order a sh:PropertyShape ; sh:path sh:order ; sh:description "The order of this rule relative to other rules at the same shape. Rules with lower order are executed first. Default value is 0. Rules with the same order cannot \"see\" each other's inferences." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "order" ; sh:or ( [ sh:datatype xsd:decimal ; ] [ sh:datatype xsd:integer ; ] ) ; sh:order "35"^^xsd:decimal ; . tosh:Rule-rule-inverse a sh:PropertyShape ; sh:path [ sh:inversePath sh:rule ; ] ; sh:class sh:Shape ; sh:description "The shapes or classes that the rule is attached to." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "rule of" ; sh:order "20"^^xsd:decimal ; . tosh:SHMinMaxEditor a dash:SingleEditor ; dash:hidden true ; rdfs:comment "An internally used editor for min/max range values of property shapes."^^rdf:HTML ; rdfs:label "SHACL Min Max Editor" ; . tosh:SPARQLAskExecutable-ask a sh:PropertyShape ; sh:path sh:ask ; dash:singleLine false ; sh:datatype xsd:string ; sh:description "The SPARQL ASK query string." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "ask" ; sh:order "1"^^xsd:decimal ; . tosh:SPARQLConstraint-deactivated a sh:PropertyShape ; sh:path sh:deactivated ; sh:datatype xsd:boolean ; sh:description "True to deactive this constraint." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "deactivated" ; sh:order "30"^^xsd:decimal ; . tosh:SPARQLConstraint-message a sh:PropertyShape ; sh:path sh:message ; sh:description "The message(s) that should be produced for constraint violations. The messages may contain placeholders such as {$value} for any variable returned in the SELECT clause of the SPARQL query." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "messages" ; sh:or dash:StringOrLangString ; sh:order "20"^^xsd:decimal ; . tosh:SPARQLConstructExecutable-construct a sh:PropertyShape ; sh:path sh:construct ; dash:singleLine false ; sh:datatype xsd:string ; sh:description "The SPARQL CONSTRUCT query string." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "construct" ; sh:order "1"^^xsd:decimal ; . tosh:SPARQLExecutable-prefixes a sh:PropertyShape ; sh:path sh:prefixes ; sh:class owl:Ontology ; sh:description "The Ontology declaring the SHACL prefix declarations to use for the SPARQL query." ; sh:group tosh:ImplementationPropertyGroup ; sh:name "prefixes" ; sh:order "0"^^xsd:decimal ; . tosh:SPARQLSelectExecutable-select a sh:PropertyShape ; sh:path sh:select ; dash:singleLine false ; sh:datatype xsd:string ; sh:description "The SPARQL SELECT query string." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "select" ; sh:order "1"^^xsd:decimal ; . tosh:SPARQLUpdateExecutable-update a sh:PropertyShape ; sh:path sh:update ; dash:singleLine false ; sh:datatype xsd:string ; sh:description "The SPARQL UPDATE request string." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "update" ; sh:order "1"^^xsd:decimal ; . tosh:Script-js a sh:PropertyShape ; sh:path dash:js ; sh:datatype xsd:string ; sh:description "The implementation as JavaScript." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "JavaScript code" ; sh:order "20"^^xsd:decimal ; . tosh:Script-onAllValues a sh:PropertyShape ; sh:path dash:onAllValues ; sh:datatype xsd:boolean ; sh:description "If true then all value nodes will be available to the script at once, through the variable \"values\"." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "on all values" ; sh:order "0"^^xsd:decimal ; . tosh:ScriptConstraint-deactivated a sh:PropertyShape ; sh:path sh:deactivated ; sh:datatype xsd:boolean ; sh:description "True to deactivate this constraint." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "deactivated" ; sh:order "30"^^xsd:decimal ; . tosh:ScriptConstraint-message a sh:PropertyShape ; sh:path sh:message ; sh:description "The message(s) to use for violations produced by this script." ; sh:group tosh:DefinitionPropertyGroup ; sh:name "messages" ; sh:or dash:StringOrLangString ; sh:order "20"^^xsd:decimal ; . tosh:ScriptFunction-canWrite a sh:PropertyShape ; sh:path dash:canWrite ; sh:datatype xsd:boolean ; sh:description "True to allow this function to have side effects. By default, functions are not permitted to modify the graph as this would violate SPARQL contracts. However, if canWrite is true then the function will not be available as a SPARQL function and only be injected into the generated API in read/write mode." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "can write" ; sh:order "15"^^xsd:decimal ; . tosh:ScriptTestCase-expectedResult a sh:PropertyShape ; sh:path dash:expectedResult ; sh:description "The expected result of the evaluation, as JSON object as produced by the servlet, or true or false." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:name "expected result" ; sh:or ( [ sh:datatype rdf:JSON ; ] [ sh:datatype xsd:boolean ; ] ) ; sh:order "0"^^xsd:decimal ; . tosh:ScriptTestCase-focusNode a sh:PropertyShape ; sh:path dash:focusNode ; sh:description "The selected resource, which will become value of focusNode for the script, with its \"most suitable\" JavaScript class as type. Defaults to the test case itself." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:name "focus node" ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order "10"^^xsd:decimal ; . tosh:ScriptsPropertyGroup a sh:PropertyGroup ; rdfs:comment "Scripts based on Active Data Shapes." ; rdfs:label "Scripts" ; sh:order "30"^^xsd:decimal ; . tosh:Service-canWrite a sh:PropertyShape ; sh:path dash:canWrite ; sh:datatype xsd:boolean ; sh:description "True if this service can modify the data, i.e. it will execute in read/write mode. By default, all services are read-only." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "can write" ; . tosh:Service-deactivated a sh:PropertyShape ; sh:path sh:deactivated ; sh:datatype xsd:boolean ; sh:description "True to deactivate this service." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "deactivated" ; sh:order "30"^^xsd:decimal ; . tosh:Service-responseContentType a sh:PropertyShape ; sh:path dash:responseContentType ; sh:datatype xsd:string ; sh:description "The content type (mime type) of the service response, defaulting to \"application/json\". Use \"void\" to return nothing." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:name "response content type" ; sh:order "10"^^xsd:decimal ; . tosh:SetToDefaultValueSuggestionGenerator a dash:SPARQLUpdateSuggestionGenerator ; rdfs:comment "Produces a suggestion to set the given predicate at the focus node to the default value declared at the shape that has caused the violation. Does nothing if the shape does not declare a sh:defaultValue. Deletes any old value of the property." ; rdfs:label "Set to default value suggestion generator" ; sh:message "Set to default value" ; sh:prefixes <http://topbraid.org/tosh> ; sh:select """SELECT ?defaultValue WHERE { GRAPH $shapesGraph { $sourceShape sh:defaultValue ?defaultValue . } }""" ; sh:update """DELETE { $focusNode $predicate ?oldValue . } INSERT { $focusNode $predicate ?defaultValue . } WHERE { OPTIONAL { $focusNode $predicate ?oldValue . } }""" ; . tosh:Shape-datatypes a sh:PropertyShape ; sh:path tosh:datatypes ; dash:neverMaterialize true ; dash:viewer tosh:DatatypesViewer ; sh:description "Zero of more datatypes that value nodes can take. In SHACL, the typical pattern is to either use a single sh:datatype or a sh:or of multiple sh:datatype constraints. This inferred property here provides a unified way to access these two design patterns." ; sh:group tosh:TypeOfValuesPropertyGroup ; sh:name "datatypes" ; sh:nodeKind sh:IRI ; sh:order "0"^^xsd:decimal ; sh:values [ sh:union ( [ sh:path sh:datatype ; ] [ sh:path ( sh:or [ sh:zeroOrMorePath rdf:rest ; ] rdf:first sh:datatype ) ; ] ) ; ] ; . tosh:Shape-deactivated a sh:PropertyShape ; sh:path sh:deactivated ; sh:datatype xsd:boolean ; sh:description "True to deactivate this shape, making it literally invisible and without any effect." ; sh:group tosh:DefinitionPropertyGroup ; sh:maxCount 1 ; sh:name "deactivated" ; sh:order "30"^^xsd:decimal ; . tosh:Shape-severity a sh:PropertyShape ; sh:path sh:severity ; dash:editor dash:InstancesSelectEditor ; sh:class sh:Severity ; sh:description "The severity to be used for validation results produced by the constraints." ; sh:group tosh:ValidationPropertyGroup ; sh:maxCount 1 ; sh:name "severity" ; sh:order "0"^^xsd:decimal ; . tosh:ShapeInGraphConstraintComponent a sh:ConstraintComponent ; dash:propertySuggestionGenerator tosh:DeleteTripleSuggestionGenerator ; rdfs:comment """A constraint component that can be used to verify that the value nodes have a given shape, where the shape validation is executed in a given graph. This can, for example, be used to verify that a given value is declared as an instance of a given class in some specified (not imported) graph. A typical design pattern is as follows: ex:NodeShape sh:property [ sh:path ex:myProperty ; sh:nodeKind sh:IRI ; tosh:graph <http://example.org/externalGraph> ; tosh:shapeInGraph [ sh:class ex:ExternalClass ; ] ; tosh:editor tosh:InstancesInGraphSelectEditor ; tosh:viewer tosh:URIInGraphViewer ; ] .""" ; rdfs:label "Shape in graph constraint component" ; sh:labelTemplate "Values must have shape {$shapeInGraph} defined in graph {$graph}" ; sh:message "Value does not have shape {$shapeInGraph} defined in graph {$graph}" ; sh:parameter [ a sh:Parameter ; sh:path tosh:graph ; sh:nodeKind sh:IRI ; ] ; sh:parameter [ a sh:Parameter ; sh:path tosh:shapeInGraph ; sh:nodeKind sh:BlankNodeOrIRI ; ] ; sh:validator [ a sh:SPARQLAskValidator ; sh:ask """ASK { GRAPH $graph { FILTER tosh:hasShape($value, $shapeInGraph) } }""" ; sh:prefixes <http://topbraid.org/tosh> ; ] ; . tosh:StringConstraintsPropertyGroup a sh:PropertyGroup ; rdfs:label "String Constraints" ; sh:order "70"^^xsd:decimal ; . tosh:SystemNamespaceShape a sh:NodeShape ; rdfs:comment "A shape that detects whether the focus node is a URI that has a namespace from one of the system namespaces - RDF, RDFS, OWL etc. The list of actual system namespaces is represented via tosh:systemNamespace true triples." ; rdfs:label "System namespace shape" ; sh:sparql [ a sh:SPARQLConstraint ; sh:message "Not a IRI from a system namespace" ; sh:prefixes <http://topbraid.org/tosh> ; sh:select """SELECT $this WHERE { FILTER (!isIRI($this) || (isIRI($this) && EXISTS { BIND (IRI(afn:namespace($this)) AS ?ns) . FILTER NOT EXISTS { ?ns tosh:systemNamespace true } . } )) . }""" ; ] ; . tosh:TargetsPropertyGroup a sh:PropertyGroup ; rdfs:label "Targets" ; sh:order "5"^^xsd:decimal ; . tosh:TeamworkPlatform a dash:ExecutionPlatform ; dash:includedExecutionPlatform tosh:TopBraidPlatform ; rdfs:comment "The platform consisting of TopBraid plus any teamwork features used by TopBraid EDG." ; rdfs:label "Teamwork platform" ; . tosh:TestCase-deactivated a sh:PropertyShape ; sh:path sh:deactivated ; sh:datatype xsd:boolean ; sh:description "If set to true, this test case will be skipped." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:name "deactivated" ; sh:order "50"^^xsd:decimal ; . tosh:TestPropertiesPropertyGroup a sh:PropertyGroup ; rdfs:label "Test Properties" ; sh:order "20"^^xsd:decimal ; . tosh:TopBraidPlatform a dash:ExecutionPlatform ; rdfs:comment "The platform consisting of TopBraid." ; rdfs:label "TopBraid platform" ; . tosh:TripleRule-object a sh:PropertyShape ; sh:path sh:object ; dash:viewer dash:NodeExpressionViewer ; sh:description "The node expression producing the object(s) of the triple inferred by the rule." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:minCount 1 ; sh:name "object" ; sh:order 2 ; . tosh:TripleRule-predicate a sh:PropertyShape ; sh:path sh:predicate ; dash:viewer dash:NodeExpressionViewer ; sh:description "The node expression producing the predicate(s) of the triple inferred by the rule." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:minCount 1 ; sh:name "predicate" ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order 1 ; . tosh:TripleRule-subject a sh:PropertyShape ; sh:path sh:subject ; dash:viewer dash:NodeExpressionViewer ; sh:description "The node expression producing the subject(s) of the triple inferred by the rule." ; sh:group tosh:ImplementationPropertyGroup ; sh:maxCount 1 ; sh:minCount 1 ; sh:name "subject" ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order 0 ; . tosh:TypeOfValuesPropertyGroup a sh:PropertyGroup ; rdfs:label "Type of Values" ; sh:order "50"^^xsd:decimal ; . tosh:URIInGraphViewer a dash:SingleViewer ; rdfs:comment "A viewer for URI resources that have their data in a given graph that may be outside of the imports closure. The graph must be specified using a tosh:graph constraint for the property." ; rdfs:label "URI in graph viewer" ; . tosh:UseDeclaredDatatypeConstraintComponent a sh:ConstraintComponent ; dash:propertySuggestionGenerator [ a dash:SPARQLUpdateSuggestionGenerator ; sh:message "Change datatype of the invalid value to the specified sh:datatype" ; sh:prefixes <http://topbraid.org/tosh> ; sh:update """DELETE { $subject $predicate $object . } INSERT { $subject $predicate ?newObject . } WHERE { $subject sh:datatype ?datatype . BIND (spif:cast(?object, ?datatype) AS ?newObject) . }""" ; ] ; rdfs:comment "Constrains the value nodes to be either non-literals or literals that have the same datatype as the declared sh:datatype for the given constraint node. This is used, among others, in properties such as sh:hasValue and sh:minExclusive." ; rdfs:label "Use declared datatype constraint component" ; sh:parameter [ a sh:Parameter ; sh:path tosh:useDeclaredDatatype ; sh:datatype xsd:boolean ; sh:description "True to state that the datatype of literal values must be the same as the declared sh:datatype." ; sh:name "use declared datatype" ; ] ; sh:propertyValidator [ a sh:SPARQLSelectValidator ; sh:message "Datatype must match the declared datatype " ; sh:prefixes <http://topbraid.org/tosh> ; sh:select """ SELECT DISTINCT $this ?value ?datatype WHERE { { FILTER ($useDeclaredDatatype) } $this sh:datatype ?datatype . $this $PATH ?value . FILTER (isLiteral(?value) && datatype(?value) != ?datatype) . }""" ; ] ; sh:targetClass sh:PropertyShape ; . tosh:ValidationPropertyGroup a sh:PropertyGroup ; rdfs:label "Validation" ; sh:order "30"^^xsd:decimal ; . tosh:ValidationTestCase-expectedResult a sh:PropertyShape ; sh:path dash:expectedResult ; sh:description "The expected validation report, either as instance of sh:ValidationReport or a Turtle string with one instance of sh:ValidationReport in it when parsed." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:name "expected result" ; sh:or ( [ sh:datatype xsd:string ; ] [ sh:class sh:ValidationReport ; ] ) ; sh:order "10"^^xsd:decimal ; . tosh:ValidationTestCase-includeSuggestions a sh:PropertyShape ; sh:path dash:includeSuggestions ; sh:datatype xsd:boolean ; sh:description "True to also generate and verify suggestions." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:name "include suggestions" ; sh:order "0"^^xsd:decimal ; . tosh:ValidationTestCase-validateShapes a sh:PropertyShape ; sh:path dash:validateShapes ; sh:datatype xsd:boolean ; sh:description "True to also validate shapes themselves." ; sh:group tosh:TestPropertiesPropertyGroup ; sh:maxCount 1 ; sh:name "validate shapes" ; sh:order "5"^^xsd:decimal ; . tosh:ValueConstraintsPropertyGroup a sh:PropertyGroup ; rdfs:label "Value Constraints" ; sh:order "60"^^xsd:decimal ; . tosh:ValueRangePropertyGroup a sh:PropertyGroup ; rdfs:label "Value Range" ; sh:order "60"^^xsd:decimal ; . tosh:countShapesWithMatchResult a sh:SPARQLFunction ; rdfs:comment "Counts the number of shapes from a given rdf:List (?arg2) defined in a given shapes graph (?arg3) where tosh:hasShape returns the provided match value (true or false, ?arg4) for a given focus node (?arg1). The function produces a failure if one of the shapes validated to a failure." ; rdfs:label "count shapes with match result" ; sh:parameter [ a sh:Parameter ; sh:path sh:expectedValue ; sh:datatype xsd:boolean ; sh:description "The expected value of tosh:hasShape to count." ; sh:order 3.0 ; ] ; sh:parameter [ a sh:Parameter ; sh:path sh:focusNode ; sh:class rdfs:Resource ; sh:description "The focus node." ; sh:order 0.0 ; ] ; sh:parameter [ a sh:Parameter ; sh:path sh:shapes ; sh:class rdf:List ; sh:description "The list of shapes to walk through." ; sh:order 1.0 ; ] ; sh:parameter [ a sh:Parameter ; sh:path sh:shapesGraph ; sh:class rdfs:Resource ; sh:description "The shapes graph." ; sh:order 2.0 ; ] ; sh:prefixes <http://topbraid.org/tosh> ; sh:returnType xsd:integer ; sh:select """ # The SUM will fail with an error if one of the operands is not a number # (this mechanism is used to propagate errors from tosh:hasShape calls) SELECT (SUM(?s) AS ?result) WHERE { GRAPH $shapesGraph { $shapes rdf:rest*/rdf:first ?shape . } BIND (tosh:hasShape($focusNode, ?shape, true) AS ?hasShape) . BIND (IF(bound(?hasShape), IF(?hasShape = $expectedValue, 1, 0), 'error') AS ?s) . } """ ; . tosh:editGroupDescription a rdf:Property ; rdfs:comment "A description of the property group when in \"edit\" mode." ; rdfs:domain sh:PropertyGroup ; rdfs:label "edit group description" ; rdfs:range xsd:string ; . tosh:graph a rdf:Property ; rdfs:comment "The graph that the shape is validated in." ; rdfs:label "graph" ; . tosh:hasDatatype a sh:SPARQLAskValidator ; rdfs:comment "Checks whether a given node ($value) is a literal with a given datatype ($datatype), and that the literal is well-formed." ; rdfs:label "has datatype" ; sh:ask """ ASK { FILTER (datatype($value) = $datatype && spif:isValidForDatatype($value, $datatype)) . } """ ; sh:prefixes <http://topbraid.org/tosh> ; . tosh:hasShape a sh:Function ; dash:apiStatus dash:Experimental ; rdfs:comment """A built-in function of the TopBraid SHACL implementation. Can be used to validate a given (focus) node against a given shape, returning <code>true</code> if the node is valid. If executed within a SHACL validation engine, this uses the shapes graph that was provided when the engine started. If executed in other contexts, e.g. in a stand-alone SPARQL query, the function attempts to use the URI of the current default graph as the shapes graph. This may not always be supported. If called from within an SWP engine, the shapes graph is the current query graph."""^^rdf:HTML ; rdfs:label "has shape" ; sh:parameter [ a sh:Parameter ; sh:path tosh:node ; sh:description "The node to validate." ; ] ; sh:parameter [ a sh:Parameter ; sh:path tosh:shape ; sh:description "The shape that the node is supposed to have." ; ] ; sh:returnType xsd:boolean ; . tosh:isHiddenClass a sh:SPARQLFunction ; dash:apiStatus dash:Experimental ; rdfs:comment "Checks if a given resource is supposed to be hidden in typical class displays. This applies to owl:Nothing, owl:NamedIndividual and owl:Restriction and any class that has dash:hidden true." ; rdfs:label "is hidden class" ; sh:ask """ASK { ?resource dash:hidden true . }""" ; sh:parameter [ a sh:Parameter ; sh:path tosh:resource ; sh:description "The node to check." ; sh:name "resource" ; sh:nodeKind sh:BlankNodeOrIRI ; ] ; sh:prefixes <http://topbraid.org/tosh> ; sh:returnType xsd:boolean ; . tosh:isInTargetOf a sh:Function ; dash:apiStatus dash:Experimental ; rdfs:comment "Checks whether a given node is in the target of
102
Misc clean up, updates to dash and tosh files
0
.ttl
ttl
apache-2.0
TopQuadrant/shacl
368
<NME> SH.java <BEF> /* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * See the NOTICE file distributed with this work for additional * information regarding copyright ownership. */ package org.topbraid.shacl.vocabulary; import org.apache.jena.rdf.model.Property; import org.apache.jena.rdf.model.Resource; import org.apache.jena.rdf.model.ResourceFactory; import org.apache.jena.sparql.core.Var; /** * Vocabulary for http://www.w3.org/ns/shacl# * * @author Holger Knublauch */ public class SH { public final static String BASE_URI = "http://www.w3.org/ns/shacl#"; public final static String NAME = "SHACL"; public final static String NS = BASE_URI; public final static String PREFIX = "sh"; public final static Resource AbstractResult = ResourceFactory.createResource(NS + "AbstractResult"); public final static Resource AndConstraintComponent = ResourceFactory.createResource(NS + "AndConstraintComponent"); public final static Resource BlankNode = ResourceFactory.createResource(NS + "BlankNode"); public final static Resource BlankNodeOrIRI = ResourceFactory.createResource(NS + "BlankNodeOrIRI"); public final static Resource BlankNodeOrLiteral = ResourceFactory.createResource(NS + "BlankNodeOrLiteral"); public final static Resource ClassConstraintComponent = ResourceFactory.createResource(NS + "ClassConstraintComponent"); public final static Resource ClosedConstraintComponent = ResourceFactory.createResource(NS + "ClosedConstraintComponent"); public final static Resource Constraint = ResourceFactory.createResource(NS + "Constraint"); public final static Resource ConstraintComponent = ResourceFactory.createResource(NS + "ConstraintComponent"); public final static Resource DatatypeConstraintComponent = ResourceFactory.createResource(NS + "DatatypeConstraintComponent"); public final static Resource DisjointConstraintComponent = ResourceFactory.createResource(NS + "DisjointConstraintComponent"); public final static Resource EqualsConstraintComponent = ResourceFactory.createResource(NS + "EqualsConstraintComponent"); public final static Resource HasValueConstraintComponent = ResourceFactory.createResource(NS + "HasValueConstraintComponent"); public final static Resource ResultAnnotation = ResourceFactory.createResource(NS + "ResultAnnotation"); public final static Resource Shape = ResourceFactory.createResource(NS + "Shape"); public final static Resource SPARQLAskValidator = ResourceFactory.createResource(NS + "SPARQLAskValidator"); public final static Resource LanguageInConstraintComponent = ResourceFactory.createResource(NS + "LanguageInConstraintComponent"); public final static Resource LessThanConstraintComponent = ResourceFactory.createResource(NS + "LessThanConstraintComponent"); public final static Resource LessThanOrEqualsConstraintComponent = ResourceFactory.createResource(NS + "LessThanOrEqualsConstraintComponent"); public final static Resource Literal = ResourceFactory.createResource(NS + "Literal"); public final static Resource MaxCountConstraintComponent = ResourceFactory.createResource(NS + "MaxCountConstraintComponent"); public final static Resource MaxExclusiveConstraintComponent = ResourceFactory.createResource(NS + "MaxExclusiveConstraintComponent"); public final static Resource MaxInclusiveConstraintComponent = ResourceFactory.createResource(NS + "MaxInclusiveConstraintComponent"); public final static Resource MaxLengthConstraintComponent = ResourceFactory.createResource(NS + "MaxLengthConstraintComponent"); public final static Resource MinCountConstraintComponent = ResourceFactory.createResource(NS + "MinCountConstraintComponent"); public final static Resource MinExclusiveConstraintComponent = ResourceFactory.createResource(NS + "MinExclusiveConstraintComponent"); public final static Resource MinInclusiveConstraintComponent = ResourceFactory.createResource(NS + "MinInclusiveConstraintComponent"); public final static Resource MinLengthConstraintComponent = ResourceFactory.createResource(NS + "MinLengthConstraintComponent"); public final static Resource NodeConstraintComponent = ResourceFactory.createResource(NS + "NodeConstraintComponent"); public final static Resource NodeKindConstraintComponent = ResourceFactory.createResource(NS + "NodeKindConstraintComponent"); public final static Resource NodeShape = ResourceFactory.createResource(NS + "NodeShape"); public final static Resource NotConstraintComponent = ResourceFactory.createResource(NS + "NotConstraintComponent"); public final static Resource OrConstraintComponent = ResourceFactory.createResource(NS + "OrConstraintComponent"); public final static Resource Parameter = ResourceFactory.createResource(NS + "Parameter"); public final static Resource Parameterizable = ResourceFactory.createResource(NS + "Parameterizable"); public final static Resource PatternConstraintComponent = ResourceFactory.createResource(NS + "PatternConstraintComponent"); public final static Resource PrefixDeclaration = ResourceFactory.createResource(NS + "PrefixDeclaration"); public final static Resource PropertyGroup = ResourceFactory.createResource(NS + "PropertyGroup"); public final static Resource PropertyShape = ResourceFactory.createResource(NS + "PropertyShape"); public final static Resource PropertyConstraintComponent = ResourceFactory.createResource(NS + "PropertyConstraintComponent"); public final static Resource QualifiedMaxCountConstraintComponent = ResourceFactory.createResource(NS + "QualifiedMaxCountConstraintComponent"); public final static Resource QualifiedMinCountConstraintComponent = ResourceFactory.createResource(NS + "QualifiedMinCountConstraintComponent"); public final static Resource ResultAnnotation = ResourceFactory.createResource(NS + "ResultAnnotation"); public final static Resource Shape = ResourceFactory.createResource(NS + "Shape"); public final static Resource SPARQLAskValidator = ResourceFactory.createResource(NS + "SPARQLAskValidator"); public final static Resource SPARQLConstraint = ResourceFactory.createResource(NS + "SPARQLConstraint"); public final static Resource SPARQLConstraintComponent = ResourceFactory.createResource(NS + "SPARQLConstraintComponent"); public final static Resource SPARQLConstructRule = ResourceFactory.createResource(NS + "SPARQLConstructRule"); public final static Resource SPARQLExecutable = ResourceFactory.createResource(NS + "SPARQLExecutable"); public final static Resource SPARQLFunction = ResourceFactory.createResource(NS + "SPARQLFunction"); public final static Resource SPARQLSelectValidator = ResourceFactory.createResource(NS + "SPARQLSelectValidator"); public final static Resource SPARQLTarget = ResourceFactory.createResource(NS + "SPARQLTarget"); public final static Resource SPARQLValuesDeriver = ResourceFactory.createResource(NS + "SPARQLValuesDeriver"); public final static Resource UniqueLangConstraintComponent = ResourceFactory.createResource(NS + "UniqueLangConstraintComponent"); public final static Resource ValidationReport = ResourceFactory.createResource(NS + "ValidationReport"); public final static Resource ValidationResult = ResourceFactory.createResource(NS + "ValidationResult"); public final static Resource Validator = ResourceFactory.createResource(NS + "Validator"); public final static Resource Violation = ResourceFactory.createResource(NS + "Violation"); public final static Resource Warning = ResourceFactory.createResource(NS + "Warning"); public final static Resource XoneConstraintComponent = ResourceFactory.createResource(NS + "XoneConstraintComponent"); public final static Property alternativePath = ResourceFactory.createProperty(NS + "alternativePath"); public final static Property and = ResourceFactory.createProperty(NS + "and"); public final static Property ask = ResourceFactory.createProperty(NS + "ask"); public final static Property class_ = ResourceFactory.createProperty(NS + "class"); public final static Property closed = ResourceFactory.createProperty(NS + "closed"); public final static Property condition = ResourceFactory.createProperty(NS + "condition"); public final static Property conforms = ResourceFactory.createProperty(NS + "conforms"); public final static Property construct = ResourceFactory.createProperty(NS + "construct"); public final static Property datatype = ResourceFactory.createProperty(NS + "datatype"); public final static Property deactivated = ResourceFactory.createProperty(NS + "deactivated"); public final static Property declare = ResourceFactory.createProperty(NS + "declare"); public final static Property defaultValue = ResourceFactory.createProperty(NS + "defaultValue"); public final static Property detail = ResourceFactory.createProperty(NS + "detail"); public final static Property description = ResourceFactory.createProperty(NS + "description"); public final static Property disjoint = ResourceFactory.createProperty(NS + "disjoint"); public final static Property entailment = ResourceFactory.createProperty(NS + "entailment"); public final static Property equals = ResourceFactory.createProperty(NS + "equals"); public final static Property flags = ResourceFactory.createProperty(NS + "flags"); public final static Property focusNode = ResourceFactory.createProperty(NS + "focusNode"); public final static Property group = ResourceFactory.createProperty(NS + "group"); public final static Property hasValue = ResourceFactory.createProperty(NS + "hasValue"); public final static Property ignoredProperties = ResourceFactory.createProperty(NS + "ignoredProperties"); public final static Property in = ResourceFactory.createProperty(NS + "in"); public final static Property inversePath = ResourceFactory.createProperty(NS + "inversePath"); public final static Property labelTemplate = ResourceFactory.createProperty(NS + "labelTemplate"); public final static Property languageIn = ResourceFactory.createProperty(NS + "languageIn"); public final static Property lessThan = ResourceFactory.createProperty(NS + "lessThan"); public final static Property lessThanOrEquals = ResourceFactory.createProperty(NS + "lessThanOrEquals"); public final static Property maxCount = ResourceFactory.createProperty(NS + "maxCount"); public final static Property maxExclusive = ResourceFactory.createProperty(NS + "maxExclusive"); public final static Property maxInclusive = ResourceFactory.createProperty(NS + "maxInclusive"); public final static Property maxLength = ResourceFactory.createProperty(NS + "maxLength"); public final static Property message = ResourceFactory.createProperty(NS + "message"); public final static Property minCount = ResourceFactory.createProperty(NS + "minCount"); public final static Property minExclusive = ResourceFactory.createProperty(NS + "minExclusive"); public final static Property minInclusive = ResourceFactory.createProperty(NS + "minInclusive"); public final static Property minLength = ResourceFactory.createProperty(NS + "minLength"); public final static Property name = ResourceFactory.createProperty(NS + "name"); public final static Property namespace = ResourceFactory.createProperty(NS + "namespace"); public final static Property node = ResourceFactory.createProperty(NS + "node"); public final static Property nodeKind = ResourceFactory.createProperty(NS + "nodeKind"); public final static Property nodeValidator = ResourceFactory.createProperty(NS + "nodeValidator"); public final static Property not = ResourceFactory.createProperty(NS + "not"); public final static Property oneOrMorePath = ResourceFactory.createProperty(NS + "oneOrMorePath"); public final static Property optional = ResourceFactory.createProperty(NS + "optional"); public final static Property or = ResourceFactory.createProperty(NS + "or"); public final static Property order = ResourceFactory.createProperty(NS + "order"); public final static Property parameter = ResourceFactory.createProperty(NS + "parameter"); public final static Property path = ResourceFactory.createProperty(NS + "path"); public final static Property pattern = ResourceFactory.createProperty(NS + "pattern"); public final static Property prefix = ResourceFactory.createProperty(NS + "prefix"); public final static Property prefixes = ResourceFactory.createProperty(NS + "prefixes"); public final static Property property = ResourceFactory.createProperty(NS + "property"); public final static Property propertyValidator = ResourceFactory.createProperty(NS + "propertyValidator"); public final static Property qualifiedMaxCount = ResourceFactory.createProperty(NS + "qualifiedMaxCount"); public final static Property qualifiedMinCount = ResourceFactory.createProperty(NS + "qualifiedMinCount"); public final static Property qualifiedValueShape = ResourceFactory.createProperty(NS + "qualifiedValueShape"); public final static Property qualifiedValueShapesDisjoint = ResourceFactory.createProperty(NS + "qualifiedValueShapesDisjoint"); public final static Property result = ResourceFactory.createProperty(NS + "result"); public final static Property resultMessage = ResourceFactory.createProperty(NS + "resultMessage"); public final static Property resultPath = ResourceFactory.createProperty(NS + "resultPath"); public final static Property resultSeverity = ResourceFactory.createProperty(NS + "resultSeverity"); public final static Property select = ResourceFactory.createProperty(NS + "select"); public final static Property severity = ResourceFactory.createProperty(NS + "severity"); public final static Property shapesGraph = ResourceFactory.createProperty(NS + "shapesGraph"); public final static Property sourceConstraint = ResourceFactory.createProperty(NS + "sourceConstraint"); public final static Property sourceConstraintComponent = ResourceFactory.createProperty(NS + "sourceConstraintComponent"); public final static Property sourceShape = ResourceFactory.createProperty(NS + "sourceShape"); public final static Property sparql = ResourceFactory.createProperty(NS + "sparql"); public final static Property targetClass = ResourceFactory.createProperty(NS + "targetClass"); public final static Property targetNode = ResourceFactory.createProperty(NS + "targetNode"); public final static Property targetObjectsOf = ResourceFactory.createProperty(NS + "targetObjectsOf"); public final static Property targetSubjectsOf = ResourceFactory.createProperty(NS + "targetSubjectsOf"); public final static Property uniqueLang = ResourceFactory.createProperty(NS + "uniqueLang"); public final static Property update = ResourceFactory.createProperty(NS + "update"); public final static Property validator = ResourceFactory.createProperty(NS + "validator"); public final static Property value = ResourceFactory.createProperty(NS + "value"); public final static Property zeroOrMorePath = ResourceFactory.createProperty(NS + "zeroOrMorePath"); public final static Property zeroOrOnePath = ResourceFactory.createProperty(NS + "zeroOrOnePath"); // Advanced features public final static Resource ExpressionConstraintComponent = ResourceFactory.createResource(NS + "ExpressionConstraintComponent"); public final static Resource Function = ResourceFactory.createResource(NS + "Function"); public final static Resource JSConstraint = ResourceFactory.createResource(NS + "JSConstraint"); public final static Resource JSConstraintComponent = ResourceFactory.createResource(NS + "JSConstraintComponent"); public final static Resource JSExecutable = ResourceFactory.createResource(NS + "JSExecutable"); public final static Resource JSFunction = ResourceFactory.createResource(NS + "JSFunction"); public final static Resource JSLibrary = ResourceFactory.createResource(NS + "JSLibrary"); public final static Resource JSRule = ResourceFactory.createResource(NS + "JSRule"); public final static Resource JSTarget = ResourceFactory.createResource(NS + "JSTarget"); public final static Resource JSTargetType = ResourceFactory.createResource(NS + "JSTargetType"); public final static Resource JSValidator = ResourceFactory.createResource(NS + "JSValidator"); public final static Resource Rule = ResourceFactory.createResource(NS + "Rule"); public final static Resource Rules = ResourceFactory.createResource(NS + "Rules"); public final static Resource SPARQLRule = ResourceFactory.createResource(NS + "SPARQLRule"); public final static Resource Target = ResourceFactory.createResource(NS + "Target"); public final static Resource this_ = ResourceFactory.createResource(NS + "this"); public final static Resource TripleRule = ResourceFactory.createResource(NS + "TripleRule"); public final static Property expression = ResourceFactory.createProperty(NS + "expression"); public final static Property filterShape = ResourceFactory.createProperty(NS + "filterShape"); public final static Property intersection = ResourceFactory.createProperty(NS + "intersection"); public final static Property js = ResourceFactory.createProperty(NS + "js"); public final static Property jsFunctionName = ResourceFactory.createProperty(NS + "jsFunctionName"); public final static Property jsLibrary = ResourceFactory.createProperty(NS + "jsLibrary"); public final static Property jsLibraryURL = ResourceFactory.createProperty(NS + "jsLibraryURL"); public final static Property member = ResourceFactory.createProperty(NS + "member"); public final static Property nodes = ResourceFactory.createProperty(NS + "nodes"); public final static Property object = ResourceFactory.createProperty(NS + "object"); public final static Property predicate = ResourceFactory.createProperty(NS + "predicate"); public final static Property returnType = ResourceFactory.createProperty(NS + "returnType"); public final static Property rule = ResourceFactory.createProperty(NS + "rule"); public final static Property subject = ResourceFactory.createProperty(NS + "subject"); public final static Property target = ResourceFactory.createProperty(NS + "target"); public final static Property union = ResourceFactory.createProperty(NS + "union"); // Features not in SHACL 1.0 but candidates for next release public final static Property count = ResourceFactory.createProperty(NS + "count"); public final static Property desc = ResourceFactory.createProperty(NS + "desc"); public final static Property distinct = ResourceFactory.createProperty(NS + "distinct"); public final static Property else_ = ResourceFactory.createProperty(NS + "else"); public final static Property exists = ResourceFactory.createProperty(NS + "exists"); public final static Property groupConcat = ResourceFactory.createProperty(NS + "groupConcat"); public final static Property if_ = ResourceFactory.createProperty(NS + "if"); public final static Property limit = ResourceFactory.createProperty(NS + "limit"); public final static Property max = ResourceFactory.createProperty(NS + "max"); public final static Property min = ResourceFactory.createProperty(NS + "min"); public final static Property minus = ResourceFactory.createProperty(NS + "minus"); public final static Property offset = ResourceFactory.createProperty(NS + "offset"); public final static Property orderBy = ResourceFactory.createProperty(NS + "orderBy"); public final static Property separator = ResourceFactory.createProperty(NS + "separator"); public final static Property sum = ResourceFactory.createProperty(NS + "sum"); public final static Property then = ResourceFactory.createProperty(NS + "then"); public final static Property values = ResourceFactory.createProperty(NS + "values"); public static final Var currentShapeVar = Var.alloc("currentShape"); public static final Var failureVar = Var.alloc("failure"); public static final Var PATHVar = Var.alloc("PATH"); public static final Var pathVar = Var.alloc(path.getLocalName()); public static final Var shapesGraphVar = Var.alloc("shapesGraph"); public static final Var thisVar = Var.alloc("this"); public static final Var valueVar = Var.alloc("value"); public final static String JS_DATA_VAR = "$data"; public final static String JS_SHAPES_VAR = "$shapes"; public static String getURI() { return NS; } } <MSG> Latest TopBraid snapshot <DFF> @@ -65,6 +65,8 @@ public class SH { public final static Resource ResultAnnotation = ResourceFactory.createResource(NS + "ResultAnnotation"); + public final static Resource Rule = ResourceFactory.createResource(NS + "Rule"); + public final static Resource Shape = ResourceFactory.createResource(NS + "Shape"); public final static Resource SPARQLAskValidator = ResourceFactory.createResource(NS + "SPARQLAskValidator");
2
Latest TopBraid snapshot
0
.java
java
apache-2.0
TopQuadrant/shacl
369
<NME> SH.java <BEF> /* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * See the NOTICE file distributed with this work for additional * information regarding copyright ownership. */ package org.topbraid.shacl.vocabulary; import org.apache.jena.rdf.model.Property; import org.apache.jena.rdf.model.Resource; import org.apache.jena.rdf.model.ResourceFactory; import org.apache.jena.sparql.core.Var; /** * Vocabulary for http://www.w3.org/ns/shacl# * * @author Holger Knublauch */ public class SH { public final static String BASE_URI = "http://www.w3.org/ns/shacl#"; public final static String NAME = "SHACL"; public final static String NS = BASE_URI; public final static String PREFIX = "sh"; public final static Resource AbstractResult = ResourceFactory.createResource(NS + "AbstractResult"); public final static Resource AndConstraintComponent = ResourceFactory.createResource(NS + "AndConstraintComponent"); public final static Resource BlankNode = ResourceFactory.createResource(NS + "BlankNode"); public final static Resource BlankNodeOrIRI = ResourceFactory.createResource(NS + "BlankNodeOrIRI"); public final static Resource BlankNodeOrLiteral = ResourceFactory.createResource(NS + "BlankNodeOrLiteral"); public final static Resource ClassConstraintComponent = ResourceFactory.createResource(NS + "ClassConstraintComponent"); public final static Resource ClosedConstraintComponent = ResourceFactory.createResource(NS + "ClosedConstraintComponent"); public final static Resource Constraint = ResourceFactory.createResource(NS + "Constraint"); public final static Resource ConstraintComponent = ResourceFactory.createResource(NS + "ConstraintComponent"); public final static Resource DatatypeConstraintComponent = ResourceFactory.createResource(NS + "DatatypeConstraintComponent"); public final static Resource DisjointConstraintComponent = ResourceFactory.createResource(NS + "DisjointConstraintComponent"); public final static Resource EqualsConstraintComponent = ResourceFactory.createResource(NS + "EqualsConstraintComponent"); public final static Resource HasValueConstraintComponent = ResourceFactory.createResource(NS + "HasValueConstraintComponent"); public final static Resource ResultAnnotation = ResourceFactory.createResource(NS + "ResultAnnotation"); public final static Resource Shape = ResourceFactory.createResource(NS + "Shape"); public final static Resource SPARQLAskValidator = ResourceFactory.createResource(NS + "SPARQLAskValidator"); public final static Resource LanguageInConstraintComponent = ResourceFactory.createResource(NS + "LanguageInConstraintComponent"); public final static Resource LessThanConstraintComponent = ResourceFactory.createResource(NS + "LessThanConstraintComponent"); public final static Resource LessThanOrEqualsConstraintComponent = ResourceFactory.createResource(NS + "LessThanOrEqualsConstraintComponent"); public final static Resource Literal = ResourceFactory.createResource(NS + "Literal"); public final static Resource MaxCountConstraintComponent = ResourceFactory.createResource(NS + "MaxCountConstraintComponent"); public final static Resource MaxExclusiveConstraintComponent = ResourceFactory.createResource(NS + "MaxExclusiveConstraintComponent"); public final static Resource MaxInclusiveConstraintComponent = ResourceFactory.createResource(NS + "MaxInclusiveConstraintComponent"); public final static Resource MaxLengthConstraintComponent = ResourceFactory.createResource(NS + "MaxLengthConstraintComponent"); public final static Resource MinCountConstraintComponent = ResourceFactory.createResource(NS + "MinCountConstraintComponent"); public final static Resource MinExclusiveConstraintComponent = ResourceFactory.createResource(NS + "MinExclusiveConstraintComponent"); public final static Resource MinInclusiveConstraintComponent = ResourceFactory.createResource(NS + "MinInclusiveConstraintComponent"); public final static Resource MinLengthConstraintComponent = ResourceFactory.createResource(NS + "MinLengthConstraintComponent"); public final static Resource NodeConstraintComponent = ResourceFactory.createResource(NS + "NodeConstraintComponent"); public final static Resource NodeKindConstraintComponent = ResourceFactory.createResource(NS + "NodeKindConstraintComponent"); public final static Resource NodeShape = ResourceFactory.createResource(NS + "NodeShape"); public final static Resource NotConstraintComponent = ResourceFactory.createResource(NS + "NotConstraintComponent"); public final static Resource OrConstraintComponent = ResourceFactory.createResource(NS + "OrConstraintComponent"); public final static Resource Parameter = ResourceFactory.createResource(NS + "Parameter"); public final static Resource Parameterizable = ResourceFactory.createResource(NS + "Parameterizable"); public final static Resource PatternConstraintComponent = ResourceFactory.createResource(NS + "PatternConstraintComponent"); public final static Resource PrefixDeclaration = ResourceFactory.createResource(NS + "PrefixDeclaration"); public final static Resource PropertyGroup = ResourceFactory.createResource(NS + "PropertyGroup"); public final static Resource PropertyShape = ResourceFactory.createResource(NS + "PropertyShape"); public final static Resource PropertyConstraintComponent = ResourceFactory.createResource(NS + "PropertyConstraintComponent"); public final static Resource QualifiedMaxCountConstraintComponent = ResourceFactory.createResource(NS + "QualifiedMaxCountConstraintComponent"); public final static Resource QualifiedMinCountConstraintComponent = ResourceFactory.createResource(NS + "QualifiedMinCountConstraintComponent"); public final static Resource ResultAnnotation = ResourceFactory.createResource(NS + "ResultAnnotation"); public final static Resource Shape = ResourceFactory.createResource(NS + "Shape"); public final static Resource SPARQLAskValidator = ResourceFactory.createResource(NS + "SPARQLAskValidator"); public final static Resource SPARQLConstraint = ResourceFactory.createResource(NS + "SPARQLConstraint"); public final static Resource SPARQLConstraintComponent = ResourceFactory.createResource(NS + "SPARQLConstraintComponent"); public final static Resource SPARQLConstructRule = ResourceFactory.createResource(NS + "SPARQLConstructRule"); public final static Resource SPARQLExecutable = ResourceFactory.createResource(NS + "SPARQLExecutable"); public final static Resource SPARQLFunction = ResourceFactory.createResource(NS + "SPARQLFunction"); public final static Resource SPARQLSelectValidator = ResourceFactory.createResource(NS + "SPARQLSelectValidator"); public final static Resource SPARQLTarget = ResourceFactory.createResource(NS + "SPARQLTarget"); public final static Resource SPARQLValuesDeriver = ResourceFactory.createResource(NS + "SPARQLValuesDeriver"); public final static Resource UniqueLangConstraintComponent = ResourceFactory.createResource(NS + "UniqueLangConstraintComponent"); public final static Resource ValidationReport = ResourceFactory.createResource(NS + "ValidationReport"); public final static Resource ValidationResult = ResourceFactory.createResource(NS + "ValidationResult"); public final static Resource Validator = ResourceFactory.createResource(NS + "Validator"); public final static Resource Violation = ResourceFactory.createResource(NS + "Violation"); public final static Resource Warning = ResourceFactory.createResource(NS + "Warning"); public final static Resource XoneConstraintComponent = ResourceFactory.createResource(NS + "XoneConstraintComponent"); public final static Property alternativePath = ResourceFactory.createProperty(NS + "alternativePath"); public final static Property and = ResourceFactory.createProperty(NS + "and"); public final static Property ask = ResourceFactory.createProperty(NS + "ask"); public final static Property class_ = ResourceFactory.createProperty(NS + "class"); public final static Property closed = ResourceFactory.createProperty(NS + "closed"); public final static Property condition = ResourceFactory.createProperty(NS + "condition"); public final static Property conforms = ResourceFactory.createProperty(NS + "conforms"); public final static Property construct = ResourceFactory.createProperty(NS + "construct"); public final static Property datatype = ResourceFactory.createProperty(NS + "datatype"); public final static Property deactivated = ResourceFactory.createProperty(NS + "deactivated"); public final static Property declare = ResourceFactory.createProperty(NS + "declare"); public final static Property defaultValue = ResourceFactory.createProperty(NS + "defaultValue"); public final static Property detail = ResourceFactory.createProperty(NS + "detail"); public final static Property description = ResourceFactory.createProperty(NS + "description"); public final static Property disjoint = ResourceFactory.createProperty(NS + "disjoint"); public final static Property entailment = ResourceFactory.createProperty(NS + "entailment"); public final static Property equals = ResourceFactory.createProperty(NS + "equals"); public final static Property flags = ResourceFactory.createProperty(NS + "flags"); public final static Property focusNode = ResourceFactory.createProperty(NS + "focusNode"); public final static Property group = ResourceFactory.createProperty(NS + "group"); public final static Property hasValue = ResourceFactory.createProperty(NS + "hasValue"); public final static Property ignoredProperties = ResourceFactory.createProperty(NS + "ignoredProperties"); public final static Property in = ResourceFactory.createProperty(NS + "in"); public final static Property inversePath = ResourceFactory.createProperty(NS + "inversePath"); public final static Property labelTemplate = ResourceFactory.createProperty(NS + "labelTemplate"); public final static Property languageIn = ResourceFactory.createProperty(NS + "languageIn"); public final static Property lessThan = ResourceFactory.createProperty(NS + "lessThan"); public final static Property lessThanOrEquals = ResourceFactory.createProperty(NS + "lessThanOrEquals"); public final static Property maxCount = ResourceFactory.createProperty(NS + "maxCount"); public final static Property maxExclusive = ResourceFactory.createProperty(NS + "maxExclusive"); public final static Property maxInclusive = ResourceFactory.createProperty(NS + "maxInclusive"); public final static Property maxLength = ResourceFactory.createProperty(NS + "maxLength"); public final static Property message = ResourceFactory.createProperty(NS + "message"); public final static Property minCount = ResourceFactory.createProperty(NS + "minCount"); public final static Property minExclusive = ResourceFactory.createProperty(NS + "minExclusive"); public final static Property minInclusive = ResourceFactory.createProperty(NS + "minInclusive"); public final static Property minLength = ResourceFactory.createProperty(NS + "minLength"); public final static Property name = ResourceFactory.createProperty(NS + "name"); public final static Property namespace = ResourceFactory.createProperty(NS + "namespace"); public final static Property node = ResourceFactory.createProperty(NS + "node"); public final static Property nodeKind = ResourceFactory.createProperty(NS + "nodeKind"); public final static Property nodeValidator = ResourceFactory.createProperty(NS + "nodeValidator"); public final static Property not = ResourceFactory.createProperty(NS + "not"); public final static Property oneOrMorePath = ResourceFactory.createProperty(NS + "oneOrMorePath"); public final static Property optional = ResourceFactory.createProperty(NS + "optional"); public final static Property or = ResourceFactory.createProperty(NS + "or"); public final static Property order = ResourceFactory.createProperty(NS + "order"); public final static Property parameter = ResourceFactory.createProperty(NS + "parameter"); public final static Property path = ResourceFactory.createProperty(NS + "path"); public final static Property pattern = ResourceFactory.createProperty(NS + "pattern"); public final static Property prefix = ResourceFactory.createProperty(NS + "prefix"); public final static Property prefixes = ResourceFactory.createProperty(NS + "prefixes"); public final static Property property = ResourceFactory.createProperty(NS + "property"); public final static Property propertyValidator = ResourceFactory.createProperty(NS + "propertyValidator"); public final static Property qualifiedMaxCount = ResourceFactory.createProperty(NS + "qualifiedMaxCount"); public final static Property qualifiedMinCount = ResourceFactory.createProperty(NS + "qualifiedMinCount"); public final static Property qualifiedValueShape = ResourceFactory.createProperty(NS + "qualifiedValueShape"); public final static Property qualifiedValueShapesDisjoint = ResourceFactory.createProperty(NS + "qualifiedValueShapesDisjoint"); public final static Property result = ResourceFactory.createProperty(NS + "result"); public final static Property resultMessage = ResourceFactory.createProperty(NS + "resultMessage"); public final static Property resultPath = ResourceFactory.createProperty(NS + "resultPath"); public final static Property resultSeverity = ResourceFactory.createProperty(NS + "resultSeverity"); public final static Property select = ResourceFactory.createProperty(NS + "select"); public final static Property severity = ResourceFactory.createProperty(NS + "severity"); public final static Property shapesGraph = ResourceFactory.createProperty(NS + "shapesGraph"); public final static Property sourceConstraint = ResourceFactory.createProperty(NS + "sourceConstraint"); public final static Property sourceConstraintComponent = ResourceFactory.createProperty(NS + "sourceConstraintComponent"); public final static Property sourceShape = ResourceFactory.createProperty(NS + "sourceShape"); public final static Property sparql = ResourceFactory.createProperty(NS + "sparql"); public final static Property targetClass = ResourceFactory.createProperty(NS + "targetClass"); public final static Property targetNode = ResourceFactory.createProperty(NS + "targetNode"); public final static Property targetObjectsOf = ResourceFactory.createProperty(NS + "targetObjectsOf"); public final static Property targetSubjectsOf = ResourceFactory.createProperty(NS + "targetSubjectsOf"); public final static Property uniqueLang = ResourceFactory.createProperty(NS + "uniqueLang"); public final static Property update = ResourceFactory.createProperty(NS + "update"); public final static Property validator = ResourceFactory.createProperty(NS + "validator"); public final static Property value = ResourceFactory.createProperty(NS + "value"); public final static Property zeroOrMorePath = ResourceFactory.createProperty(NS + "zeroOrMorePath"); public final static Property zeroOrOnePath = ResourceFactory.createProperty(NS + "zeroOrOnePath"); // Advanced features public final static Resource ExpressionConstraintComponent = ResourceFactory.createResource(NS + "ExpressionConstraintComponent"); public final static Resource Function = ResourceFactory.createResource(NS + "Function"); public final static Resource JSConstraint = ResourceFactory.createResource(NS + "JSConstraint"); public final static Resource JSConstraintComponent = ResourceFactory.createResource(NS + "JSConstraintComponent"); public final static Resource JSExecutable = ResourceFactory.createResource(NS + "JSExecutable"); public final static Resource JSFunction = ResourceFactory.createResource(NS + "JSFunction"); public final static Resource JSLibrary = ResourceFactory.createResource(NS + "JSLibrary"); public final static Resource JSRule = ResourceFactory.createResource(NS + "JSRule"); public final static Resource JSTarget = ResourceFactory.createResource(NS + "JSTarget"); public final static Resource JSTargetType = ResourceFactory.createResource(NS + "JSTargetType"); public final static Resource JSValidator = ResourceFactory.createResource(NS + "JSValidator"); public final static Resource Rule = ResourceFactory.createResource(NS + "Rule"); public final static Resource Rules = ResourceFactory.createResource(NS + "Rules"); public final static Resource SPARQLRule = ResourceFactory.createResource(NS + "SPARQLRule"); public final static Resource Target = ResourceFactory.createResource(NS + "Target"); public final static Resource this_ = ResourceFactory.createResource(NS + "this"); public final static Resource TripleRule = ResourceFactory.createResource(NS + "TripleRule"); public final static Property expression = ResourceFactory.createProperty(NS + "expression"); public final static Property filterShape = ResourceFactory.createProperty(NS + "filterShape"); public final static Property intersection = ResourceFactory.createProperty(NS + "intersection"); public final static Property js = ResourceFactory.createProperty(NS + "js"); public final static Property jsFunctionName = ResourceFactory.createProperty(NS + "jsFunctionName"); public final static Property jsLibrary = ResourceFactory.createProperty(NS + "jsLibrary"); public final static Property jsLibraryURL = ResourceFactory.createProperty(NS + "jsLibraryURL"); public final static Property member = ResourceFactory.createProperty(NS + "member"); public final static Property nodes = ResourceFactory.createProperty(NS + "nodes"); public final static Property object = ResourceFactory.createProperty(NS + "object"); public final static Property predicate = ResourceFactory.createProperty(NS + "predicate"); public final static Property returnType = ResourceFactory.createProperty(NS + "returnType"); public final static Property rule = ResourceFactory.createProperty(NS + "rule"); public final static Property subject = ResourceFactory.createProperty(NS + "subject"); public final static Property target = ResourceFactory.createProperty(NS + "target"); public final static Property union = ResourceFactory.createProperty(NS + "union"); // Features not in SHACL 1.0 but candidates for next release public final static Property count = ResourceFactory.createProperty(NS + "count"); public final static Property desc = ResourceFactory.createProperty(NS + "desc"); public final static Property distinct = ResourceFactory.createProperty(NS + "distinct"); public final static Property else_ = ResourceFactory.createProperty(NS + "else"); public final static Property exists = ResourceFactory.createProperty(NS + "exists"); public final static Property groupConcat = ResourceFactory.createProperty(NS + "groupConcat"); public final static Property if_ = ResourceFactory.createProperty(NS + "if"); public final static Property limit = ResourceFactory.createProperty(NS + "limit"); public final static Property max = ResourceFactory.createProperty(NS + "max"); public final static Property min = ResourceFactory.createProperty(NS + "min"); public final static Property minus = ResourceFactory.createProperty(NS + "minus"); public final static Property offset = ResourceFactory.createProperty(NS + "offset"); public final static Property orderBy = ResourceFactory.createProperty(NS + "orderBy"); public final static Property separator = ResourceFactory.createProperty(NS + "separator"); public final static Property sum = ResourceFactory.createProperty(NS + "sum"); public final static Property then = ResourceFactory.createProperty(NS + "then"); public final static Property values = ResourceFactory.createProperty(NS + "values"); public static final Var currentShapeVar = Var.alloc("currentShape"); public static final Var failureVar = Var.alloc("failure"); public static final Var PATHVar = Var.alloc("PATH"); public static final Var pathVar = Var.alloc(path.getLocalName()); public static final Var shapesGraphVar = Var.alloc("shapesGraph"); public static final Var thisVar = Var.alloc("this"); public static final Var valueVar = Var.alloc("value"); public final static String JS_DATA_VAR = "$data"; public final static String JS_SHAPES_VAR = "$shapes"; public static String getURI() { return NS; } } <MSG> Latest TopBraid snapshot <DFF> @@ -65,6 +65,8 @@ public class SH { public final static Resource ResultAnnotation = ResourceFactory.createResource(NS + "ResultAnnotation"); + public final static Resource Rule = ResourceFactory.createResource(NS + "Rule"); + public final static Resource Shape = ResourceFactory.createResource(NS + "Shape"); public final static Resource SPARQLAskValidator = ResourceFactory.createResource(NS + "SPARQLAskValidator");
2
Latest TopBraid snapshot
0
.java
java
apache-2.0
TopQuadrant/shacl
370
<NME> SHACLPaths.java <BEF> package org.topbraid.shacl.arq; import java.util.Iterator; import org.apache.jena.rdf.model.Model; import org.apache.jena.rdf.model.RDFList; import org.apache.jena.rdf.model.RDFNode; import org.apache.jena.rdf.model.Resource; import org.apache.jena.rdf.model.Statement; import org.apache.jena.sparql.util.FmtUtils; import org.apache.jena.vocabulary.RDF; import org.topbraid.shacl.vocabulary.SH; import org.topbraid.spin.util.JenaUtil; /** import org.apache.jena.sparql.path.P_Alt; import org.apache.jena.sparql.path.P_Inverse; import org.apache.jena.sparql.path.P_Link; import org.apache.jena.sparql.path.P_OneOrMore1; import org.apache.jena.sparql.path.P_OneOrMoreN; import org.apache.jena.sparql.path.P_Path1; import org.apache.jena.sparql.path.P_Seq; import org.apache.jena.sparql.path.P_ZeroOrMore1; import org.apache.jena.sparql.path.P_ZeroOrMoreN; import org.apache.jena.sparql.path.P_ZeroOrOne; import org.apache.jena.sparql.path.Path; import org.apache.jena.sparql.path.PathFactory; import org.apache.jena.sparql.path.eval.PathEval; import org.apache.jena.sparql.syntax.Element; import org.apache.jena.sparql.syntax.ElementGroup; import org.apache.jena.sparql.syntax.ElementPathBlock; import org.apache.jena.sparql.syntax.ElementTriplesBlock; import org.apache.jena.sparql.util.Context; import org.apache.jena.sparql.util.FmtUtils; import org.apache.jena.util.iterator.ExtendedIterator; import org.apache.jena.vocabulary.RDF; import org.topbraid.jenax.util.ARQFactory; import org.topbraid.shacl.vocabulary.SH; /** * Utilties to manage the conversion between SHACL paths and SPARQL 1.1 property paths. * * @author Holger Knublauch */ sb.append(FmtUtils.stringForNode(path.asNode(), path.getModel())); } else { appendPathBlankNode(sb, path, SEQUENCE_PATH_SEPARATOR); } } public static void addValueNodes(RDFNode focusNode, Path path, Collection<RDFNode> results) { Set<Node> seen = new HashSet<>(); Iterator<Node> it = PathEval.eval(focusNode.getModel().getGraph(), focusNode.asNode(), path, Context.emptyContext()); while(it.hasNext()) { Node node = it.next(); if(!seen.contains(node)) { seen.add(node); results.add(focusNode.getModel().asRDFNode(node)); } } } public static void addValueNodes(RDFNode focusNode, Property predicate, Collection<RDFNode> results) { if(focusNode instanceof Resource) { StmtIterator it = ((Resource)focusNode).listProperties(predicate); while(it.hasNext()) { results.add(it.next().getObject()); } } } /** * Renders a given path into a given StringBuffer, using the prefixes supplied by the * Path's Model. * @param sb the StringBuffer to write into sb.append("+"); } else if(path.hasProperty(SH.zeroOrOnePath)) { sb.append("?"); appendNestedPath(sb, JenaUtil.getResourceProperty(path, SH.zeroOrOnePath), SEQUENCE_PATH_SEPARATOR); } } } } private static void appendNestedPath(StringBuffer sb, Resource path, String separator) { if(path.isURIResource()) { sb.append(FmtUtils.stringForNode(path.asNode(), path.getModel())); } else { sb.append("("); appendPathBlankNode(sb, path, separator); sb.append(")"); } } public static String getPathString(Resource path) { StringBuffer sb = new StringBuffer(); appendPath(sb, path); }).iterator()); result.addProperty(SH.alternativePath, list); return result; } else if(path instanceof P_Inverse) { Resource result = model.createResource(); result.addProperty(SH.inversePath, createPath(((P_Inverse) path).getSubPath(), model)); return result; } else if(path instanceof P_Link) { return (Resource) model.asRDFNode(((P_Link) path).getNode()); } else if(path instanceof P_OneOrMore1 || path instanceof P_OneOrMoreN) { Resource result = model.createResource(); result.addProperty(SH.oneOrMorePath, createPath(((P_Path1)path).getSubPath(), model)); return result; } if(path instanceof P_Seq) { return model.createList(Arrays.asList(new RDFNode[] { createPath(((P_Seq) path).getLeft(), model), createPath(((P_Seq) path).getRight(), model) }).iterator()); } else if(path instanceof P_ZeroOrMore1 || path instanceof P_ZeroOrMoreN) { Resource result = model.createResource(); result.addProperty(SH.zeroOrMorePath, createPath(((P_Path1)path).getSubPath(), model)); return result; } else if(path instanceof P_ZeroOrOne) { Resource result = model.createResource(); result.addProperty(SH.zeroOrOnePath, createPath(((P_Path1)path).getSubPath(), model)); return result; } else { throw new IllegalArgumentException("Path element not supported by SHACL syntax: " + path); } } public static Object getJenaPath(Resource path) throws QueryParseException { if(path.isURIResource()) { return path; } else { try { return getPath(path); } catch(Exception ex) { throw new IllegalArgumentException("Not a SPARQL 1.1 Path expression", ex); } } } /** * Attempts to parse a given string into a Jena Path. * Throws an Exception if the string cannot be parsed. * @param string the string to parse * @param model the Model to operate on (for prefixes) * @return a Path or a Resource if this is a URI */ public static Object getJenaPath(String string, Model model) throws QueryParseException { Query query = ARQFactory.get().createQuery(model, "ASK { ?a \n" + string + "\n ?b }"); Element element = query.getQueryPattern(); if(element instanceof ElementGroup) { Element e = ((ElementGroup)element).getElements().get(0); if(e instanceof ElementPathBlock) { Path path = ((ElementPathBlock) e).getPattern().get(0).getPath(); if(path instanceof P_Link && ((P_Link)path).isForward()) { return model.asRDFNode(((P_Link)path).getNode()); } else { return path; } } else if(e instanceof ElementTriplesBlock) { return model.asRDFNode(((ElementTriplesBlock) e).getPattern().get(0).getPredicate()); } } throw new QueryParseException("Not a SPARQL 1.1 Path expression", 2, 1); } public static Path getPath(Resource shaclPath) { if(shaclPath.isURIResource()) { return PathFactory.pathLink(shaclPath.asNode()); } { Resource inversePath = shaclPath.getPropertyResourceValue(SH.inversePath); if(inversePath != null) { return PathFactory.pathInverse(getPath(inversePath)); } } { Resource first = shaclPath.getPropertyResourceValue(RDF.first); if(first != null) { Resource rest = shaclPath.getPropertyResourceValue(RDF.rest); if(RDF.nil.equals(rest)) { return getPath(first); } else { return PathFactory.pathSeq(getPath(first), getPath(rest)); } } } { Resource alternativePath = shaclPath.getPropertyResourceValue(SH.alternativePath); if(alternativePath != null) { ExtendedIterator<Path> members = alternativePath.as(RDFList.class).iterator(). mapWith(node -> getPath(node.asResource())); try { return getPathAlt(members); } finally { members.close(); } } } { Resource zeroOrMorePath = shaclPath.getPropertyResourceValue(SH.zeroOrMorePath); if(zeroOrMorePath != null) { return PathFactory.pathZeroOrMore1(getPath(zeroOrMorePath)); } } { Resource oneOrMorePath = shaclPath.getPropertyResourceValue(SH.oneOrMorePath); if(oneOrMorePath != null) { return PathFactory.pathOneOrMore1(getPath(oneOrMorePath)); } } { Resource zeroOrOnePath = shaclPath.getPropertyResourceValue(SH.zeroOrOnePath); if(zeroOrOnePath != null) { return PathFactory.pathZeroOrOne(getPath(zeroOrOnePath)); } } throw new IllegalArgumentException("Malformed SHACL path expression"); } private static Path getPathAlt(Iterator<Path> it) { Path first = it.next(); if(it.hasNext()) { return PathFactory.pathAlt(first, getPathAlt(it)); } else { return first; } } public static String getPathString(Resource path) { StringBuffer sb = new StringBuffer(); appendPath(sb, path); return sb.toString(); } } <MSG> Moved to official Jena 3.1 release, fixed issue with path syntax <DFF> @@ -1,15 +1,34 @@ package org.topbraid.shacl.arq; +import java.util.Arrays; import java.util.Iterator; +import org.apache.jena.query.Query; +import org.apache.jena.query.QueryParseException; import org.apache.jena.rdf.model.Model; import org.apache.jena.rdf.model.RDFList; import org.apache.jena.rdf.model.RDFNode; import org.apache.jena.rdf.model.Resource; import org.apache.jena.rdf.model.Statement; +import org.apache.jena.sparql.path.P_Alt; +import org.apache.jena.sparql.path.P_Inverse; +import org.apache.jena.sparql.path.P_Link; +import org.apache.jena.sparql.path.P_OneOrMore1; +import org.apache.jena.sparql.path.P_OneOrMoreN; +import org.apache.jena.sparql.path.P_Path1; +import org.apache.jena.sparql.path.P_Seq; +import org.apache.jena.sparql.path.P_ZeroOrMore1; +import org.apache.jena.sparql.path.P_ZeroOrMoreN; +import org.apache.jena.sparql.path.P_ZeroOrOne; +import org.apache.jena.sparql.path.Path; +import org.apache.jena.sparql.syntax.Element; +import org.apache.jena.sparql.syntax.ElementGroup; +import org.apache.jena.sparql.syntax.ElementPathBlock; +import org.apache.jena.sparql.syntax.ElementTriplesBlock; import org.apache.jena.sparql.util.FmtUtils; import org.apache.jena.vocabulary.RDF; import org.topbraid.shacl.vocabulary.SH; +import org.topbraid.spin.arq.ARQFactory; import org.topbraid.spin.util.JenaUtil; /** @@ -45,7 +64,7 @@ public class SHACLPaths { sb.append(FmtUtils.stringForNode(path.asNode(), path.getModel())); } else { - appendPathBlankNode(sb, path, SEQUENCE_PATH_SEPARATOR); + appendPathBlankNode(sb, path, separator); } } @@ -79,8 +98,8 @@ public class SHACLPaths { sb.append("+"); } else if(path.hasProperty(SH.zeroOrOnePath)) { - sb.append("?"); appendNestedPath(sb, JenaUtil.getResourceProperty(path, SH.zeroOrOnePath), SEQUENCE_PATH_SEPARATOR); + sb.append("?"); } } @@ -100,6 +119,80 @@ public class SHACLPaths { } + /** + * Creates SHACL RDF triples for a given Jena Path (which may have been created using getJenaPath). + * @param path the Jena Path + * @param model the Model to create the triples in + * @return the (root) Resource of the SHACL path + */ + public static Resource createPath(Path path, Model model) { + if(path instanceof P_Alt) { + Resource result = model.createResource(); + RDFList list = model.createList(Arrays.asList(new RDFNode[] { + createPath(((P_Alt) path).getLeft(), model), + createPath(((P_Alt) path).getRight(), model) + }).iterator()); + result.addProperty(SH.alternativePath, list); + return result; + } + else if(path instanceof P_Inverse) { + Resource result = model.createResource(); + result.addProperty(SH.inversePath, createPath(((P_Inverse) path).getSubPath(), model)); + return result; + } + else if(path instanceof P_Link) { + return (Resource) model.asRDFNode(((P_Link) path).getNode()); + } + else if(path instanceof P_OneOrMore1 || path instanceof P_OneOrMoreN) { + Resource result = model.createResource(); + result.addProperty(SH.oneOrMorePath, createPath(((P_Path1)path).getSubPath(), model)); + return result; + } + if(path instanceof P_Seq) { + return model.createList(Arrays.asList(new RDFNode[] { + createPath(((P_Seq) path).getLeft(), model), + createPath(((P_Seq) path).getRight(), model) + }).iterator()); + } + else if(path instanceof P_ZeroOrMore1 || path instanceof P_ZeroOrMoreN) { + Resource result = model.createResource(); + result.addProperty(SH.zeroOrMorePath, createPath(((P_Path1)path).getSubPath(), model)); + return result; + } + else if(path instanceof P_ZeroOrOne) { + Resource result = model.createResource(); + result.addProperty(SH.zeroOrOnePath, createPath(((P_Path1)path).getSubPath(), model)); + return result; + } + else { + throw new IllegalArgumentException("Path element not supported by SHACL syntax: " + path); + } + } + + + /** + * Attempts to parse a given string into a Jena Path. + * Throws an Exception if the string cannot be parsed. + * @param string the string to parse + * @param model the Model to operate on (for prefixes) + * @return a Path or a Resource if this is a URI + */ + public static Object getJenaPath(String string, Model model) throws QueryParseException { + Query query = ARQFactory.get().createQuery(model, "ASK { ?a \n" + string + "\n ?b }"); + Element element = query.getQueryPattern(); + if(element instanceof ElementGroup) { + Element e = ((ElementGroup)element).getElements().get(0); + if(e instanceof ElementPathBlock) { + return ((ElementPathBlock) e).getPattern().get(0).getPath(); + } + else if(e instanceof ElementTriplesBlock) { + return model.asRDFNode(((ElementTriplesBlock) e).getPattern().get(0).getPredicate()); + } + } + throw new QueryParseException("Not a SPARQL 1.1 Path expression", 2, 1); + } + + public static String getPathString(Resource path) { StringBuffer sb = new StringBuffer(); appendPath(sb, path);
95
Moved to official Jena 3.1 release, fixed issue with path syntax
2
.java
java
apache-2.0
TopQuadrant/shacl
371
<NME> SHACLPaths.java <BEF> package org.topbraid.shacl.arq; import java.util.Iterator; import org.apache.jena.rdf.model.Model; import org.apache.jena.rdf.model.RDFList; import org.apache.jena.rdf.model.RDFNode; import org.apache.jena.rdf.model.Resource; import org.apache.jena.rdf.model.Statement; import org.apache.jena.sparql.util.FmtUtils; import org.apache.jena.vocabulary.RDF; import org.topbraid.shacl.vocabulary.SH; import org.topbraid.spin.util.JenaUtil; /** import org.apache.jena.sparql.path.P_Alt; import org.apache.jena.sparql.path.P_Inverse; import org.apache.jena.sparql.path.P_Link; import org.apache.jena.sparql.path.P_OneOrMore1; import org.apache.jena.sparql.path.P_OneOrMoreN; import org.apache.jena.sparql.path.P_Path1; import org.apache.jena.sparql.path.P_Seq; import org.apache.jena.sparql.path.P_ZeroOrMore1; import org.apache.jena.sparql.path.P_ZeroOrMoreN; import org.apache.jena.sparql.path.P_ZeroOrOne; import org.apache.jena.sparql.path.Path; import org.apache.jena.sparql.path.PathFactory; import org.apache.jena.sparql.path.eval.PathEval; import org.apache.jena.sparql.syntax.Element; import org.apache.jena.sparql.syntax.ElementGroup; import org.apache.jena.sparql.syntax.ElementPathBlock; import org.apache.jena.sparql.syntax.ElementTriplesBlock; import org.apache.jena.sparql.util.Context; import org.apache.jena.sparql.util.FmtUtils; import org.apache.jena.util.iterator.ExtendedIterator; import org.apache.jena.vocabulary.RDF; import org.topbraid.jenax.util.ARQFactory; import org.topbraid.shacl.vocabulary.SH; /** * Utilties to manage the conversion between SHACL paths and SPARQL 1.1 property paths. * * @author Holger Knublauch */ sb.append(FmtUtils.stringForNode(path.asNode(), path.getModel())); } else { appendPathBlankNode(sb, path, SEQUENCE_PATH_SEPARATOR); } } public static void addValueNodes(RDFNode focusNode, Path path, Collection<RDFNode> results) { Set<Node> seen = new HashSet<>(); Iterator<Node> it = PathEval.eval(focusNode.getModel().getGraph(), focusNode.asNode(), path, Context.emptyContext()); while(it.hasNext()) { Node node = it.next(); if(!seen.contains(node)) { seen.add(node); results.add(focusNode.getModel().asRDFNode(node)); } } } public static void addValueNodes(RDFNode focusNode, Property predicate, Collection<RDFNode> results) { if(focusNode instanceof Resource) { StmtIterator it = ((Resource)focusNode).listProperties(predicate); while(it.hasNext()) { results.add(it.next().getObject()); } } } /** * Renders a given path into a given StringBuffer, using the prefixes supplied by the * Path's Model. * @param sb the StringBuffer to write into sb.append("+"); } else if(path.hasProperty(SH.zeroOrOnePath)) { sb.append("?"); appendNestedPath(sb, JenaUtil.getResourceProperty(path, SH.zeroOrOnePath), SEQUENCE_PATH_SEPARATOR); } } } } private static void appendNestedPath(StringBuffer sb, Resource path, String separator) { if(path.isURIResource()) { sb.append(FmtUtils.stringForNode(path.asNode(), path.getModel())); } else { sb.append("("); appendPathBlankNode(sb, path, separator); sb.append(")"); } } public static String getPathString(Resource path) { StringBuffer sb = new StringBuffer(); appendPath(sb, path); }).iterator()); result.addProperty(SH.alternativePath, list); return result; } else if(path instanceof P_Inverse) { Resource result = model.createResource(); result.addProperty(SH.inversePath, createPath(((P_Inverse) path).getSubPath(), model)); return result; } else if(path instanceof P_Link) { return (Resource) model.asRDFNode(((P_Link) path).getNode()); } else if(path instanceof P_OneOrMore1 || path instanceof P_OneOrMoreN) { Resource result = model.createResource(); result.addProperty(SH.oneOrMorePath, createPath(((P_Path1)path).getSubPath(), model)); return result; } if(path instanceof P_Seq) { return model.createList(Arrays.asList(new RDFNode[] { createPath(((P_Seq) path).getLeft(), model), createPath(((P_Seq) path).getRight(), model) }).iterator()); } else if(path instanceof P_ZeroOrMore1 || path instanceof P_ZeroOrMoreN) { Resource result = model.createResource(); result.addProperty(SH.zeroOrMorePath, createPath(((P_Path1)path).getSubPath(), model)); return result; } else if(path instanceof P_ZeroOrOne) { Resource result = model.createResource(); result.addProperty(SH.zeroOrOnePath, createPath(((P_Path1)path).getSubPath(), model)); return result; } else { throw new IllegalArgumentException("Path element not supported by SHACL syntax: " + path); } } public static Object getJenaPath(Resource path) throws QueryParseException { if(path.isURIResource()) { return path; } else { try { return getPath(path); } catch(Exception ex) { throw new IllegalArgumentException("Not a SPARQL 1.1 Path expression", ex); } } } /** * Attempts to parse a given string into a Jena Path. * Throws an Exception if the string cannot be parsed. * @param string the string to parse * @param model the Model to operate on (for prefixes) * @return a Path or a Resource if this is a URI */ public static Object getJenaPath(String string, Model model) throws QueryParseException { Query query = ARQFactory.get().createQuery(model, "ASK { ?a \n" + string + "\n ?b }"); Element element = query.getQueryPattern(); if(element instanceof ElementGroup) { Element e = ((ElementGroup)element).getElements().get(0); if(e instanceof ElementPathBlock) { Path path = ((ElementPathBlock) e).getPattern().get(0).getPath(); if(path instanceof P_Link && ((P_Link)path).isForward()) { return model.asRDFNode(((P_Link)path).getNode()); } else { return path; } } else if(e instanceof ElementTriplesBlock) { return model.asRDFNode(((ElementTriplesBlock) e).getPattern().get(0).getPredicate()); } } throw new QueryParseException("Not a SPARQL 1.1 Path expression", 2, 1); } public static Path getPath(Resource shaclPath) { if(shaclPath.isURIResource()) { return PathFactory.pathLink(shaclPath.asNode()); } { Resource inversePath = shaclPath.getPropertyResourceValue(SH.inversePath); if(inversePath != null) { return PathFactory.pathInverse(getPath(inversePath)); } } { Resource first = shaclPath.getPropertyResourceValue(RDF.first); if(first != null) { Resource rest = shaclPath.getPropertyResourceValue(RDF.rest); if(RDF.nil.equals(rest)) { return getPath(first); } else { return PathFactory.pathSeq(getPath(first), getPath(rest)); } } } { Resource alternativePath = shaclPath.getPropertyResourceValue(SH.alternativePath); if(alternativePath != null) { ExtendedIterator<Path> members = alternativePath.as(RDFList.class).iterator(). mapWith(node -> getPath(node.asResource())); try { return getPathAlt(members); } finally { members.close(); } } } { Resource zeroOrMorePath = shaclPath.getPropertyResourceValue(SH.zeroOrMorePath); if(zeroOrMorePath != null) { return PathFactory.pathZeroOrMore1(getPath(zeroOrMorePath)); } } { Resource oneOrMorePath = shaclPath.getPropertyResourceValue(SH.oneOrMorePath); if(oneOrMorePath != null) { return PathFactory.pathOneOrMore1(getPath(oneOrMorePath)); } } { Resource zeroOrOnePath = shaclPath.getPropertyResourceValue(SH.zeroOrOnePath); if(zeroOrOnePath != null) { return PathFactory.pathZeroOrOne(getPath(zeroOrOnePath)); } } throw new IllegalArgumentException("Malformed SHACL path expression"); } private static Path getPathAlt(Iterator<Path> it) { Path first = it.next(); if(it.hasNext()) { return PathFactory.pathAlt(first, getPathAlt(it)); } else { return first; } } public static String getPathString(Resource path) { StringBuffer sb = new StringBuffer(); appendPath(sb, path); return sb.toString(); } } <MSG> Moved to official Jena 3.1 release, fixed issue with path syntax <DFF> @@ -1,15 +1,34 @@ package org.topbraid.shacl.arq; +import java.util.Arrays; import java.util.Iterator; +import org.apache.jena.query.Query; +import org.apache.jena.query.QueryParseException; import org.apache.jena.rdf.model.Model; import org.apache.jena.rdf.model.RDFList; import org.apache.jena.rdf.model.RDFNode; import org.apache.jena.rdf.model.Resource; import org.apache.jena.rdf.model.Statement; +import org.apache.jena.sparql.path.P_Alt; +import org.apache.jena.sparql.path.P_Inverse; +import org.apache.jena.sparql.path.P_Link; +import org.apache.jena.sparql.path.P_OneOrMore1; +import org.apache.jena.sparql.path.P_OneOrMoreN; +import org.apache.jena.sparql.path.P_Path1; +import org.apache.jena.sparql.path.P_Seq; +import org.apache.jena.sparql.path.P_ZeroOrMore1; +import org.apache.jena.sparql.path.P_ZeroOrMoreN; +import org.apache.jena.sparql.path.P_ZeroOrOne; +import org.apache.jena.sparql.path.Path; +import org.apache.jena.sparql.syntax.Element; +import org.apache.jena.sparql.syntax.ElementGroup; +import org.apache.jena.sparql.syntax.ElementPathBlock; +import org.apache.jena.sparql.syntax.ElementTriplesBlock; import org.apache.jena.sparql.util.FmtUtils; import org.apache.jena.vocabulary.RDF; import org.topbraid.shacl.vocabulary.SH; +import org.topbraid.spin.arq.ARQFactory; import org.topbraid.spin.util.JenaUtil; /** @@ -45,7 +64,7 @@ public class SHACLPaths { sb.append(FmtUtils.stringForNode(path.asNode(), path.getModel())); } else { - appendPathBlankNode(sb, path, SEQUENCE_PATH_SEPARATOR); + appendPathBlankNode(sb, path, separator); } } @@ -79,8 +98,8 @@ public class SHACLPaths { sb.append("+"); } else if(path.hasProperty(SH.zeroOrOnePath)) { - sb.append("?"); appendNestedPath(sb, JenaUtil.getResourceProperty(path, SH.zeroOrOnePath), SEQUENCE_PATH_SEPARATOR); + sb.append("?"); } } @@ -100,6 +119,80 @@ public class SHACLPaths { } + /** + * Creates SHACL RDF triples for a given Jena Path (which may have been created using getJenaPath). + * @param path the Jena Path + * @param model the Model to create the triples in + * @return the (root) Resource of the SHACL path + */ + public static Resource createPath(Path path, Model model) { + if(path instanceof P_Alt) { + Resource result = model.createResource(); + RDFList list = model.createList(Arrays.asList(new RDFNode[] { + createPath(((P_Alt) path).getLeft(), model), + createPath(((P_Alt) path).getRight(), model) + }).iterator()); + result.addProperty(SH.alternativePath, list); + return result; + } + else if(path instanceof P_Inverse) { + Resource result = model.createResource(); + result.addProperty(SH.inversePath, createPath(((P_Inverse) path).getSubPath(), model)); + return result; + } + else if(path instanceof P_Link) { + return (Resource) model.asRDFNode(((P_Link) path).getNode()); + } + else if(path instanceof P_OneOrMore1 || path instanceof P_OneOrMoreN) { + Resource result = model.createResource(); + result.addProperty(SH.oneOrMorePath, createPath(((P_Path1)path).getSubPath(), model)); + return result; + } + if(path instanceof P_Seq) { + return model.createList(Arrays.asList(new RDFNode[] { + createPath(((P_Seq) path).getLeft(), model), + createPath(((P_Seq) path).getRight(), model) + }).iterator()); + } + else if(path instanceof P_ZeroOrMore1 || path instanceof P_ZeroOrMoreN) { + Resource result = model.createResource(); + result.addProperty(SH.zeroOrMorePath, createPath(((P_Path1)path).getSubPath(), model)); + return result; + } + else if(path instanceof P_ZeroOrOne) { + Resource result = model.createResource(); + result.addProperty(SH.zeroOrOnePath, createPath(((P_Path1)path).getSubPath(), model)); + return result; + } + else { + throw new IllegalArgumentException("Path element not supported by SHACL syntax: " + path); + } + } + + + /** + * Attempts to parse a given string into a Jena Path. + * Throws an Exception if the string cannot be parsed. + * @param string the string to parse + * @param model the Model to operate on (for prefixes) + * @return a Path or a Resource if this is a URI + */ + public static Object getJenaPath(String string, Model model) throws QueryParseException { + Query query = ARQFactory.get().createQuery(model, "ASK { ?a \n" + string + "\n ?b }"); + Element element = query.getQueryPattern(); + if(element instanceof ElementGroup) { + Element e = ((ElementGroup)element).getElements().get(0); + if(e instanceof ElementPathBlock) { + return ((ElementPathBlock) e).getPattern().get(0).getPath(); + } + else if(e instanceof ElementTriplesBlock) { + return model.asRDFNode(((ElementTriplesBlock) e).getPattern().get(0).getPredicate()); + } + } + throw new QueryParseException("Not a SPARQL 1.1 Path expression", 2, 1); + } + + public static String getPathString(Resource path) { StringBuffer sb = new StringBuffer(); appendPath(sb, path);
95
Moved to official Jena 3.1 release, fixed issue with path syntax
2
.java
java
apache-2.0
TopQuadrant/shacl
372
<NME> Validate.java <BEF> ADDFILE <MSG> Started with stand-alone tools <DFF> @@ -0,0 +1,31 @@ +package org.topbraid.shacl.tools; + +import java.io.IOException; + +import org.apache.jena.rdf.model.Model; +import org.apache.jena.rdf.model.Resource; +import org.apache.jena.util.FileUtils; +import org.topbraid.shacl.validation.ValidationUtil; + +/** + * Stand-alone utility to perform constraint validation of a given file. + * + * Example arguments: + * + * -datafile my.ttl + * + * @author Holger Knublauch + */ +public class Validate extends AbstractTool { + + public static void main(String[] args) throws IOException { + new Validate().run(args); + } + + + private void run(String[] args) throws IOException { + Model dataModel = getDataModel(args); + Resource report = ValidationUtil.validateModel(dataModel, dataModel, true); + report.getModel().write(System.out, FileUtils.langTurtle); + } +}
31
Started with stand-alone tools
0
.java
java
apache-2.0
TopQuadrant/shacl
373
<NME> Validate.java <BEF> ADDFILE <MSG> Started with stand-alone tools <DFF> @@ -0,0 +1,31 @@ +package org.topbraid.shacl.tools; + +import java.io.IOException; + +import org.apache.jena.rdf.model.Model; +import org.apache.jena.rdf.model.Resource; +import org.apache.jena.util.FileUtils; +import org.topbraid.shacl.validation.ValidationUtil; + +/** + * Stand-alone utility to perform constraint validation of a given file. + * + * Example arguments: + * + * -datafile my.ttl + * + * @author Holger Knublauch + */ +public class Validate extends AbstractTool { + + public static void main(String[] args) throws IOException { + new Validate().run(args); + } + + + private void run(String[] args) throws IOException { + Model dataModel = getDataModel(args); + Resource report = ValidationUtil.validateModel(dataModel, dataModel, true); + report.getModel().write(System.out, FileUtils.langTurtle); + } +}
31
Started with stand-alone tools
0
.java
java
apache-2.0
TopQuadrant/shacl
374
<NME> SHACLUtil.java <BEF> /* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * See the NOTICE file distributed with this work for additional * information regarding copyright ownership. */ package org.topbraid.shacl.util; import java.net.URI; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Set; import java.util.UUID; import org.apache.jena.graph.Graph; import org.apache.jena.graph.Node; import org.apache.jena.graph.Triple; import org.apache.jena.graph.compose.MultiUnion; import org.apache.jena.query.Dataset; import org.apache.jena.query.Query; import org.apache.jena.query.QueryExecution; import org.apache.jena.query.QuerySolutionMap; import org.apache.jena.query.ResultSet; import org.apache.jena.rdf.model.Model; import org.apache.jena.rdf.model.ModelFactory; import org.apache.jena.rdf.model.Property; import org.apache.jena.rdf.model.RDFNode; import org.apache.jena.rdf.model.Resource; import org.apache.jena.rdf.model.Statement; import org.apache.jena.rdf.model.StmtIterator; import org.apache.jena.util.iterator.ExtendedIterator; import org.apache.jena.vocabulary.OWL; import org.apache.jena.vocabulary.RDF; import org.apache.jena.vocabulary.RDFS; import org.topbraid.jenax.util.ARQFactory; import org.topbraid.jenax.util.JenaDatatypes; import org.topbraid.jenax.util.JenaNodeUtil; import org.topbraid.jenax.util.JenaUtil; import org.topbraid.shacl.model.SHConstraintComponent; import org.topbraid.shacl.model.SHFactory; import org.topbraid.shacl.model.SHNodeShape; import org.topbraid.shacl.model.SHParameter; import org.topbraid.shacl.model.SHParameterizableTarget; import org.topbraid.shacl.model.SHPropertyShape; import org.topbraid.shacl.model.SHResult; import org.topbraid.shacl.optimize.OntologyOptimizations; import org.topbraid.shacl.optimize.OptimizedMultiUnion; import org.topbraid.shacl.targets.CustomTargetLanguage; import org.topbraid.shacl.targets.CustomTargets; import org.topbraid.shacl.vocabulary.DASH; import org.topbraid.shacl.vocabulary.SH; /** * Various SHACL-related utility methods that didn't fit elsewhere. * * @author Holger Knublauch */ public class SHACLUtil { public final static Resource[] RESULT_TYPES = { DASH.FailureResult, DASH.SuccessResult, SH.ValidationResult }; public final static String SHAPES_FILE_PART = ".shapes."; public static final String URN_X_SHACL = "urn:x-shacl:"; private static final Set<Property> SPARQL_PROPERTIES = new HashSet<Property>(); static { SPARQL_PROPERTIES.add(SH.ask); SPARQL_PROPERTIES.add(SH.construct); SPARQL_PROPERTIES.add(SH.select); SPARQL_PROPERTIES.add(SH.update); } private static Query propertyLabelQuery = ARQFactory.get().createQuery( "PREFIX rdfs: <" + RDFS.getURI() + ">\n" + "PREFIX sh: <" + SH.NS + ">\n" + "SELECT ?label\n" + "WHERE {\n" + " ?arg2 a ?type .\n" + " ?type rdfs:subClassOf* ?class .\n" + " ?shape <" + SH.targetClass + ">* ?class .\n" + " ?shape <" + SH.property + ">|<" + SH.parameter + "> ?p .\n" + " ?p <" + SH.path + "> ?arg1 .\n" + " ?p rdfs:label ?label .\n" + "}"); public static void addDirectPropertiesOfClass(Resource cls, Collection<Property> results) { for(Resource argument : JenaUtil.getResourceProperties(cls, SH.parameter)) { Resource predicate = argument.getPropertyResourceValue(SH.path); if(predicate != null && predicate.isURIResource() && !results.contains(predicate)) { results.add(JenaUtil.asProperty(predicate)); } } for(Resource property : JenaUtil.getResourceProperties(cls, SH.property)) { Resource predicate = property.getPropertyResourceValue(SH.path); if(predicate != null && predicate.isURIResource() && !results.contains(predicate)) { results.add(JenaUtil.asProperty(predicate)); } } } private static void addIncludes(Graph model, String uri, Set<Graph> graphs, Set<String> reachedURIs) { graphs.add(model); reachedURIs.add(uri); for(Triple t : model.find(null, OWL.imports.asNode(), null).toList()) { if(t.getObject().isURI()) { String includeURI = t.getObject().getURI(); if(!reachedURIs.contains(includeURI)) { Model includeModel = ARQFactory.getNamedModel(includeURI); if(includeModel != null) { Graph includeGraph = includeModel.getGraph(); addIncludes(includeGraph, includeURI, graphs, reachedURIs); } } } } } /** * Adds all resources from a given sh:target to a given results Set of Nodes. * @param target the value of sh:target (parameterized or SPARQL target) * @param dataset the dataset to operate on * @param results the Set to add the resulting Nodes to */ public static void addNodesInTarget(Resource target, Dataset dataset, Set<Node> results) { for(RDFNode focusNode : getResourcesInTarget(target, dataset)) { results.add(focusNode.asNode()); } } /** * Creates an includes Model for a given input Model. * The includes Model is the union of the input Model will all graphs linked via * sh:include (or owl:imports), transitively. * @param model the Model to create the includes Model for * @param graphURI the URI of the named graph represented by Model * @return a Model including the semantics */ public static Model createIncludesModel(Model model, String graphURI) { Set<Graph> graphs = new HashSet<Graph>(); Graph baseGraph = model.getGraph(); addIncludes(baseGraph, graphURI, graphs, new HashSet<String>()); if(graphs.size() == 1) { return model; } else { MultiUnion union = new MultiUnion(graphs.iterator()); union.setBaseGraph(baseGraph); return ModelFactory.createModelForGraph(union); } } public static URI createRandomShapesGraphURI() { return URI.create(URN_X_SHACL + UUID.randomUUID()); } /** * Gets all focus nodes from the default Model of a given dataset. * This includes all targets of all defined targets as well as all instances of classes that * are also shapes. * @param dataset the Dataset * @param validateShapes true to include the validation of constraint components * @return a Set of focus Nodes */ public static Set<Node> getAllFocusNodes(Dataset dataset, boolean validateShapes) { Set<Node> results = new HashSet<Node>(); // Add all instances of classes that are also shapes Model model = dataset.getDefaultModel(); for(Resource shape : JenaUtil.getAllInstances(SH.Shape.inModel(model))) { if(JenaUtil.hasIndirectType(shape, RDFS.Class)) { for(Resource instance : JenaUtil.getAllInstances(shape)) { results.add(instance.asNode()); } } } // Add all instances of classes mentioned in sh:targetClass triples for(Statement s : model.listStatements(null, SH.targetClass, (RDFNode)null).toList()) { if(s.getObject().isResource()) { if(validateShapes || (!JenaUtil.hasIndirectType(s.getSubject(), SH.ConstraintComponent) && !SH.PropertyShape.equals(s.getObject())) && !SH.Constraint.equals(s.getObject())) { for(Resource instance : JenaUtil.getAllInstances(s.getResource())) { results.add(instance.asNode()); } } } } // Add all objects of sh:targetNode triples for(Statement s : model.listStatements(null, SH.targetNode, (RDFNode)null).toList()) { results.add(s.getObject().asNode()); } // Add all target nodes of sh:target triples for(Statement s : model.listStatements(null, SH.target, (RDFNode)null).toList()) { if(s.getObject().isResource()) { Resource target = s.getResource(); for(RDFNode focusNode : SHACLUtil.getResourcesInTarget(target, dataset)) { results.add(focusNode.asNode()); } } } // Add all objects of the predicate used as sh:targetObjectsOf for(RDFNode property : model.listObjectsOfProperty(SH.targetObjectsOf).toList()) { if(property.isURIResource()) { Property predicate = JenaUtil.asProperty((Resource)property); for(RDFNode focusNode : model.listObjectsOfProperty(predicate).toList()) { results.add(focusNode.asNode()); } } } // Add all subjects of the predicate used as sh:targetSubjectsOf for(RDFNode property : model.listObjectsOfProperty(SH.targetSubjectsOf).toList()) { if(property.isURIResource()) { Property predicate = JenaUtil.asProperty((Resource)property); for(RDFNode focusNode : model.listSubjectsWithProperty(predicate).toList()) { results.add(focusNode.asNode()); } } } return results; } public static List<SHResult> getAllTopLevelResults(Model model) { List<SHResult> results = new LinkedList<SHResult>(); for(Resource type : RESULT_TYPES) { for(Resource r : model.listResourcesWithProperty(RDF.type, type).toList()) { if(!model.contains(null, SH.detail, r)) { results.add(r.as(SHResult.class)); } } } return results; } /** * Gets all (transitive) superclasses including shapes that reference a class via sh:targetClass. * @param cls the class to start at * @return a Set of classes and shapes */ public static Set<Resource> getAllSuperClassesAndShapesStar(Resource cls) { Set<Resource> results = new HashSet<Resource>(); getAllSuperClassesAndShapesStarHelper(cls, results); return results; } private static void getAllSuperClassesAndShapesStarHelper(Resource node, Set<Resource> results) { if(!results.contains(node)) { results.add(node); { StmtIterator it = node.listProperties(RDFS.subClassOf); while(it.hasNext()) { Statement s = it.next(); if(s.getObject().isResource()) { getAllSuperClassesAndShapesStarHelper(s.getResource(), results); } } } { StmtIterator it = node.getModel().listStatements(null, SH.targetClass, node); while(it.hasNext()) { getAllSuperClassesAndShapesStarHelper(it.next().getSubject(), results); } } } } public static SHConstraintComponent getConstraintComponentOfValidator(Resource validator) { for(Statement s : validator.getModel().listStatements(null, null, validator).toList()) { if(SH.validator.equals(s.getPredicate()) || SH.nodeValidator.equals(s.getPredicate()) || SH.propertyValidator.equals(s.getPredicate())) { return s.getSubject().as(SHConstraintComponent.class); } } return null; } public static Resource getDefaultTypeForConstraintPredicate(Property predicate) { if(SH.property.equals(predicate)) { return SH.PropertyShape; } else if(SH.parameter.equals(predicate)) { return SH.Parameter; } else { throw new IllegalArgumentException(); } } public static SHParameter getParameterAtClass(Resource cls, Property predicate) { for(Resource c : JenaUtil.getAllSuperClassesStar(cls)) { for(Resource arg : JenaUtil.getResourceProperties(c, SH.parameter)) { if(arg.hasProperty(SH.path, predicate)) { return SHFactory.asParameter(arg); } } } return null; } public static SHParameter getParameterAtInstance(Resource instance, Property predicate) { for(Resource type : JenaUtil.getTypes(instance)) { SHParameter argument = getParameterAtClass(type, predicate); if(argument != null) { return argument; } } return null; } // Simplified to only check for sh:property and sh:parameter (not sh:node etc) public static Resource getResourceDefaultType(Resource resource) { if(resource.getModel().contains(null, SH.property, resource)) { return SH.PropertyShape.inModel(resource.getModel()); } else if(resource.getModel().contains(null, SH.parameter, resource)) { return SH.Parameter.inModel(resource.getModel()); } /* StmtIterator it = resource.getModel().listStatements(null, null, resource); try { while(it.hasNext()) { Statement s = it.next(); Resource defaultValueType = JenaUtil.getResourceProperty(s.getPredicate(), DASH.defaultValueType); if(defaultValueType != null) { return defaultValueType; } } } finally { it.close(); }*/ return null; } /** * Gets any locally-defined label for a given property. * The labels are expected to be attached to shapes associated with a given * context resource (instance). * That context resource may for example be the subject of the current UI form. * @param property the property to get the label of * @param context the context instance * @return the local label or null if it should fall back to a global label */ public static String getLocalPropertyLabel(Resource property, Resource context) { QuerySolutionMap binding = new QuerySolutionMap(); binding.add("arg1", property); binding.add("arg2", context); try(QueryExecution qexec = ARQFactory.get().createQueryExecution(propertyLabelQuery, property.getModel(), binding)) { ResultSet rs = qexec.execSelect(); if(rs.hasNext()) { return rs.next().get("label").asLiteral().getLexicalForm(); } } return null; } public static SHPropertyShape getPropertyConstraintAtClass(Resource cls, Property predicate) { for(Resource c : JenaUtil.getAllSuperClassesStar(cls)) { for(Resource arg : JenaUtil.getResourceProperties(c, SH.property)) { if(arg.hasProperty(SH.path, predicate)) { return SHFactory.asPropertyShape(arg); } } } return null; } public static SHPropertyShape getPropertyConstraintAtInstance(Resource instance, Property predicate) { for(Resource type : JenaUtil.getTypes(instance)) { SHPropertyShape property = getPropertyConstraintAtClass(type, predicate); if(property != null) { return property; } } return null; } /** * Gets all the predicates of all declared sh:properties and sh:parameters * of a given class, including inherited ones. * @param cls the class to get the predicates of * @return the declared predicates */ public static List<Property> getAllPropertiesOfClass(Resource cls) { List<Property> results = new LinkedList<Property>(); for(Resource c : getAllSuperClassesAndShapesStar(cls)) { addDirectPropertiesOfClass(c, results); } return results; } /** * Gets all nodes from a given sh:target. * @param target the value of sh:target (parameterizable or SPARQL target) * @param dataset the dataset to operate on * @return an Iterable over the resources */ public static Iterable<RDFNode> getResourcesInTarget(Resource target, Dataset dataset) { Resource type = JenaUtil.getType(target); Resource executable; SHParameterizableTarget parameterizableTarget = null; if(SHFactory.isParameterizableInstance(target)) { executable = type; parameterizableTarget = SHFactory.asParameterizableTarget(target); } else { executable = target; } CustomTargetLanguage plugin = CustomTargets.get().getLanguageForTarget(executable); if(plugin != null) { Set<RDFNode> results = new HashSet<>(); plugin.createTarget(executable, parameterizableTarget).addTargetNodes(dataset, results); return results; } else { return new ArrayList<>(); } } /** * Gets all shapes associated with a given focus node. * This looks for all shapes based on class-based targets. * Future versions will also look for property-based targets. * @param node the (focus) node * @return a List of shapes */ public static List<SHNodeShape> getAllShapesAtNode(RDFNode node) { return getAllShapesAtNode(node, node instanceof Resource ? JenaUtil.getTypes((Resource)node) : null); } public static List<SHNodeShape> getAllShapesAtNode(RDFNode node, Iterable<Resource> types) { List<SHNodeShape> results = new LinkedList<>(); if(node instanceof Resource) { Set<Resource> reached = new HashSet<>(); for(Resource type : types) { addAllShapesAtClassOrShape(type, results, reached); } } // TODO: support sh:targetObjectsOf and sh:targetSubjectsOf return results; } /** * Gets all sh:Shapes that have a given class in their target, including ConstraintComponents * and the class or shape itself if it is marked as sh:Shape. * Also walks up the class hierarchy. * @param clsOrShape the class or Shape to get the shapes of * @return the shapes, ordered by the most specialized (subclass) first */ @SuppressWarnings("unchecked") public static List<SHNodeShape> getAllShapesAtClassOrShape(Resource clsOrShape) { String key = OntologyOptimizations.get().getKeyIfEnabledFor(clsOrShape.getModel().getGraph()); if(key != null) { private static void addDirectShapesAtClassOrShape(Resource clsOrShape, List<SHNodeShape> results) { if(JenaUtil.hasIndirectType(clsOrShape, SH.Shape) && !results.contains(clsOrShape)) { results.add(SHFactory.asNodeShape(clsOrShape)); } // More correct would be: if(JenaUtil.hasIndirectType(clsOrShape, RDFS.Class)) { { return results; } } private static void addAllShapesAtClassOrShape(Resource clsOrShape, List<SHNodeShape> results, Set<Resource> reached) { addDirectShapesAtClassOrShape(clsOrShape, results); reached.add(clsOrShape); for(Resource superClass : JenaUtil.getSuperClasses(clsOrShape)) { if(!reached.contains(superClass)) { addAllShapesAtClassOrShape(superClass, results, reached); } } } /** * Gets the directly associated sh:Shapes that have a given class in their target, * including ConstraintComponents and the class or shape itself if it is marked as sh:Shape. * Does not walk up the class hierarchy. * @param clsOrShape the class or Shape to get the shapes of * @return the shapes */ public static Collection<SHNodeShape> getDirectShapesAtClassOrShape(Resource clsOrShape) { List<SHNodeShape> results = new LinkedList<SHNodeShape>(); addDirectShapesAtClassOrShape(clsOrShape, results); return results; } private static void addDirectShapesAtClassOrShape(Resource clsOrShape, List<SHNodeShape> results) { if(JenaUtil.hasIndirectType(clsOrShape, SH.Shape) && !results.contains(clsOrShape)) { SHNodeShape shape = SHFactory.asNodeShape(clsOrShape); if(!shape.isDeactivated()) { results.add(shape); } } // More correct would be: if(JenaUtil.hasIndirectType(clsOrShape, RDFS.Class)) { { StmtIterator it = clsOrShape.getModel().listStatements(null, SH.targetClass, clsOrShape); while(it.hasNext()) { Resource subject = it.next().getSubject(); if(!results.contains(subject)) { SHNodeShape shape = SHFactory.asNodeShape(subject); if(!shape.isDeactivated()) { results.add(shape); } } } } } public static Set<Resource> getDirectShapesAtResource(Resource resource) { Set<Resource> shapes = new HashSet<>(); for(Resource type : JenaUtil.getResourceProperties(resource, RDF.type)) { if(JenaUtil.hasIndirectType(type, SH.NodeShape)) { shapes.add(type); } Set<Resource> ts = JenaUtil.getAllSuperClassesStar(type); for(Resource s : ts) { { StmtIterator it = type.getModel().listStatements(null, DASH.applicableToClass, s); while(it.hasNext()) { Resource shape = it.next().getSubject(); shapes.add(shape); } } { StmtIterator it = type.getModel().listStatements(null, SH.targetClass, s); while(it.hasNext()) { Resource shape = it.next().getSubject(); shapes.add(shape); } } } } return shapes; } public static List<RDFNode> getTargetNodes(Resource shape, Dataset dataset) { return getTargetNodes(shape, dataset, false); } public static List<RDFNode> getTargetNodes(Resource shape, Dataset dataset, boolean includeApplicableToClass) { Model dataModel = dataset.getDefaultModel(); Set<RDFNode> results = new HashSet<RDFNode>(); if(JenaUtil.hasIndirectType(shape, RDFS.Class)) { results.addAll(JenaUtil.getAllInstances(shape.inModel(dataModel))); } for(Resource targetClass : JenaUtil.getResourceProperties(shape, SH.targetClass)) { results.addAll(JenaUtil.getAllInstances(targetClass.inModel(dataModel))); } for(RDFNode targetNode : shape.getModel().listObjectsOfProperty(shape, SH.targetNode).toList()) { results.add(targetNode.inModel(dataModel)); } for(Resource sof : JenaUtil.getResourceProperties(shape, SH.targetSubjectsOf)) { for(Statement s : dataModel.listStatements(null, JenaUtil.asProperty(sof), (RDFNode)null).toList()) { results.add(s.getSubject()); } } for(Resource sof : JenaUtil.getResourceProperties(shape, SH.targetObjectsOf)) { for(Statement s : dataModel.listStatements(null, JenaUtil.asProperty(sof), (RDFNode)null).toList()) { results.add(s.getObject()); } } for(Resource target : JenaUtil.getResourceProperties(shape, SH.target)) { for(RDFNode targetNode : SHACLUtil.getResourcesInTarget(target, dataset)) { results.add(targetNode); } } if(includeApplicableToClass) { for(Resource targetClass : JenaUtil.getResourceProperties(shape, DASH.applicableToClass)) { results.addAll(JenaUtil.getAllInstances(targetClass.inModel(dataModel))); } } return new ArrayList<RDFNode>(results); } public static List<Resource> getTypes(Resource subject) { List<Resource> types = JenaUtil.getTypes(subject); if(types.isEmpty()) { Resource defaultType = getResourceDefaultType(subject); if(defaultType != null) { return Collections.singletonList(defaultType); } } return types; } public static boolean hasMinSeverity(Resource severity, Resource minSeverity) { if(minSeverity == null || SH.Info.equals(minSeverity)) { return true; } if(SH.Warning.equals(minSeverity)) { return !SH.Info.equals(severity); } else { // SH.Error return SH.Violation.equals(severity); } } public static boolean isDeactivated(Resource resource) { return resource.hasProperty(SH.deactivated, JenaDatatypes.TRUE); } public static boolean isParameterAtInstance(Resource subject, Property predicate) { for(Resource type : getTypes(subject)) { Resource arg = getParameterAtClass(type, predicate); if(arg != null) { return true; } } return false; } public static boolean isSPARQLProperty(Property property) { return SPARQL_PROPERTIES.contains(property); } /** * Checks whether the SHACL vocabulary is present in a given Model. * The condition is that the SHACL namespace must be declared and * sh:Constraint must have an rdf:type. * @param model the Model to check * @return true if SHACL is present */ public static boolean exists(Model model) { return model != null && exists(model.getGraph()); } public static boolean exists(Graph graph) { if(graph instanceof OptimizedMultiUnion) { return ((OptimizedMultiUnion)graph).getIncludesSHACL(); } else { return graph != null && SH.NS.equals(graph.getPrefixMapping().getNsPrefixURI(SH.PREFIX)) && graph.contains(SH.Shape.asNode(), RDF.type.asNode(), Node.ANY); } } public static URI withShapesGraph(Dataset dataset) { URI shapesGraphURI = createRandomShapesGraphURI(); Model shapesModel = createShapesModel(dataset); dataset.addNamedModel(shapesGraphURI.toString(), shapesModel); return shapesGraphURI; } /** * Creates a shapes Model for a given input Model. * The shapes Model is the union of the input Model with all graphs referenced via * the sh:shapesGraph property (and transitive includes or shapesGraphs of those). * @param model the Model to create the shapes Model for * @return a shapes graph Model */ private static Model createShapesModel(Dataset dataset) { Model model = dataset.getDefaultModel(); Set<Graph> graphs = new HashSet<Graph>(); Graph baseGraph = model.getGraph(); graphs.add(baseGraph); for(Statement s : model.listStatements(null, SH.shapesGraph, (RDFNode)null).toList()) { if(s.getObject().isURIResource()) { String graphURI = s.getResource().getURI(); Model sm = dataset.getNamedModel(graphURI); graphs.add(sm.getGraph()); // TODO: Include includes of sm } } if(graphs.size() > 1) { MultiUnion union = new MultiUnion(graphs.iterator()); union.setBaseGraph(baseGraph); return ModelFactory.createModelForGraph(union); } else { return model; } } public static boolean isInTarget(RDFNode focusNode, Dataset dataset, Resource target) { SHParameterizableTarget parameterizableTarget = null; Resource executable = target; if(SHFactory.isParameterizableInstance(target)) { parameterizableTarget = SHFactory.asParameterizableTarget(target); executable = parameterizableTarget.getParameterizable(); } CustomTargetLanguage plugin = CustomTargets.get().getLanguageForTarget(executable); if(plugin != null) { return plugin.createTarget(executable, parameterizableTarget).contains(dataset, focusNode); } else { return false; } } public static Node walkPropertyShapesHelper(Node propertyShape, Graph graph) { Node valueType = JenaNodeUtil.getObject(propertyShape, SH.class_.asNode(), graph); if(valueType != null) { return valueType; } Node datatype = JenaNodeUtil.getObject(propertyShape, SH.datatype.asNode(), graph); if(datatype != null) { return datatype; } ExtendedIterator<Triple> ors = graph.find(propertyShape, SH.or.asNode(), Node.ANY); while(ors.hasNext()) { Node or = ors.next().getObject(); Node first = JenaNodeUtil.getObject(or, RDF.first.asNode(), graph); if(!first.isLiteral()) { Node cls = JenaNodeUtil.getObject(first, SH.class_.asNode(), graph); if(cls != null) { ors.close(); return cls; } datatype = JenaNodeUtil.getObject(first, SH.datatype.asNode(), graph); if(datatype != null) { ors.close(); return datatype; } } } if(graph.contains(propertyShape, SH.node.asNode(), DASH.ListShape.asNode())) { return RDF.List.asNode(); } return null; } } <MSG> Tracking TopBraid API <DFF> @@ -505,7 +505,10 @@ public class SHACLUtil { private static void addDirectShapesAtClassOrShape(Resource clsOrShape, List<SHNodeShape> results) { if(JenaUtil.hasIndirectType(clsOrShape, SH.Shape) && !results.contains(clsOrShape)) { - results.add(SHFactory.asNodeShape(clsOrShape)); + SHNodeShape shape = SHFactory.asNodeShape(clsOrShape); + if(!shape.isDeactivated()) { + results.add(shape); + } } // More correct would be: if(JenaUtil.hasIndirectType(clsOrShape, RDFS.Class)) { {
4
Tracking TopBraid API
1
.java
java
apache-2.0
TopQuadrant/shacl
375
<NME> SHACLUtil.java <BEF> /* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * See the NOTICE file distributed with this work for additional * information regarding copyright ownership. */ package org.topbraid.shacl.util; import java.net.URI; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Set; import java.util.UUID; import org.apache.jena.graph.Graph; import org.apache.jena.graph.Node; import org.apache.jena.graph.Triple; import org.apache.jena.graph.compose.MultiUnion; import org.apache.jena.query.Dataset; import org.apache.jena.query.Query; import org.apache.jena.query.QueryExecution; import org.apache.jena.query.QuerySolutionMap; import org.apache.jena.query.ResultSet; import org.apache.jena.rdf.model.Model; import org.apache.jena.rdf.model.ModelFactory; import org.apache.jena.rdf.model.Property; import org.apache.jena.rdf.model.RDFNode; import org.apache.jena.rdf.model.Resource; import org.apache.jena.rdf.model.Statement; import org.apache.jena.rdf.model.StmtIterator; import org.apache.jena.util.iterator.ExtendedIterator; import org.apache.jena.vocabulary.OWL; import org.apache.jena.vocabulary.RDF; import org.apache.jena.vocabulary.RDFS; import org.topbraid.jenax.util.ARQFactory; import org.topbraid.jenax.util.JenaDatatypes; import org.topbraid.jenax.util.JenaNodeUtil; import org.topbraid.jenax.util.JenaUtil; import org.topbraid.shacl.model.SHConstraintComponent; import org.topbraid.shacl.model.SHFactory; import org.topbraid.shacl.model.SHNodeShape; import org.topbraid.shacl.model.SHParameter; import org.topbraid.shacl.model.SHParameterizableTarget; import org.topbraid.shacl.model.SHPropertyShape; import org.topbraid.shacl.model.SHResult; import org.topbraid.shacl.optimize.OntologyOptimizations; import org.topbraid.shacl.optimize.OptimizedMultiUnion; import org.topbraid.shacl.targets.CustomTargetLanguage; import org.topbraid.shacl.targets.CustomTargets; import org.topbraid.shacl.vocabulary.DASH; import org.topbraid.shacl.vocabulary.SH; /** * Various SHACL-related utility methods that didn't fit elsewhere. * * @author Holger Knublauch */ public class SHACLUtil { public final static Resource[] RESULT_TYPES = { DASH.FailureResult, DASH.SuccessResult, SH.ValidationResult }; public final static String SHAPES_FILE_PART = ".shapes."; public static final String URN_X_SHACL = "urn:x-shacl:"; private static final Set<Property> SPARQL_PROPERTIES = new HashSet<Property>(); static { SPARQL_PROPERTIES.add(SH.ask); SPARQL_PROPERTIES.add(SH.construct); SPARQL_PROPERTIES.add(SH.select); SPARQL_PROPERTIES.add(SH.update); } private static Query propertyLabelQuery = ARQFactory.get().createQuery( "PREFIX rdfs: <" + RDFS.getURI() + ">\n" + "PREFIX sh: <" + SH.NS + ">\n" + "SELECT ?label\n" + "WHERE {\n" + " ?arg2 a ?type .\n" + " ?type rdfs:subClassOf* ?class .\n" + " ?shape <" + SH.targetClass + ">* ?class .\n" + " ?shape <" + SH.property + ">|<" + SH.parameter + "> ?p .\n" + " ?p <" + SH.path + "> ?arg1 .\n" + " ?p rdfs:label ?label .\n" + "}"); public static void addDirectPropertiesOfClass(Resource cls, Collection<Property> results) { for(Resource argument : JenaUtil.getResourceProperties(cls, SH.parameter)) { Resource predicate = argument.getPropertyResourceValue(SH.path); if(predicate != null && predicate.isURIResource() && !results.contains(predicate)) { results.add(JenaUtil.asProperty(predicate)); } } for(Resource property : JenaUtil.getResourceProperties(cls, SH.property)) { Resource predicate = property.getPropertyResourceValue(SH.path); if(predicate != null && predicate.isURIResource() && !results.contains(predicate)) { results.add(JenaUtil.asProperty(predicate)); } } } private static void addIncludes(Graph model, String uri, Set<Graph> graphs, Set<String> reachedURIs) { graphs.add(model); reachedURIs.add(uri); for(Triple t : model.find(null, OWL.imports.asNode(), null).toList()) { if(t.getObject().isURI()) { String includeURI = t.getObject().getURI(); if(!reachedURIs.contains(includeURI)) { Model includeModel = ARQFactory.getNamedModel(includeURI); if(includeModel != null) { Graph includeGraph = includeModel.getGraph(); addIncludes(includeGraph, includeURI, graphs, reachedURIs); } } } } } /** * Adds all resources from a given sh:target to a given results Set of Nodes. * @param target the value of sh:target (parameterized or SPARQL target) * @param dataset the dataset to operate on * @param results the Set to add the resulting Nodes to */ public static void addNodesInTarget(Resource target, Dataset dataset, Set<Node> results) { for(RDFNode focusNode : getResourcesInTarget(target, dataset)) { results.add(focusNode.asNode()); } } /** * Creates an includes Model for a given input Model. * The includes Model is the union of the input Model will all graphs linked via * sh:include (or owl:imports), transitively. * @param model the Model to create the includes Model for * @param graphURI the URI of the named graph represented by Model * @return a Model including the semantics */ public static Model createIncludesModel(Model model, String graphURI) { Set<Graph> graphs = new HashSet<Graph>(); Graph baseGraph = model.getGraph(); addIncludes(baseGraph, graphURI, graphs, new HashSet<String>()); if(graphs.size() == 1) { return model; } else { MultiUnion union = new MultiUnion(graphs.iterator()); union.setBaseGraph(baseGraph); return ModelFactory.createModelForGraph(union); } } public static URI createRandomShapesGraphURI() { return URI.create(URN_X_SHACL + UUID.randomUUID()); } /** * Gets all focus nodes from the default Model of a given dataset. * This includes all targets of all defined targets as well as all instances of classes that * are also shapes. * @param dataset the Dataset * @param validateShapes true to include the validation of constraint components * @return a Set of focus Nodes */ public static Set<Node> getAllFocusNodes(Dataset dataset, boolean validateShapes) { Set<Node> results = new HashSet<Node>(); // Add all instances of classes that are also shapes Model model = dataset.getDefaultModel(); for(Resource shape : JenaUtil.getAllInstances(SH.Shape.inModel(model))) { if(JenaUtil.hasIndirectType(shape, RDFS.Class)) { for(Resource instance : JenaUtil.getAllInstances(shape)) { results.add(instance.asNode()); } } } // Add all instances of classes mentioned in sh:targetClass triples for(Statement s : model.listStatements(null, SH.targetClass, (RDFNode)null).toList()) { if(s.getObject().isResource()) { if(validateShapes || (!JenaUtil.hasIndirectType(s.getSubject(), SH.ConstraintComponent) && !SH.PropertyShape.equals(s.getObject())) && !SH.Constraint.equals(s.getObject())) { for(Resource instance : JenaUtil.getAllInstances(s.getResource())) { results.add(instance.asNode()); } } } } // Add all objects of sh:targetNode triples for(Statement s : model.listStatements(null, SH.targetNode, (RDFNode)null).toList()) { results.add(s.getObject().asNode()); } // Add all target nodes of sh:target triples for(Statement s : model.listStatements(null, SH.target, (RDFNode)null).toList()) { if(s.getObject().isResource()) { Resource target = s.getResource(); for(RDFNode focusNode : SHACLUtil.getResourcesInTarget(target, dataset)) { results.add(focusNode.asNode()); } } } // Add all objects of the predicate used as sh:targetObjectsOf for(RDFNode property : model.listObjectsOfProperty(SH.targetObjectsOf).toList()) { if(property.isURIResource()) { Property predicate = JenaUtil.asProperty((Resource)property); for(RDFNode focusNode : model.listObjectsOfProperty(predicate).toList()) { results.add(focusNode.asNode()); } } } // Add all subjects of the predicate used as sh:targetSubjectsOf for(RDFNode property : model.listObjectsOfProperty(SH.targetSubjectsOf).toList()) { if(property.isURIResource()) { Property predicate = JenaUtil.asProperty((Resource)property); for(RDFNode focusNode : model.listSubjectsWithProperty(predicate).toList()) { results.add(focusNode.asNode()); } } } return results; } public static List<SHResult> getAllTopLevelResults(Model model) { List<SHResult> results = new LinkedList<SHResult>(); for(Resource type : RESULT_TYPES) { for(Resource r : model.listResourcesWithProperty(RDF.type, type).toList()) { if(!model.contains(null, SH.detail, r)) { results.add(r.as(SHResult.class)); } } } return results; } /** * Gets all (transitive) superclasses including shapes that reference a class via sh:targetClass. * @param cls the class to start at * @return a Set of classes and shapes */ public static Set<Resource> getAllSuperClassesAndShapesStar(Resource cls) { Set<Resource> results = new HashSet<Resource>(); getAllSuperClassesAndShapesStarHelper(cls, results); return results; } private static void getAllSuperClassesAndShapesStarHelper(Resource node, Set<Resource> results) { if(!results.contains(node)) { results.add(node); { StmtIterator it = node.listProperties(RDFS.subClassOf); while(it.hasNext()) { Statement s = it.next(); if(s.getObject().isResource()) { getAllSuperClassesAndShapesStarHelper(s.getResource(), results); } } } { StmtIterator it = node.getModel().listStatements(null, SH.targetClass, node); while(it.hasNext()) { getAllSuperClassesAndShapesStarHelper(it.next().getSubject(), results); } } } } public static SHConstraintComponent getConstraintComponentOfValidator(Resource validator) { for(Statement s : validator.getModel().listStatements(null, null, validator).toList()) { if(SH.validator.equals(s.getPredicate()) || SH.nodeValidator.equals(s.getPredicate()) || SH.propertyValidator.equals(s.getPredicate())) { return s.getSubject().as(SHConstraintComponent.class); } } return null; } public static Resource getDefaultTypeForConstraintPredicate(Property predicate) { if(SH.property.equals(predicate)) { return SH.PropertyShape; } else if(SH.parameter.equals(predicate)) { return SH.Parameter; } else { throw new IllegalArgumentException(); } } public static SHParameter getParameterAtClass(Resource cls, Property predicate) { for(Resource c : JenaUtil.getAllSuperClassesStar(cls)) { for(Resource arg : JenaUtil.getResourceProperties(c, SH.parameter)) { if(arg.hasProperty(SH.path, predicate)) { return SHFactory.asParameter(arg); } } } return null; } public static SHParameter getParameterAtInstance(Resource instance, Property predicate) { for(Resource type : JenaUtil.getTypes(instance)) { SHParameter argument = getParameterAtClass(type, predicate); if(argument != null) { return argument; } } return null; } // Simplified to only check for sh:property and sh:parameter (not sh:node etc) public static Resource getResourceDefaultType(Resource resource) { if(resource.getModel().contains(null, SH.property, resource)) { return SH.PropertyShape.inModel(resource.getModel()); } else if(resource.getModel().contains(null, SH.parameter, resource)) { return SH.Parameter.inModel(resource.getModel()); } /* StmtIterator it = resource.getModel().listStatements(null, null, resource); try { while(it.hasNext()) { Statement s = it.next(); Resource defaultValueType = JenaUtil.getResourceProperty(s.getPredicate(), DASH.defaultValueType); if(defaultValueType != null) { return defaultValueType; } } } finally { it.close(); }*/ return null; } /** * Gets any locally-defined label for a given property. * The labels are expected to be attached to shapes associated with a given * context resource (instance). * That context resource may for example be the subject of the current UI form. * @param property the property to get the label of * @param context the context instance * @return the local label or null if it should fall back to a global label */ public static String getLocalPropertyLabel(Resource property, Resource context) { QuerySolutionMap binding = new QuerySolutionMap(); binding.add("arg1", property); binding.add("arg2", context); try(QueryExecution qexec = ARQFactory.get().createQueryExecution(propertyLabelQuery, property.getModel(), binding)) { ResultSet rs = qexec.execSelect(); if(rs.hasNext()) { return rs.next().get("label").asLiteral().getLexicalForm(); } } return null; } public static SHPropertyShape getPropertyConstraintAtClass(Resource cls, Property predicate) { for(Resource c : JenaUtil.getAllSuperClassesStar(cls)) { for(Resource arg : JenaUtil.getResourceProperties(c, SH.property)) { if(arg.hasProperty(SH.path, predicate)) { return SHFactory.asPropertyShape(arg); } } } return null; } public static SHPropertyShape getPropertyConstraintAtInstance(Resource instance, Property predicate) { for(Resource type : JenaUtil.getTypes(instance)) { SHPropertyShape property = getPropertyConstraintAtClass(type, predicate); if(property != null) { return property; } } return null; } /** * Gets all the predicates of all declared sh:properties and sh:parameters * of a given class, including inherited ones. * @param cls the class to get the predicates of * @return the declared predicates */ public static List<Property> getAllPropertiesOfClass(Resource cls) { List<Property> results = new LinkedList<Property>(); for(Resource c : getAllSuperClassesAndShapesStar(cls)) { addDirectPropertiesOfClass(c, results); } return results; } /** * Gets all nodes from a given sh:target. * @param target the value of sh:target (parameterizable or SPARQL target) * @param dataset the dataset to operate on * @return an Iterable over the resources */ public static Iterable<RDFNode> getResourcesInTarget(Resource target, Dataset dataset) { Resource type = JenaUtil.getType(target); Resource executable; SHParameterizableTarget parameterizableTarget = null; if(SHFactory.isParameterizableInstance(target)) { executable = type; parameterizableTarget = SHFactory.asParameterizableTarget(target); } else { executable = target; } CustomTargetLanguage plugin = CustomTargets.get().getLanguageForTarget(executable); if(plugin != null) { Set<RDFNode> results = new HashSet<>(); plugin.createTarget(executable, parameterizableTarget).addTargetNodes(dataset, results); return results; } else { return new ArrayList<>(); } } /** * Gets all shapes associated with a given focus node. * This looks for all shapes based on class-based targets. * Future versions will also look for property-based targets. * @param node the (focus) node * @return a List of shapes */ public static List<SHNodeShape> getAllShapesAtNode(RDFNode node) { return getAllShapesAtNode(node, node instanceof Resource ? JenaUtil.getTypes((Resource)node) : null); } public static List<SHNodeShape> getAllShapesAtNode(RDFNode node, Iterable<Resource> types) { List<SHNodeShape> results = new LinkedList<>(); if(node instanceof Resource) { Set<Resource> reached = new HashSet<>(); for(Resource type : types) { addAllShapesAtClassOrShape(type, results, reached); } } // TODO: support sh:targetObjectsOf and sh:targetSubjectsOf return results; } /** * Gets all sh:Shapes that have a given class in their target, including ConstraintComponents * and the class or shape itself if it is marked as sh:Shape. * Also walks up the class hierarchy. * @param clsOrShape the class or Shape to get the shapes of * @return the shapes, ordered by the most specialized (subclass) first */ @SuppressWarnings("unchecked") public static List<SHNodeShape> getAllShapesAtClassOrShape(Resource clsOrShape) { String key = OntologyOptimizations.get().getKeyIfEnabledFor(clsOrShape.getModel().getGraph()); if(key != null) { private static void addDirectShapesAtClassOrShape(Resource clsOrShape, List<SHNodeShape> results) { if(JenaUtil.hasIndirectType(clsOrShape, SH.Shape) && !results.contains(clsOrShape)) { results.add(SHFactory.asNodeShape(clsOrShape)); } // More correct would be: if(JenaUtil.hasIndirectType(clsOrShape, RDFS.Class)) { { return results; } } private static void addAllShapesAtClassOrShape(Resource clsOrShape, List<SHNodeShape> results, Set<Resource> reached) { addDirectShapesAtClassOrShape(clsOrShape, results); reached.add(clsOrShape); for(Resource superClass : JenaUtil.getSuperClasses(clsOrShape)) { if(!reached.contains(superClass)) { addAllShapesAtClassOrShape(superClass, results, reached); } } } /** * Gets the directly associated sh:Shapes that have a given class in their target, * including ConstraintComponents and the class or shape itself if it is marked as sh:Shape. * Does not walk up the class hierarchy. * @param clsOrShape the class or Shape to get the shapes of * @return the shapes */ public static Collection<SHNodeShape> getDirectShapesAtClassOrShape(Resource clsOrShape) { List<SHNodeShape> results = new LinkedList<SHNodeShape>(); addDirectShapesAtClassOrShape(clsOrShape, results); return results; } private static void addDirectShapesAtClassOrShape(Resource clsOrShape, List<SHNodeShape> results) { if(JenaUtil.hasIndirectType(clsOrShape, SH.Shape) && !results.contains(clsOrShape)) { SHNodeShape shape = SHFactory.asNodeShape(clsOrShape); if(!shape.isDeactivated()) { results.add(shape); } } // More correct would be: if(JenaUtil.hasIndirectType(clsOrShape, RDFS.Class)) { { StmtIterator it = clsOrShape.getModel().listStatements(null, SH.targetClass, clsOrShape); while(it.hasNext()) { Resource subject = it.next().getSubject(); if(!results.contains(subject)) { SHNodeShape shape = SHFactory.asNodeShape(subject); if(!shape.isDeactivated()) { results.add(shape); } } } } } public static Set<Resource> getDirectShapesAtResource(Resource resource) { Set<Resource> shapes = new HashSet<>(); for(Resource type : JenaUtil.getResourceProperties(resource, RDF.type)) { if(JenaUtil.hasIndirectType(type, SH.NodeShape)) { shapes.add(type); } Set<Resource> ts = JenaUtil.getAllSuperClassesStar(type); for(Resource s : ts) { { StmtIterator it = type.getModel().listStatements(null, DASH.applicableToClass, s); while(it.hasNext()) { Resource shape = it.next().getSubject(); shapes.add(shape); } } { StmtIterator it = type.getModel().listStatements(null, SH.targetClass, s); while(it.hasNext()) { Resource shape = it.next().getSubject(); shapes.add(shape); } } } } return shapes; } public static List<RDFNode> getTargetNodes(Resource shape, Dataset dataset) { return getTargetNodes(shape, dataset, false); } public static List<RDFNode> getTargetNodes(Resource shape, Dataset dataset, boolean includeApplicableToClass) { Model dataModel = dataset.getDefaultModel(); Set<RDFNode> results = new HashSet<RDFNode>(); if(JenaUtil.hasIndirectType(shape, RDFS.Class)) { results.addAll(JenaUtil.getAllInstances(shape.inModel(dataModel))); } for(Resource targetClass : JenaUtil.getResourceProperties(shape, SH.targetClass)) { results.addAll(JenaUtil.getAllInstances(targetClass.inModel(dataModel))); } for(RDFNode targetNode : shape.getModel().listObjectsOfProperty(shape, SH.targetNode).toList()) { results.add(targetNode.inModel(dataModel)); } for(Resource sof : JenaUtil.getResourceProperties(shape, SH.targetSubjectsOf)) { for(Statement s : dataModel.listStatements(null, JenaUtil.asProperty(sof), (RDFNode)null).toList()) { results.add(s.getSubject()); } } for(Resource sof : JenaUtil.getResourceProperties(shape, SH.targetObjectsOf)) { for(Statement s : dataModel.listStatements(null, JenaUtil.asProperty(sof), (RDFNode)null).toList()) { results.add(s.getObject()); } } for(Resource target : JenaUtil.getResourceProperties(shape, SH.target)) { for(RDFNode targetNode : SHACLUtil.getResourcesInTarget(target, dataset)) { results.add(targetNode); } } if(includeApplicableToClass) { for(Resource targetClass : JenaUtil.getResourceProperties(shape, DASH.applicableToClass)) { results.addAll(JenaUtil.getAllInstances(targetClass.inModel(dataModel))); } } return new ArrayList<RDFNode>(results); } public static List<Resource> getTypes(Resource subject) { List<Resource> types = JenaUtil.getTypes(subject); if(types.isEmpty()) { Resource defaultType = getResourceDefaultType(subject); if(defaultType != null) { return Collections.singletonList(defaultType); } } return types; } public static boolean hasMinSeverity(Resource severity, Resource minSeverity) { if(minSeverity == null || SH.Info.equals(minSeverity)) { return true; } if(SH.Warning.equals(minSeverity)) { return !SH.Info.equals(severity); } else { // SH.Error return SH.Violation.equals(severity); } } public static boolean isDeactivated(Resource resource) { return resource.hasProperty(SH.deactivated, JenaDatatypes.TRUE); } public static boolean isParameterAtInstance(Resource subject, Property predicate) { for(Resource type : getTypes(subject)) { Resource arg = getParameterAtClass(type, predicate); if(arg != null) { return true; } } return false; } public static boolean isSPARQLProperty(Property property) { return SPARQL_PROPERTIES.contains(property); } /** * Checks whether the SHACL vocabulary is present in a given Model. * The condition is that the SHACL namespace must be declared and * sh:Constraint must have an rdf:type. * @param model the Model to check * @return true if SHACL is present */ public static boolean exists(Model model) { return model != null && exists(model.getGraph()); } public static boolean exists(Graph graph) { if(graph instanceof OptimizedMultiUnion) { return ((OptimizedMultiUnion)graph).getIncludesSHACL(); } else { return graph != null && SH.NS.equals(graph.getPrefixMapping().getNsPrefixURI(SH.PREFIX)) && graph.contains(SH.Shape.asNode(), RDF.type.asNode(), Node.ANY); } } public static URI withShapesGraph(Dataset dataset) { URI shapesGraphURI = createRandomShapesGraphURI(); Model shapesModel = createShapesModel(dataset); dataset.addNamedModel(shapesGraphURI.toString(), shapesModel); return shapesGraphURI; } /** * Creates a shapes Model for a given input Model. * The shapes Model is the union of the input Model with all graphs referenced via * the sh:shapesGraph property (and transitive includes or shapesGraphs of those). * @param model the Model to create the shapes Model for * @return a shapes graph Model */ private static Model createShapesModel(Dataset dataset) { Model model = dataset.getDefaultModel(); Set<Graph> graphs = new HashSet<Graph>(); Graph baseGraph = model.getGraph(); graphs.add(baseGraph); for(Statement s : model.listStatements(null, SH.shapesGraph, (RDFNode)null).toList()) { if(s.getObject().isURIResource()) { String graphURI = s.getResource().getURI(); Model sm = dataset.getNamedModel(graphURI); graphs.add(sm.getGraph()); // TODO: Include includes of sm } } if(graphs.size() > 1) { MultiUnion union = new MultiUnion(graphs.iterator()); union.setBaseGraph(baseGraph); return ModelFactory.createModelForGraph(union); } else { return model; } } public static boolean isInTarget(RDFNode focusNode, Dataset dataset, Resource target) { SHParameterizableTarget parameterizableTarget = null; Resource executable = target; if(SHFactory.isParameterizableInstance(target)) { parameterizableTarget = SHFactory.asParameterizableTarget(target); executable = parameterizableTarget.getParameterizable(); } CustomTargetLanguage plugin = CustomTargets.get().getLanguageForTarget(executable); if(plugin != null) { return plugin.createTarget(executable, parameterizableTarget).contains(dataset, focusNode); } else { return false; } } public static Node walkPropertyShapesHelper(Node propertyShape, Graph graph) { Node valueType = JenaNodeUtil.getObject(propertyShape, SH.class_.asNode(), graph); if(valueType != null) { return valueType; } Node datatype = JenaNodeUtil.getObject(propertyShape, SH.datatype.asNode(), graph); if(datatype != null) { return datatype; } ExtendedIterator<Triple> ors = graph.find(propertyShape, SH.or.asNode(), Node.ANY); while(ors.hasNext()) { Node or = ors.next().getObject(); Node first = JenaNodeUtil.getObject(or, RDF.first.asNode(), graph); if(!first.isLiteral()) { Node cls = JenaNodeUtil.getObject(first, SH.class_.asNode(), graph); if(cls != null) { ors.close(); return cls; } datatype = JenaNodeUtil.getObject(first, SH.datatype.asNode(), graph); if(datatype != null) { ors.close(); return datatype; } } } if(graph.contains(propertyShape, SH.node.asNode(), DASH.ListShape.asNode())) { return RDF.List.asNode(); } return null; } } <MSG> Tracking TopBraid API <DFF> @@ -505,7 +505,10 @@ public class SHACLUtil { private static void addDirectShapesAtClassOrShape(Resource clsOrShape, List<SHNodeShape> results) { if(JenaUtil.hasIndirectType(clsOrShape, SH.Shape) && !results.contains(clsOrShape)) { - results.add(SHFactory.asNodeShape(clsOrShape)); + SHNodeShape shape = SHFactory.asNodeShape(clsOrShape); + if(!shape.isDeactivated()) { + results.add(shape); + } } // More correct would be: if(JenaUtil.hasIndirectType(clsOrShape, RDFS.Class)) { {
4
Tracking TopBraid API
1
.java
java
apache-2.0
TopQuadrant/shacl
376
<NME> datatype-002.ttl <BEF> ADDFILE <MSG> Latest SHACL system ontology including sh:text, with test cases <DFF> @@ -0,0 +1,45 @@ +# baseURI: http://www.w3.org/ns/shacl/test/features/core/datatype-002 + +@prefix ex: <http://example.org/> . +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix sh: <http://www.w3.org/ns/shacl#> . +@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . + +<> + a sh:Graph ; + sh:shapesGraph <http://www.w3.org/ns/shacl> ; +. + +# Shapes ---------------------------------------------------------------------- + +ex:MyShape + a sh:Shape ; + sh:property [ + sh:predicate ex:value ; + sh:datatype sh:text ; + ] ; +. + + +# Data ------------------------------------------------------------------------ + +ex:ValidInstance1 + sh:nodeShape ex:MyShape ; + ex:value "A" ; +. + +ex:ValidInstance2 + sh:nodeShape ex:MyShape ; + ex:value "A"^^xsd:string ; +. + +ex:ValidInstance3 + sh:nodeShape ex:MyShape ; + ex:value "A"@en ; +. + +ex:InvalidInstance1 + sh:nodeShape ex:MyShape ; + ex:value 42 ; +.
45
Latest SHACL system ontology including sh:text, with test cases
0
.ttl
ttl
apache-2.0
TopQuadrant/shacl
377
<NME> datatype-002.ttl <BEF> ADDFILE <MSG> Latest SHACL system ontology including sh:text, with test cases <DFF> @@ -0,0 +1,45 @@ +# baseURI: http://www.w3.org/ns/shacl/test/features/core/datatype-002 + +@prefix ex: <http://example.org/> . +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix sh: <http://www.w3.org/ns/shacl#> . +@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . + +<> + a sh:Graph ; + sh:shapesGraph <http://www.w3.org/ns/shacl> ; +. + +# Shapes ---------------------------------------------------------------------- + +ex:MyShape + a sh:Shape ; + sh:property [ + sh:predicate ex:value ; + sh:datatype sh:text ; + ] ; +. + + +# Data ------------------------------------------------------------------------ + +ex:ValidInstance1 + sh:nodeShape ex:MyShape ; + ex:value "A" ; +. + +ex:ValidInstance2 + sh:nodeShape ex:MyShape ; + ex:value "A"^^xsd:string ; +. + +ex:ValidInstance3 + sh:nodeShape ex:MyShape ; + ex:value "A"@en ; +. + +ex:InvalidInstance1 + sh:nodeShape ex:MyShape ; + ex:value 42 ; +.
45
Latest SHACL system ontology including sh:text, with test cases
0
.ttl
ttl
apache-2.0
TopQuadrant/shacl
378
<NME> SHT.java <BEF> /* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * See the NOTICE file distributed with this work for additional public final static Property dataGraph = ResourceFactory.createProperty(NS + "dataGraph"); public final static Resource proposed = ResourceFactory.createResource(NS + "proposed"); public final static Property shapesGraph = ResourceFactory.createProperty(NS + "shapesGraph"); public class SHT { public static final String BASE_URI = "http://www.w3.org/ns/shacl-test"; public static final String NS = BASE_URI + "#"; public final static Resource CoreOnly = ResourceFactory.createResource(NS + "CoreOnly"); public final static Property dataGraph = ResourceFactory.createProperty(NS + "dataGraph"); public final static Resource Failure = ResourceFactory.createResource(NS + "Failure"); public final static Resource proposed = ResourceFactory.createResource(NS + "proposed"); public final static Property shapesGraph = ResourceFactory.createProperty(NS + "shapesGraph"); public final static Resource Validate = ResourceFactory.createResource(NS + "Validate"); } <MSG> Tracking latest TopBraid version <DFF> @@ -15,6 +15,8 @@ public class SHT { public final static Property dataGraph = ResourceFactory.createProperty(NS + "dataGraph"); + public final static Resource Failure = ResourceFactory.createResource(NS + "Failure"); + public final static Resource proposed = ResourceFactory.createResource(NS + "proposed"); public final static Property shapesGraph = ResourceFactory.createProperty(NS + "shapesGraph");
2
Tracking latest TopBraid version
0
.java
java
apache-2.0
TopQuadrant/shacl
379
<NME> SHT.java <BEF> /* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * See the NOTICE file distributed with this work for additional public final static Property dataGraph = ResourceFactory.createProperty(NS + "dataGraph"); public final static Resource proposed = ResourceFactory.createResource(NS + "proposed"); public final static Property shapesGraph = ResourceFactory.createProperty(NS + "shapesGraph"); public class SHT { public static final String BASE_URI = "http://www.w3.org/ns/shacl-test"; public static final String NS = BASE_URI + "#"; public final static Resource CoreOnly = ResourceFactory.createResource(NS + "CoreOnly"); public final static Property dataGraph = ResourceFactory.createProperty(NS + "dataGraph"); public final static Resource Failure = ResourceFactory.createResource(NS + "Failure"); public final static Resource proposed = ResourceFactory.createResource(NS + "proposed"); public final static Property shapesGraph = ResourceFactory.createProperty(NS + "shapesGraph"); public final static Resource Validate = ResourceFactory.createResource(NS + "Validate"); } <MSG> Tracking latest TopBraid version <DFF> @@ -15,6 +15,8 @@ public class SHT { public final static Property dataGraph = ResourceFactory.createProperty(NS + "dataGraph"); + public final static Resource Failure = ResourceFactory.createResource(NS + "Failure"); + public final static Resource proposed = ResourceFactory.createResource(NS + "proposed"); public final static Property shapesGraph = ResourceFactory.createProperty(NS + "shapesGraph");
2
Tracking latest TopBraid version
0
.java
java
apache-2.0
TopQuadrant/shacl
380
<NME> SPARQLSyntaxChecker.java <BEF> /* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * See the NOTICE file distributed with this work for additional * information regarding copyright ownership. */ package org.topbraid.shacl.validation.sparql; import java.util.LinkedHashSet; import java.util.LinkedList; import java.util.List; import java.util.Set; import org.apache.jena.query.Query; import org.apache.jena.sparql.core.Var; import org.apache.jena.sparql.core.VarExprList; import org.apache.jena.sparql.expr.Expr; import org.apache.jena.sparql.expr.ExprAggregator; import org.apache.jena.sparql.expr.ExprFunction; import org.apache.jena.sparql.expr.ExprFunctionOp; import org.apache.jena.sparql.expr.ExprNone; import org.apache.jena.sparql.expr.ExprVar; import org.apache.jena.sparql.expr.ExprVisitorFunction; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.syntax.ElementBind; import org.apache.jena.sparql.syntax.ElementData; import org.apache.jena.sparql.syntax.ElementFilter; import org.apache.jena.sparql.syntax.ElementMinus; import org.apache.jena.sparql.syntax.ElementService; import org.apache.jena.sparql.syntax.ElementSubQuery; import org.apache.jena.sparql.syntax.ElementVisitor; import org.apache.jena.sparql.syntax.ElementVisitorBase; import org.apache.jena.sparql.syntax.PatternVars; import org.apache.jena.sparql.syntax.RecursiveElementVisitor; import org.topbraid.shacl.vocabulary.SH; /** * Can be used to check for the violation of any of the syntax rules in Appendix A * of the SHACL spec, to prevent certain pre-binding scenarios. * * @author Holger Knublauch */ public class SPARQLSyntaxChecker { /** * Checks whether a given Query violates any of the syntax rules in Appendix A. * @param query the Query to check * @param preBoundVars the potentially pre-bound variables * @return an List of error messages (empty if OK) */ public static List<String> checkQuery(Query query, Set<String> preBoundVars) { List<String> results = new LinkedList<>(); ElementVisitor elementVisitor = new RecursiveElementVisitor(new ElementVisitorBase()) { @Override public void startElement(ElementBind el) { if(preBoundVars.contains(el.getVar().getVarName())) { if(SH.valueVar.getVarName().equals(el.getVar().getVarName()) && el.getExpr().isVariable() && el.getExpr().asVar().equals(SH.thisVar)) { // Ignore clauses injected by engine } else { results.add("Query must not reassign the pre-bound variable " + el.getVar() + " in a BIND clause"); } } } @Override public void startElement(ElementData el) { results.add("Query must not contain VALUES clause"); } @Override public void startElement(ElementFilter el) { checkExpression(el.getExpr()); } @Override public void startElement(ElementMinus el) { results.add("Query must not contain MINUS clause"); } @Override public void startElement(ElementService el) { results.add("Query must not contain SERVICE clause"); } @Override public void startElement(ElementSubQuery el) { if(el.getQuery().isQueryResultStar()) { Set<Var> queryVars = new LinkedHashSet<>() ; PatternVars.vars(queryVars, el.getQuery().getQueryPattern()) ; for(String varName : preBoundVars) { if(!SH.currentShapeVar.getVarName().equals(varName) && !SH.shapesGraphVar.getVarName().equals(varName)) { if(!queryVars.contains(Var.alloc(varName))) { results.add("Sub-query must return all potentially pre-bound variables including $" + varName); } } } } else { VarExprList project = el.getQuery().getProject(); for(String varName : preBoundVars) { if(!SH.currentShapeVar.getVarName().equals(varName) && !SH.shapesGraphVar.getVarName().equals(varName)) { if(!project.contains(Var.alloc(varName))) { results.add("Sub-query must return all potentially pre-bound variables including $" + varName); } } } } } private void checkExpression(Expr expr) { final ElementVisitor parent = this; expr.visit(new ExprVisitorFunction() { @Override public void visit(ExprFunctionOp funcOp) { if(funcOp.isGraphPattern()) { funcOp.getElement().visit(parent); } } @Override public void visit(NodeValue nv) { } @Override public void visit(ExprVar nv) { } @Override public void visit(ExprAggregator eAgg) { } @Override public void visit(ExprNone exprNone) { } @Override protected void visitExprFunction(ExprFunction func) { for(Expr expr : func.getArgs()) { expr.visit(this); } } }); } }; }; query.getQueryPattern().visit(elementVisitor); return results; } } <MSG> Merge pull request #116 from afs/fixes Compact write fixes; version related code updates. <DFF> @@ -29,6 +29,7 @@ import org.apache.jena.sparql.expr.ExprAggregator; import org.apache.jena.sparql.expr.ExprFunction; import org.apache.jena.sparql.expr.ExprFunctionOp; import org.apache.jena.sparql.expr.ExprNone; +import org.apache.jena.sparql.expr.ExprTripleTerm; import org.apache.jena.sparql.expr.ExprVar; import org.apache.jena.sparql.expr.ExprVisitorFunction; import org.apache.jena.sparql.expr.NodeValue; @@ -146,6 +147,8 @@ public class SPARQLSyntaxChecker { expr.visit(this); } } + @Override + public void visit(ExprTripleTerm tripleTerm) {} }); } };
3
Merge pull request #116 from afs/fixes
0
.java
java
apache-2.0
TopQuadrant/shacl
381
<NME> SPARQLSyntaxChecker.java <BEF> /* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * See the NOTICE file distributed with this work for additional * information regarding copyright ownership. */ package org.topbraid.shacl.validation.sparql; import java.util.LinkedHashSet; import java.util.LinkedList; import java.util.List; import java.util.Set; import org.apache.jena.query.Query; import org.apache.jena.sparql.core.Var; import org.apache.jena.sparql.core.VarExprList; import org.apache.jena.sparql.expr.Expr; import org.apache.jena.sparql.expr.ExprAggregator; import org.apache.jena.sparql.expr.ExprFunction; import org.apache.jena.sparql.expr.ExprFunctionOp; import org.apache.jena.sparql.expr.ExprNone; import org.apache.jena.sparql.expr.ExprVar; import org.apache.jena.sparql.expr.ExprVisitorFunction; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.syntax.ElementBind; import org.apache.jena.sparql.syntax.ElementData; import org.apache.jena.sparql.syntax.ElementFilter; import org.apache.jena.sparql.syntax.ElementMinus; import org.apache.jena.sparql.syntax.ElementService; import org.apache.jena.sparql.syntax.ElementSubQuery; import org.apache.jena.sparql.syntax.ElementVisitor; import org.apache.jena.sparql.syntax.ElementVisitorBase; import org.apache.jena.sparql.syntax.PatternVars; import org.apache.jena.sparql.syntax.RecursiveElementVisitor; import org.topbraid.shacl.vocabulary.SH; /** * Can be used to check for the violation of any of the syntax rules in Appendix A * of the SHACL spec, to prevent certain pre-binding scenarios. * * @author Holger Knublauch */ public class SPARQLSyntaxChecker { /** * Checks whether a given Query violates any of the syntax rules in Appendix A. * @param query the Query to check * @param preBoundVars the potentially pre-bound variables * @return an List of error messages (empty if OK) */ public static List<String> checkQuery(Query query, Set<String> preBoundVars) { List<String> results = new LinkedList<>(); ElementVisitor elementVisitor = new RecursiveElementVisitor(new ElementVisitorBase()) { @Override public void startElement(ElementBind el) { if(preBoundVars.contains(el.getVar().getVarName())) { if(SH.valueVar.getVarName().equals(el.getVar().getVarName()) && el.getExpr().isVariable() && el.getExpr().asVar().equals(SH.thisVar)) { // Ignore clauses injected by engine } else { results.add("Query must not reassign the pre-bound variable " + el.getVar() + " in a BIND clause"); } } } @Override public void startElement(ElementData el) { results.add("Query must not contain VALUES clause"); } @Override public void startElement(ElementFilter el) { checkExpression(el.getExpr()); } @Override public void startElement(ElementMinus el) { results.add("Query must not contain MINUS clause"); } @Override public void startElement(ElementService el) { results.add("Query must not contain SERVICE clause"); } @Override public void startElement(ElementSubQuery el) { if(el.getQuery().isQueryResultStar()) { Set<Var> queryVars = new LinkedHashSet<>() ; PatternVars.vars(queryVars, el.getQuery().getQueryPattern()) ; for(String varName : preBoundVars) { if(!SH.currentShapeVar.getVarName().equals(varName) && !SH.shapesGraphVar.getVarName().equals(varName)) { if(!queryVars.contains(Var.alloc(varName))) { results.add("Sub-query must return all potentially pre-bound variables including $" + varName); } } } } else { VarExprList project = el.getQuery().getProject(); for(String varName : preBoundVars) { if(!SH.currentShapeVar.getVarName().equals(varName) && !SH.shapesGraphVar.getVarName().equals(varName)) { if(!project.contains(Var.alloc(varName))) { results.add("Sub-query must return all potentially pre-bound variables including $" + varName); } } } } } private void checkExpression(Expr expr) { final ElementVisitor parent = this; expr.visit(new ExprVisitorFunction() { @Override public void visit(ExprFunctionOp funcOp) { if(funcOp.isGraphPattern()) { funcOp.getElement().visit(parent); } } @Override public void visit(NodeValue nv) { } @Override public void visit(ExprVar nv) { } @Override public void visit(ExprAggregator eAgg) { } @Override public void visit(ExprNone exprNone) { } @Override protected void visitExprFunction(ExprFunction func) { for(Expr expr : func.getArgs()) { expr.visit(this); } } }); } }; }; query.getQueryPattern().visit(elementVisitor); return results; } } <MSG> Merge pull request #116 from afs/fixes Compact write fixes; version related code updates. <DFF> @@ -29,6 +29,7 @@ import org.apache.jena.sparql.expr.ExprAggregator; import org.apache.jena.sparql.expr.ExprFunction; import org.apache.jena.sparql.expr.ExprFunctionOp; import org.apache.jena.sparql.expr.ExprNone; +import org.apache.jena.sparql.expr.ExprTripleTerm; import org.apache.jena.sparql.expr.ExprVar; import org.apache.jena.sparql.expr.ExprVisitorFunction; import org.apache.jena.sparql.expr.NodeValue; @@ -146,6 +147,8 @@ public class SPARQLSyntaxChecker { expr.visit(this); } } + @Override + public void visit(ExprTripleTerm tripleTerm) {} }); } };
3
Merge pull request #116 from afs/fixes
0
.java
java
apache-2.0
TopQuadrant/shacl
382
<NME> basic.jsonld <BEF> ADDFILE <MSG> Removing example JS code from JS validator facade <DFF> @@ -0,0 +1,59 @@ +[ + { + "@context": { + "raml-doc": "http://raml.org/vocabularies/document#", + "raml-http": "http://raml.org/vocabularies/http#", + "raml-shapes": "http://raml.org/vocabularies/shapes#", + "hydra": "http://www.w3.org/ns/hydra/core#", + "shacl": "http://www.w3.org/ns/shacl#", + "schema-org": "http://schema.org/", + "xsd": "http://www.w3.org/2001/XMLSchema#" + }, + "@id": "https://mulesoft-labs.github.io/amf-playground/raml/world-music-api/api.raml#/definitions/Entry/items/0", + "@type": [ + "shacl:NodeShape", + "shacl:Shape" + ], + "shacl:targetObjectsOf": {"@id": "raml-shapes:toValidate"}, + "shacl:property": [ + { + "@id": "https://mulesoft-labs.github.io/amf-playground/raml/world-music-api/api.raml#/definitions/Entry/items/0/property/title", + "@type": [ + "shacl:PropertyShape", + "shacl:Shape" + ], + "raml-shapes:propertyLabel": "title", + "shacl:dataType": { + "@id": "xsd:string" + }, + "shacl:maxCount": 1, + "shacl:minCount": 0, + "shacl:path": { + "@id": "http://raml.org/vocabularies/shapes/anon#title" + } + }, + { + "@id": "https://mulesoft-labs.github.io/amf-playground/raml/world-music-api/api.raml#/definitions/Entry/items/0/property/artist", + "@type": [ + "shacl:PropertyShape", + "shacl:Shape" + ], + "raml-shapes:propertyLabel": "artist", + "shacl:dataType": { + "@id": "xsd:string" + }, + "shacl:maxCount": 1, + "shacl:minCount": 0, + "shacl:path": { + "@id": "http://raml.org/vocabularies/shapes/anon#artist" + } + } + ] + }, + { + "http://raml.org/vocabularies/shapes#toValidate": { + "http://raml.org/vocabularies/shapes/anon#title": ["hey","ho"], + "http://raml.org/vocabularies/shapes/anon#artist": "Antonio Carlos Brasileiro de Almeida Jobim" + } + } +] \ No newline at end of file
59
Removing example JS code from JS validator facade
0
.jsonld
jsonld
apache-2.0
TopQuadrant/shacl
383
<NME> basic.jsonld <BEF> ADDFILE <MSG> Removing example JS code from JS validator facade <DFF> @@ -0,0 +1,59 @@ +[ + { + "@context": { + "raml-doc": "http://raml.org/vocabularies/document#", + "raml-http": "http://raml.org/vocabularies/http#", + "raml-shapes": "http://raml.org/vocabularies/shapes#", + "hydra": "http://www.w3.org/ns/hydra/core#", + "shacl": "http://www.w3.org/ns/shacl#", + "schema-org": "http://schema.org/", + "xsd": "http://www.w3.org/2001/XMLSchema#" + }, + "@id": "https://mulesoft-labs.github.io/amf-playground/raml/world-music-api/api.raml#/definitions/Entry/items/0", + "@type": [ + "shacl:NodeShape", + "shacl:Shape" + ], + "shacl:targetObjectsOf": {"@id": "raml-shapes:toValidate"}, + "shacl:property": [ + { + "@id": "https://mulesoft-labs.github.io/amf-playground/raml/world-music-api/api.raml#/definitions/Entry/items/0/property/title", + "@type": [ + "shacl:PropertyShape", + "shacl:Shape" + ], + "raml-shapes:propertyLabel": "title", + "shacl:dataType": { + "@id": "xsd:string" + }, + "shacl:maxCount": 1, + "shacl:minCount": 0, + "shacl:path": { + "@id": "http://raml.org/vocabularies/shapes/anon#title" + } + }, + { + "@id": "https://mulesoft-labs.github.io/amf-playground/raml/world-music-api/api.raml#/definitions/Entry/items/0/property/artist", + "@type": [ + "shacl:PropertyShape", + "shacl:Shape" + ], + "raml-shapes:propertyLabel": "artist", + "shacl:dataType": { + "@id": "xsd:string" + }, + "shacl:maxCount": 1, + "shacl:minCount": 0, + "shacl:path": { + "@id": "http://raml.org/vocabularies/shapes/anon#artist" + } + } + ] + }, + { + "http://raml.org/vocabularies/shapes#toValidate": { + "http://raml.org/vocabularies/shapes/anon#title": ["hey","ho"], + "http://raml.org/vocabularies/shapes/anon#artist": "Antonio Carlos Brasileiro de Almeida Jobim" + } + } +] \ No newline at end of file
59
Removing example JS code from JS validator facade
0
.jsonld
jsonld
apache-2.0
TopQuadrant/shacl
384
<NME> SHT.java <BEF> ADDFILE <MSG> Some support for running the W3C test cases <DFF> @@ -0,0 +1,21 @@ +package org.topbraid.shacl.vocabulary; + +import org.apache.jena.rdf.model.Property; +import org.apache.jena.rdf.model.Resource; +import org.apache.jena.rdf.model.ResourceFactory; + +public class SHT { + + public static final String BASE_URI = "http://www.w3.org/ns/shacl-test"; + + public static final String NS = BASE_URI + "#"; + + + public final static Property dataGraph = ResourceFactory.createProperty(NS + "dataGraph"); + + public final static Resource proposed = ResourceFactory.createResource(NS + "proposed"); + + public final static Property shapesGraph = ResourceFactory.createProperty(NS + "shapesGraph"); + + public final static Resource Validate = ResourceFactory.createResource(NS + "Validate"); +}
21
Some support for running the W3C test cases
0
.java
java
apache-2.0
TopQuadrant/shacl
385
<NME> SHT.java <BEF> ADDFILE <MSG> Some support for running the W3C test cases <DFF> @@ -0,0 +1,21 @@ +package org.topbraid.shacl.vocabulary; + +import org.apache.jena.rdf.model.Property; +import org.apache.jena.rdf.model.Resource; +import org.apache.jena.rdf.model.ResourceFactory; + +public class SHT { + + public static final String BASE_URI = "http://www.w3.org/ns/shacl-test"; + + public static final String NS = BASE_URI + "#"; + + + public final static Property dataGraph = ResourceFactory.createProperty(NS + "dataGraph"); + + public final static Resource proposed = ResourceFactory.createResource(NS + "proposed"); + + public final static Property shapesGraph = ResourceFactory.createProperty(NS + "shapesGraph"); + + public final static Resource Validate = ResourceFactory.createResource(NS + "Validate"); +}
21
Some support for running the W3C test cases
0
.java
java
apache-2.0
TopQuadrant/shacl
386
<NME> README.md <BEF> # TopBraid SHACL API **An open source implementation of the W3C Shapes Constraint Language (SHACL) based on Apache Jena.** Contact: Holger Knublauch ([email protected]) Can be used to perform SHACL constraint checking and rule inferencing in any Jena-based Java application. This API also serves as a reference implementation of the SHACL spec. Coverage: * [SHACL Core and SHACL-SPARQL validation](https://www.w3.org/TR/shacl/) * [SHACL Advanced Features (Rules etc)](https://www.w3.org/TR/shacl-af/) Former Coverage until version 1.4.0 See [SHACL-JS](https://github.com/TopQuadrant/shacl-js) for a pure JavaScript implementation. The same code is used in the TopBraid products (currently aligned with the upcoming TopBraid 6.3 release). Feedback and questions should become GitHub issues or sent to TopBraid Users mailing list: https://groups.google.com/forum/#!forum/topbraid-users The same code is used in the TopBraid products (currently aligned with the TopBraid 7.1 release). Feedback and questions should become GitHub issues or sent to TopBraid Users mailing list: https://groups.google.com/forum/#!forum/topbraid-users Please prefix your messages with [SHACL API] To get started, look at the class ValidationUtil in the package org.topbraid.shacl.validation. There is also an [Example Test Case](../master/src/test/java/org/topbraid/shacl/ValidationExample.java) ## Application dependency Releases are available in the central maven repository: ``` <dependency> <groupId>org.topbraid</groupId> Download the latest release from: `http://central.maven.org/maven2/org/topbraid/shacl/` The binary distribution is: `http://central.maven.org/maven2/org/topbraid/shacl/*VER*/shacl-*VER*-bin.zip`. Two command line utilities are included: validate (performs constraint validation) and infer (performs SHACL rule inferencing). `https://repo1.maven.org/maven2/org/topbraid/shacl/*VER*/shacl-*VER*-bin.zip`. Two command line utilities are included: shaclvalidate (performs constraint validation) and shaclinfer (performs SHACL rule inferencing). To use them, set up your environment similar to https://jena.apache.org/documentation/tools/ (note that the SHACL download includes Jena). For example, on Windows: ``` SET SHACLROOT=C:\Users\Holger\Desktop\shacl-1.4.1-bin SET PATH=%PATH%;%SHACLROOT%\bin ``` As another example, for Linux, add to .bashrc these lines: ``` # for shacl export SHACLROOT=/home/holger/shacl/shacl-1.4.1-bin/shacl-1.4.1/bin export PATH=$SHACLROOT:$PATH ``` Both tools take the following parameters, for example: `shaclvalidate.bat -datafile myfile.ttl -shapesfile myshapes.ttl` where `-shapesfile` is optional and falls back to using the data graph as shapes graph. Add -validateShapes in case you want to include the metashapes (from the tosh namespace in particular). Currently only Turtle (.ttl) files are supported. The tools print the validation report or the inferences graph to the output screen. <MSG> #86 updated maven.org links <DFF> @@ -15,7 +15,7 @@ Coverage: See [SHACL-JS](https://github.com/TopQuadrant/shacl-js) for a pure JavaScript implementation. -The same code is used in the TopBraid products (currently aligned with the upcoming TopBraid 6.3 release). +The same code is used in the TopBraid products (currently aligned with the TopBraid 6.3 release). Feedback and questions should become GitHub issues or sent to TopBraid Users mailing list: https://groups.google.com/forum/#!forum/topbraid-users @@ -40,11 +40,11 @@ Releases are available in the central maven repository: Download the latest release from: -`http://central.maven.org/maven2/org/topbraid/shacl/` +`https://repo1.maven.org/maven2/org/topbraid/shacl/` The binary distribution is: -`http://central.maven.org/maven2/org/topbraid/shacl/*VER*/shacl-*VER*-bin.zip`. +`https://repo1.maven.org/maven2/org/topbraid/shacl/*VER*/shacl-*VER*-bin.zip`. Two command line utilities are included: validate (performs constraint validation) and infer (performs SHACL rule inferencing).
3
#86 updated maven.org links
3
.md
md
apache-2.0
TopQuadrant/shacl
387
<NME> README.md <BEF> # TopBraid SHACL API **An open source implementation of the W3C Shapes Constraint Language (SHACL) based on Apache Jena.** Contact: Holger Knublauch ([email protected]) Can be used to perform SHACL constraint checking and rule inferencing in any Jena-based Java application. This API also serves as a reference implementation of the SHACL spec. Coverage: * [SHACL Core and SHACL-SPARQL validation](https://www.w3.org/TR/shacl/) * [SHACL Advanced Features (Rules etc)](https://www.w3.org/TR/shacl-af/) Former Coverage until version 1.4.0 See [SHACL-JS](https://github.com/TopQuadrant/shacl-js) for a pure JavaScript implementation. The same code is used in the TopBraid products (currently aligned with the upcoming TopBraid 6.3 release). Feedback and questions should become GitHub issues or sent to TopBraid Users mailing list: https://groups.google.com/forum/#!forum/topbraid-users The same code is used in the TopBraid products (currently aligned with the TopBraid 7.1 release). Feedback and questions should become GitHub issues or sent to TopBraid Users mailing list: https://groups.google.com/forum/#!forum/topbraid-users Please prefix your messages with [SHACL API] To get started, look at the class ValidationUtil in the package org.topbraid.shacl.validation. There is also an [Example Test Case](../master/src/test/java/org/topbraid/shacl/ValidationExample.java) ## Application dependency Releases are available in the central maven repository: ``` <dependency> <groupId>org.topbraid</groupId> Download the latest release from: `http://central.maven.org/maven2/org/topbraid/shacl/` The binary distribution is: `http://central.maven.org/maven2/org/topbraid/shacl/*VER*/shacl-*VER*-bin.zip`. Two command line utilities are included: validate (performs constraint validation) and infer (performs SHACL rule inferencing). `https://repo1.maven.org/maven2/org/topbraid/shacl/*VER*/shacl-*VER*-bin.zip`. Two command line utilities are included: shaclvalidate (performs constraint validation) and shaclinfer (performs SHACL rule inferencing). To use them, set up your environment similar to https://jena.apache.org/documentation/tools/ (note that the SHACL download includes Jena). For example, on Windows: ``` SET SHACLROOT=C:\Users\Holger\Desktop\shacl-1.4.1-bin SET PATH=%PATH%;%SHACLROOT%\bin ``` As another example, for Linux, add to .bashrc these lines: ``` # for shacl export SHACLROOT=/home/holger/shacl/shacl-1.4.1-bin/shacl-1.4.1/bin export PATH=$SHACLROOT:$PATH ``` Both tools take the following parameters, for example: `shaclvalidate.bat -datafile myfile.ttl -shapesfile myshapes.ttl` where `-shapesfile` is optional and falls back to using the data graph as shapes graph. Add -validateShapes in case you want to include the metashapes (from the tosh namespace in particular). Currently only Turtle (.ttl) files are supported. The tools print the validation report or the inferences graph to the output screen. <MSG> #86 updated maven.org links <DFF> @@ -15,7 +15,7 @@ Coverage: See [SHACL-JS](https://github.com/TopQuadrant/shacl-js) for a pure JavaScript implementation. -The same code is used in the TopBraid products (currently aligned with the upcoming TopBraid 6.3 release). +The same code is used in the TopBraid products (currently aligned with the TopBraid 6.3 release). Feedback and questions should become GitHub issues or sent to TopBraid Users mailing list: https://groups.google.com/forum/#!forum/topbraid-users @@ -40,11 +40,11 @@ Releases are available in the central maven repository: Download the latest release from: -`http://central.maven.org/maven2/org/topbraid/shacl/` +`https://repo1.maven.org/maven2/org/topbraid/shacl/` The binary distribution is: -`http://central.maven.org/maven2/org/topbraid/shacl/*VER*/shacl-*VER*-bin.zip`. +`https://repo1.maven.org/maven2/org/topbraid/shacl/*VER*/shacl-*VER*-bin.zip`. Two command line utilities are included: validate (performs constraint validation) and infer (performs SHACL rule inferencing).
3
#86 updated maven.org links
3
.md
md
apache-2.0
TopQuadrant/shacl
388
<NME> process.md <BEF> # Processes for the Project This page describes processes for the SHACL API Project. ## Local Build To build the latest code for your lcoal system: Clone the github repo, run maven in the local directory: Clone the github repo, run maven in the local directory: ``` git clone https://github.com/TopQuadrant/shacl cd shacl mvn clean install ``` The latest SNAPSHOT code is now available in you local maven repository. Check the pom.xml for the correct version string. ``` <dependency> <groupId>org.topbraid</groupId> <artifactId>shacl</artifactId> <version>VERSION</version> </dependency> ``` ---- ## Release ### Prerequisites One time setup: 1. A PGP key for signing the release. This needs to be registered on one of the public servers e.g. [http://pgpkeys.mit.edu/](http://pgpkeys.mit.edu/). 1. Write access to the GitHub repo - the release process updates the versions and creates a tag. 1. Write access to the Sonatype OpenSource Hosting Nexus server for `org.topbraid`. Put your user name and password for accessing the Sonatype open source repository in your personal `settings.xml` (e.g. `$HOME/.m2/settings.xml`). ``` <server> <id>ossrh.snapshots</id> <username>SONATYPE_USERNAME</username> <password>SONATYPE_PASSWORD</password> <username>SONATYPE_USERNAME</username> <password>SONATYPE_PASSWORD</password> </server> ``` ### Release Process ``` ### Setup Release Process #### Versions Choose the release version, next version and the tag, otherwise maven will ask for these interactively: ``` export VER="-DreleaseVersion=x.y.z -DdevelopmentVersion=x.next.z-SNAPSHOT -Dtag=shacl-x.y.z" ``` The maven release plugin will move the version from the current SNAPSHOT to the release version, and tag the github repository. It will also move to the next SNAPSHOT version after building the release. #### Signing If you have multiple PGP keys, choose the right one: `export KEY="-Darguments=-Dgpg.keyname=KEY_SIGNATURE"` (Note the slightly odd value here; the release plugin calls maven recursively and `-Darguments=` is maven recursively passing down arguments to the subprocess.) It is advisable to dry run the release: `mvn release:clean release:prepare $VER -DdryRun=true` $KEY #### Check Look in `target/` You should see various files shacl-VER-SNAPSHOT and with them a `.asc` signing file. It still says "SNAPSHOT" because the dry run does not change the version in POM. ### Check Look in `target/`. You should see various files built including the binary ".bin.zip", the javadoc (which is only done in the release cycle), `sources`, `tests` and `test-sources`. The files should have been signed and `.asc` files created. If there is no javadoc jar or no `.asc` files, check you gave the `-Prelease` argument. It still says "SNAPSHOT" because the dry run does not change the version in POM. ### Do the release This has two steps: `mvn release:clean release:prepare -Prelease $KEY $VER` `mvn release:perform -Prelease $KEY $VER` ### If it goes wrong: `mvn release:rollback` `mvn release:clean` You may also need to delete the tag. `git tag -d shacl-x.y.z` `git push --delete origin shacl-x.y.z` ### Release to central The steps so far pushed the built artifacts to the staging repository. To push them up to central.maven, go to https://oss.sonatype.org/ * Find repo (it's open) `orgtopbraid....` * Check it ("content" tab) * Close it, at which point the checking rules run. * Refresh the webpage until rule checking completes. * If all is good, click "release" at the top. The release artifacts end up in "Repositories -> Releases -> org.topbraid". ### Github Do a Github release using the tag `shacl-x.y.z` above. ### Clearup Check where any intermediate files are left over. You may wish to build the new SNAPSHOT development version for your local system with: `mvn clean install` and clean your local maven repository of old snapshots. <MSG> Complete POM for release process <DFF> @@ -4,7 +4,7 @@ This page describes processes for the SHACL API Project. ## Local Build -To build the latest code for your lcoal system: +To build the latest snapshot code for your local system: Clone the github repo, run maven in the local directory: @@ -52,7 +52,6 @@ repository in your personal `settings.xml` (e.g. `$HOME/.m2/settings.xml`). <username>SONATYPE_USERNAME</username> <password>SONATYPE_PASSWORD</password> </server> - ``` ### Release Process @@ -85,14 +84,15 @@ export KEY="" It is advisable to dry run the release: -`mvn release:clean release:prepare $VER -DdryRun=true` $KEY +``` +mvn release:clean release:prepare $VER -DdryRun=true $KEY +``` #### Check Look in `target/` -You should see various files shacl-VER-SNAPSHOT and with them a `.asc` -signing file. +You should see various files built. It still says "SNAPSHOT" because the dry run does not change the version in POM.
5
Complete POM for release process
5
.md
md
apache-2.0
TopQuadrant/shacl
389
<NME> process.md <BEF> # Processes for the Project This page describes processes for the SHACL API Project. ## Local Build To build the latest code for your lcoal system: Clone the github repo, run maven in the local directory: Clone the github repo, run maven in the local directory: ``` git clone https://github.com/TopQuadrant/shacl cd shacl mvn clean install ``` The latest SNAPSHOT code is now available in you local maven repository. Check the pom.xml for the correct version string. ``` <dependency> <groupId>org.topbraid</groupId> <artifactId>shacl</artifactId> <version>VERSION</version> </dependency> ``` ---- ## Release ### Prerequisites One time setup: 1. A PGP key for signing the release. This needs to be registered on one of the public servers e.g. [http://pgpkeys.mit.edu/](http://pgpkeys.mit.edu/). 1. Write access to the GitHub repo - the release process updates the versions and creates a tag. 1. Write access to the Sonatype OpenSource Hosting Nexus server for `org.topbraid`. Put your user name and password for accessing the Sonatype open source repository in your personal `settings.xml` (e.g. `$HOME/.m2/settings.xml`). ``` <server> <id>ossrh.snapshots</id> <username>SONATYPE_USERNAME</username> <password>SONATYPE_PASSWORD</password> <username>SONATYPE_USERNAME</username> <password>SONATYPE_PASSWORD</password> </server> ``` ### Release Process ``` ### Setup Release Process #### Versions Choose the release version, next version and the tag, otherwise maven will ask for these interactively: ``` export VER="-DreleaseVersion=x.y.z -DdevelopmentVersion=x.next.z-SNAPSHOT -Dtag=shacl-x.y.z" ``` The maven release plugin will move the version from the current SNAPSHOT to the release version, and tag the github repository. It will also move to the next SNAPSHOT version after building the release. #### Signing If you have multiple PGP keys, choose the right one: `export KEY="-Darguments=-Dgpg.keyname=KEY_SIGNATURE"` (Note the slightly odd value here; the release plugin calls maven recursively and `-Darguments=` is maven recursively passing down arguments to the subprocess.) It is advisable to dry run the release: `mvn release:clean release:prepare $VER -DdryRun=true` $KEY #### Check Look in `target/` You should see various files shacl-VER-SNAPSHOT and with them a `.asc` signing file. It still says "SNAPSHOT" because the dry run does not change the version in POM. ### Check Look in `target/`. You should see various files built including the binary ".bin.zip", the javadoc (which is only done in the release cycle), `sources`, `tests` and `test-sources`. The files should have been signed and `.asc` files created. If there is no javadoc jar or no `.asc` files, check you gave the `-Prelease` argument. It still says "SNAPSHOT" because the dry run does not change the version in POM. ### Do the release This has two steps: `mvn release:clean release:prepare -Prelease $KEY $VER` `mvn release:perform -Prelease $KEY $VER` ### If it goes wrong: `mvn release:rollback` `mvn release:clean` You may also need to delete the tag. `git tag -d shacl-x.y.z` `git push --delete origin shacl-x.y.z` ### Release to central The steps so far pushed the built artifacts to the staging repository. To push them up to central.maven, go to https://oss.sonatype.org/ * Find repo (it's open) `orgtopbraid....` * Check it ("content" tab) * Close it, at which point the checking rules run. * Refresh the webpage until rule checking completes. * If all is good, click "release" at the top. The release artifacts end up in "Repositories -> Releases -> org.topbraid". ### Github Do a Github release using the tag `shacl-x.y.z` above. ### Clearup Check where any intermediate files are left over. You may wish to build the new SNAPSHOT development version for your local system with: `mvn clean install` and clean your local maven repository of old snapshots. <MSG> Complete POM for release process <DFF> @@ -4,7 +4,7 @@ This page describes processes for the SHACL API Project. ## Local Build -To build the latest code for your lcoal system: +To build the latest snapshot code for your local system: Clone the github repo, run maven in the local directory: @@ -52,7 +52,6 @@ repository in your personal `settings.xml` (e.g. `$HOME/.m2/settings.xml`). <username>SONATYPE_USERNAME</username> <password>SONATYPE_PASSWORD</password> </server> - ``` ### Release Process @@ -85,14 +84,15 @@ export KEY="" It is advisable to dry run the release: -`mvn release:clean release:prepare $VER -DdryRun=true` $KEY +``` +mvn release:clean release:prepare $VER -DdryRun=true $KEY +``` #### Check Look in `target/` -You should see various files shacl-VER-SNAPSHOT and with them a `.asc` -signing file. +You should see various files built. It still says "SNAPSHOT" because the dry run does not change the version in POM.
5
Complete POM for release process
5
.md
md
apache-2.0
TopQuadrant/shacl
390
<NME> languageIn-001.test.ttl <BEF> ADDFILE <MSG> Added sh:languageIn <DFF> @@ -0,0 +1,67 @@ +# baseURI: http://datashapes.org/sh/tests/core/property/languageIn-001.test +# imports: http://datashapes.org/dash +# prefix: ex + +@prefix dash: <http://datashapes.org/dash#> . +@prefix ex: <http://datashapes.org/sh/tests/core/property/languageIn-001.test#> . +@prefix owl: <http://www.w3.org/2002/07/owl#> . +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix sh: <http://www.w3.org/ns/shacl#> . +@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . + +<http://datashapes.org/sh/tests/core/property/languageIn-001.test> + rdf:type owl:Ontology ; + rdfs:label "Test of languageIn-001" ; + owl:imports <http://datashapes.org/dash> ; + owl:versionInfo "Created with TopBraid Composer" ; +. +ex:Berg + ex:prefLabel ex:BergLabel ; + ex:prefLabel "Berg" ; + ex:prefLabel "Berg"@de ; +. +ex:GraphValidationTestCase + rdf:type dash:GraphValidationTestCase ; + dash:expectedResult [ + rdf:type sh:ValidationResult ; + sh:focusNode ex:Berg ; + sh:path ex:prefLabel ; + sh:severity sh:Violation ; + sh:sourceConstraintComponent sh:LanguageInConstraintComponent ; + sh:value ex:BergLabel ; + ] ; + dash:expectedResult [ + rdf:type sh:ValidationResult ; + sh:focusNode ex:Berg ; + sh:path ex:prefLabel ; + sh:severity sh:Violation ; + sh:sourceConstraintComponent sh:LanguageInConstraintComponent ; + sh:value "Berg" ; + ] ; + dash:expectedResult [ + rdf:type sh:ValidationResult ; + sh:focusNode ex:Berg ; + sh:path ex:prefLabel ; + sh:severity sh:Violation ; + sh:sourceConstraintComponent sh:LanguageInConstraintComponent ; + sh:value "Berg"@de ; + ] ; +. +ex:Mountain + ex:prefLabel "Hill"@en-NZ ; + ex:prefLabel "Maunga"@mi ; + ex:prefLabel "Mountain"@en ; +. +ex:NewZealandLanguagesShape + rdf:type sh:Shape ; + sh:property [ + sh:predicate ex:prefLabel ; + sh:languageIn ( + "en" + "mi" + ) ; + ] ; + sh:targetNode ex:Berg ; + sh:targetNode ex:Mountain ; +.
67
Added sh:languageIn
0
.ttl
test
apache-2.0
TopQuadrant/shacl
391
<NME> languageIn-001.test.ttl <BEF> ADDFILE <MSG> Added sh:languageIn <DFF> @@ -0,0 +1,67 @@ +# baseURI: http://datashapes.org/sh/tests/core/property/languageIn-001.test +# imports: http://datashapes.org/dash +# prefix: ex + +@prefix dash: <http://datashapes.org/dash#> . +@prefix ex: <http://datashapes.org/sh/tests/core/property/languageIn-001.test#> . +@prefix owl: <http://www.w3.org/2002/07/owl#> . +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix sh: <http://www.w3.org/ns/shacl#> . +@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . + +<http://datashapes.org/sh/tests/core/property/languageIn-001.test> + rdf:type owl:Ontology ; + rdfs:label "Test of languageIn-001" ; + owl:imports <http://datashapes.org/dash> ; + owl:versionInfo "Created with TopBraid Composer" ; +. +ex:Berg + ex:prefLabel ex:BergLabel ; + ex:prefLabel "Berg" ; + ex:prefLabel "Berg"@de ; +. +ex:GraphValidationTestCase + rdf:type dash:GraphValidationTestCase ; + dash:expectedResult [ + rdf:type sh:ValidationResult ; + sh:focusNode ex:Berg ; + sh:path ex:prefLabel ; + sh:severity sh:Violation ; + sh:sourceConstraintComponent sh:LanguageInConstraintComponent ; + sh:value ex:BergLabel ; + ] ; + dash:expectedResult [ + rdf:type sh:ValidationResult ; + sh:focusNode ex:Berg ; + sh:path ex:prefLabel ; + sh:severity sh:Violation ; + sh:sourceConstraintComponent sh:LanguageInConstraintComponent ; + sh:value "Berg" ; + ] ; + dash:expectedResult [ + rdf:type sh:ValidationResult ; + sh:focusNode ex:Berg ; + sh:path ex:prefLabel ; + sh:severity sh:Violation ; + sh:sourceConstraintComponent sh:LanguageInConstraintComponent ; + sh:value "Berg"@de ; + ] ; +. +ex:Mountain + ex:prefLabel "Hill"@en-NZ ; + ex:prefLabel "Maunga"@mi ; + ex:prefLabel "Mountain"@en ; +. +ex:NewZealandLanguagesShape + rdf:type sh:Shape ; + sh:property [ + sh:predicate ex:prefLabel ; + sh:languageIn ( + "en" + "mi" + ) ; + ] ; + sh:targetNode ex:Berg ; + sh:targetNode ex:Mountain ; +.
67
Added sh:languageIn
0
.ttl
test
apache-2.0
TopQuadrant/shacl
392
<NME> process.md <BEF> # Processes for the Project This page describes processes for the SHACL API Project. ---- ## Local Build To build the latest snapshot code for your local system: Clone the github repo, run maven in the local directory: ``` git clone https://github.com/TopQuadrant/shacl cd shacl mvn clean install ``` The latest SNAPSHOT code is now available in you local maven repository. Check the pom.xml for the correct version string. ``` <dependency> <groupId>org.topbraid</groupId> <artifactId>shacl</artifactId> <version>VERSION</version> </dependency> ``` ---- ## Release ### Prerequisites One time setup: 1. A PGP key for signing the release. This needs to be registered on one of the public servers e.g. [http://pgpkeys.mit.edu/](http://pgpkeys.mit.edu/). 1. Write access to the GitHub repo - the release process updates the versions and creates a tag. 1. Write access to the Sonatype OpenSource Hosting Nexus server for `org.topbraid`. Put your user name and password for accessing the Sonatype open source repository in your personal `settings.xml` (e.g. `$HOME/.m2/settings.xml`). ``` <server> <id>ossrh.snapshots</id> <username>SONATYPE_USERNAME</username> <password>SONATYPE_PASSWORD</password> </server> <server> <id>ossrh.releases</id> <username>SONATYPE_USERNAME</username> <password>SONATYPE_PASSWORD</password> </server> ``` ### Setup Release Process #### Versions Choose the release version, next version and the tag, otherwise maven will ask for these interactively: ``` export VER="-DreleaseVersion=x.y.z -DdevelopmentVersion=x.next.z-SNAPSHOT -Dtag=shacl-x.y.z" ``` The maven release plugin will move the version from the current SNAPSHOT to the release version, and tag the github repository. It will also move to the next SNAPSHOT version after building the release. #### Signing If you have multiple PGP keys, choose the right one: `export KEY="-Darguments=-Dgpg.keyname=KEY_SIGNATURE"` (Note the slightly odd value here; the release plugin calls maven recursively and `-Darguments=` is maven recursively passing down arguments to the subprocess.) If you have only one key, set this to the empty string: ``` export KEY="" ``` or omit `$KEY` in the examples below. ### Dry run It is advisable to dry run the release: ``` mvn release:clean release:prepare -DdryRun=true -Prelease $VER $KEY ``` ### Check Look in `target/`. You should see various files built including thebinary ".bin.zip", the javadoc (which is only done in the release cycle), `sources`, `tests` and `test-sources`. The files should have been signed and `.asc` files created. If there is no javadoc jar or no `.asc` files, check you gave the `-Prelease` argument. It still says "SNAPSHOT" because the dry run does not change the version in POM. ### Do the release This has two steps: `mvn release:clean release:prepare -Prelease $KEY $VER` `mvn release:perform -Prelease $KEY $VER` ### If it goes wrong: `mvn release:rollback` `mvn release:clean` You may also need to delete the tag. `git tag -d shacl-x.y.z` `git push --delete origin shacl-x.y.z` ### Release to central The steps so far pushed the built artifacts to the staging repository. To push them up to central.maven, go to https://oss.sonatype.org/ * Find repo (it's open) `orgtopbraid....` * Check it ("content" tab) * Close it, at which point the checking rules run. * Refresh the webpage until rule checking completes. * If all is good, click "release" at the top. The release artifacts end up in "Repositories -> Releases -> org.topbraid". ### Github Do a Github release using the tag `shacl-x.y.z` above. ### Clearup Check where any intermediate files are left over. You may wish to build the new SNAPSHOT development version for your local system with: `mvn clean install` and clean your local maven repository of old snapshots. <MSG> Update process.md <DFF> @@ -101,7 +101,7 @@ mvn release:clean release:prepare -DdryRun=true -Prelease $VER $KEY Look in `target/`. -You should see various files built including thebinary ".bin.zip", the +You should see various files built including the binary ".bin.zip", the javadoc (which is only done in the release cycle), `sources`, `tests` and `test-sources`. The files should have been signed and `.asc` files created.
1
Update process.md
1
.md
md
apache-2.0
TopQuadrant/shacl
393
<NME> process.md <BEF> # Processes for the Project This page describes processes for the SHACL API Project. ---- ## Local Build To build the latest snapshot code for your local system: Clone the github repo, run maven in the local directory: ``` git clone https://github.com/TopQuadrant/shacl cd shacl mvn clean install ``` The latest SNAPSHOT code is now available in you local maven repository. Check the pom.xml for the correct version string. ``` <dependency> <groupId>org.topbraid</groupId> <artifactId>shacl</artifactId> <version>VERSION</version> </dependency> ``` ---- ## Release ### Prerequisites One time setup: 1. A PGP key for signing the release. This needs to be registered on one of the public servers e.g. [http://pgpkeys.mit.edu/](http://pgpkeys.mit.edu/). 1. Write access to the GitHub repo - the release process updates the versions and creates a tag. 1. Write access to the Sonatype OpenSource Hosting Nexus server for `org.topbraid`. Put your user name and password for accessing the Sonatype open source repository in your personal `settings.xml` (e.g. `$HOME/.m2/settings.xml`). ``` <server> <id>ossrh.snapshots</id> <username>SONATYPE_USERNAME</username> <password>SONATYPE_PASSWORD</password> </server> <server> <id>ossrh.releases</id> <username>SONATYPE_USERNAME</username> <password>SONATYPE_PASSWORD</password> </server> ``` ### Setup Release Process #### Versions Choose the release version, next version and the tag, otherwise maven will ask for these interactively: ``` export VER="-DreleaseVersion=x.y.z -DdevelopmentVersion=x.next.z-SNAPSHOT -Dtag=shacl-x.y.z" ``` The maven release plugin will move the version from the current SNAPSHOT to the release version, and tag the github repository. It will also move to the next SNAPSHOT version after building the release. #### Signing If you have multiple PGP keys, choose the right one: `export KEY="-Darguments=-Dgpg.keyname=KEY_SIGNATURE"` (Note the slightly odd value here; the release plugin calls maven recursively and `-Darguments=` is maven recursively passing down arguments to the subprocess.) If you have only one key, set this to the empty string: ``` export KEY="" ``` or omit `$KEY` in the examples below. ### Dry run It is advisable to dry run the release: ``` mvn release:clean release:prepare -DdryRun=true -Prelease $VER $KEY ``` ### Check Look in `target/`. You should see various files built including thebinary ".bin.zip", the javadoc (which is only done in the release cycle), `sources`, `tests` and `test-sources`. The files should have been signed and `.asc` files created. If there is no javadoc jar or no `.asc` files, check you gave the `-Prelease` argument. It still says "SNAPSHOT" because the dry run does not change the version in POM. ### Do the release This has two steps: `mvn release:clean release:prepare -Prelease $KEY $VER` `mvn release:perform -Prelease $KEY $VER` ### If it goes wrong: `mvn release:rollback` `mvn release:clean` You may also need to delete the tag. `git tag -d shacl-x.y.z` `git push --delete origin shacl-x.y.z` ### Release to central The steps so far pushed the built artifacts to the staging repository. To push them up to central.maven, go to https://oss.sonatype.org/ * Find repo (it's open) `orgtopbraid....` * Check it ("content" tab) * Close it, at which point the checking rules run. * Refresh the webpage until rule checking completes. * If all is good, click "release" at the top. The release artifacts end up in "Repositories -> Releases -> org.topbraid". ### Github Do a Github release using the tag `shacl-x.y.z` above. ### Clearup Check where any intermediate files are left over. You may wish to build the new SNAPSHOT development version for your local system with: `mvn clean install` and clean your local maven repository of old snapshots. <MSG> Update process.md <DFF> @@ -101,7 +101,7 @@ mvn release:clean release:prepare -DdryRun=true -Prelease $VER $KEY Look in `target/`. -You should see various files built including thebinary ".bin.zip", the +You should see various files built including the binary ".bin.zip", the javadoc (which is only done in the release cycle), `sources`, `tests` and `test-sources`. The files should have been signed and `.asc` files created.
1
Update process.md
1
.md
md
apache-2.0
TopQuadrant/shacl
394
<NME> SH.java <BEF> /* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * See the NOTICE file distributed with this work for additional * information regarding copyright ownership. */ package org.topbraid.shacl.vocabulary; import org.apache.jena.rdf.model.Property; import org.apache.jena.rdf.model.Resource; import org.apache.jena.rdf.model.ResourceFactory; import org.apache.jena.sparql.core.Var; /** * Vocabulary for http://www.w3.org/ns/shacl# * * @author Holger Knublauch */ public class SH { public final static String BASE_URI = "http://www.w3.org/ns/shacl#"; public final static String NAME = "SHACL"; public final static String NS = BASE_URI; public final static Resource DefaultValueTypeRule = ResourceFactory.createResource(NS + "DefaultValueTypeRule"); public final static Resource Error = ResourceFactory.createResource(NS + "Error"); public final static Resource Function = ResourceFactory.createResource(NS + "Function"); public final static Resource Functions = ResourceFactory.createResource(NS + "Functions"); public final static Resource BlankNode = ResourceFactory.createResource(NS + "BlankNode"); public final static Resource BlankNodeOrIRI = ResourceFactory.createResource(NS + "BlankNodeOrIRI"); public final static Resource BlankNodeOrLiteral = ResourceFactory.createResource(NS + "BlankNodeOrLiteral"); public final static Resource ClassConstraintComponent = ResourceFactory.createResource(NS + "ClassConstraintComponent"); public final static Resource ClosedConstraintComponent = ResourceFactory.createResource(NS + "ClosedConstraintComponent"); public final static Resource Constraint = ResourceFactory.createResource(NS + "Constraint"); public final static Resource ConstraintComponent = ResourceFactory.createResource(NS + "ConstraintComponent"); public final static Resource DatatypeConstraintComponent = ResourceFactory.createResource(NS + "DatatypeConstraintComponent"); public final static Resource DisjointConstraintComponent = ResourceFactory.createResource(NS + "DisjointConstraintComponent"); public final static Resource EqualsConstraintComponent = ResourceFactory.createResource(NS + "EqualsConstraintComponent"); public final static Resource HasValueConstraintComponent = ResourceFactory.createResource(NS + "HasValueConstraintComponent"); public final static Resource InConstraintComponent = ResourceFactory.createResource(NS + "InConstraintComponent"); public final static Resource Info = ResourceFactory.createResource(NS + "Info"); public final static Resource IRI = ResourceFactory.createResource(NS + "IRI"); public final static Resource IRIOrLiteral = ResourceFactory.createResource(NS + "IRIOrLiteral"); public final static Resource LanguageInConstraintComponent = ResourceFactory.createResource(NS + "LanguageInConstraintComponent"); public final static Resource LessThanConstraintComponent = ResourceFactory.createResource(NS + "LessThanConstraintComponent"); public final static Resource LessThanOrEqualsConstraintComponent = ResourceFactory.createResource(NS + "LessThanOrEqualsConstraintComponent"); public final static Resource Literal = ResourceFactory.createResource(NS + "Literal"); public final static Resource MaxCountConstraintComponent = ResourceFactory.createResource(NS + "MaxCountConstraintComponent"); public final static Resource ValidationResult = ResourceFactory.createResource(NS + "ValidationResult"); public final static Resource Warning = ResourceFactory.createResource(NS + "Warning"); public final static Resource MinExclusiveConstraintComponent = ResourceFactory.createResource(NS + "MinExclusiveConstraintComponent"); public final static Resource MinInclusiveConstraintComponent = ResourceFactory.createResource(NS + "MinInclusiveConstraintComponent"); public final static Resource MinLengthConstraintComponent = ResourceFactory.createResource(NS + "MinLengthConstraintComponent"); public final static Resource NodeConstraintComponent = ResourceFactory.createResource(NS + "NodeConstraintComponent"); public final static Resource NodeKindConstraintComponent = ResourceFactory.createResource(NS + "NodeKindConstraintComponent"); public final static Resource NodeShape = ResourceFactory.createResource(NS + "NodeShape"); public final static Resource NotConstraintComponent = ResourceFactory.createResource(NS + "NotConstraintComponent"); public final static Resource OrConstraintComponent = ResourceFactory.createResource(NS + "OrConstraintComponent"); public final static Resource Parameter = ResourceFactory.createResource(NS + "Parameter"); public final static Resource Parameterizable = ResourceFactory.createResource(NS + "Parameterizable"); public final static Resource PatternConstraintComponent = ResourceFactory.createResource(NS + "PatternConstraintComponent"); public final static Resource PrefixDeclaration = ResourceFactory.createResource(NS + "PrefixDeclaration"); public final static Resource PropertyGroup = ResourceFactory.createResource(NS + "PropertyGroup"); public final static Resource PropertyShape = ResourceFactory.createResource(NS + "PropertyShape"); public final static Resource PropertyConstraintComponent = ResourceFactory.createResource(NS + "PropertyConstraintComponent"); public final static Resource QualifiedMaxCountConstraintComponent = ResourceFactory.createResource(NS + "QualifiedMaxCountConstraintComponent"); public final static Resource QualifiedMinCountConstraintComponent = ResourceFactory.createResource(NS + "QualifiedMinCountConstraintComponent"); public final static Resource ResultAnnotation = ResourceFactory.createResource(NS + "ResultAnnotation"); public final static Resource Shape = ResourceFactory.createResource(NS + "Shape"); public final static Resource SPARQLAskValidator = ResourceFactory.createResource(NS + "SPARQLAskValidator"); public final static Resource SPARQLConstraint = ResourceFactory.createResource(NS + "SPARQLConstraint"); public final static Resource SPARQLConstraintComponent = ResourceFactory.createResource(NS + "SPARQLConstraintComponent"); public final static Resource SPARQLConstructRule = ResourceFactory.createResource(NS + "SPARQLConstructRule"); public final static Resource SPARQLExecutable = ResourceFactory.createResource(NS + "SPARQLExecutable"); public final static Resource SPARQLFunction = ResourceFactory.createResource(NS + "SPARQLFunction"); public final static Resource SPARQLSelectValidator = ResourceFactory.createResource(NS + "SPARQLSelectValidator"); public final static Resource SPARQLTarget = ResourceFactory.createResource(NS + "SPARQLTarget"); public final static Resource SPARQLValuesDeriver = ResourceFactory.createResource(NS + "SPARQLValuesDeriver"); public final static Resource UniqueLangConstraintComponent = ResourceFactory.createResource(NS + "UniqueLangConstraintComponent"); public final static Resource ValidationReport = ResourceFactory.createResource(NS + "ValidationReport"); public final static Resource ValidationResult = ResourceFactory.createResource(NS + "ValidationResult"); public final static Resource Validator = ResourceFactory.createResource(NS + "Validator"); public final static Resource Violation = ResourceFactory.createResource(NS + "Violation"); public final static Resource Warning = ResourceFactory.createResource(NS + "Warning"); public final static Resource XoneConstraintComponent = ResourceFactory.createResource(NS + "XoneConstraintComponent"); public final static Property alternativePath = ResourceFactory.createProperty(NS + "alternativePath"); public final static Property and = ResourceFactory.createProperty(NS + "and"); public final static Property ask = ResourceFactory.createProperty(NS + "ask"); public final static Property class_ = ResourceFactory.createProperty(NS + "class"); public final static Property closed = ResourceFactory.createProperty(NS + "closed"); public final static Property condition = ResourceFactory.createProperty(NS + "condition"); public final static Property conforms = ResourceFactory.createProperty(NS + "conforms"); public final static Property construct = ResourceFactory.createProperty(NS + "construct"); public final static Property datatype = ResourceFactory.createProperty(NS + "datatype"); public final static Property deactivated = ResourceFactory.createProperty(NS + "deactivated"); public final static Property declare = ResourceFactory.createProperty(NS + "declare"); public final static Property defaultValue = ResourceFactory.createProperty(NS + "defaultValue"); public final static Property detail = ResourceFactory.createProperty(NS + "detail"); public final static Property description = ResourceFactory.createProperty(NS + "description"); public final static Property disjoint = ResourceFactory.createProperty(NS + "disjoint"); public final static Property entailment = ResourceFactory.createProperty(NS + "entailment"); public final static Property equals = ResourceFactory.createProperty(NS + "equals"); public final static Property flags = ResourceFactory.createProperty(NS + "flags"); public final static Property focusNode = ResourceFactory.createProperty(NS + "focusNode"); public final static Property group = ResourceFactory.createProperty(NS + "group"); public final static Property hasValue = ResourceFactory.createProperty(NS + "hasValue"); public final static Property ignoredProperties = ResourceFactory.createProperty(NS + "ignoredProperties"); public final static Property in = ResourceFactory.createProperty(NS + "in"); public final static Property inversePath = ResourceFactory.createProperty(NS + "inversePath"); public final static Property labelTemplate = ResourceFactory.createProperty(NS + "labelTemplate"); public final static Property languageIn = ResourceFactory.createProperty(NS + "languageIn"); public final static Property lessThan = ResourceFactory.createProperty(NS + "lessThan"); public final static Property lessThanOrEquals = ResourceFactory.createProperty(NS + "lessThanOrEquals"); public final static Property maxCount = ResourceFactory.createProperty(NS + "maxCount"); public final static Property maxExclusive = ResourceFactory.createProperty(NS + "maxExclusive"); public final static Property maxInclusive = ResourceFactory.createProperty(NS + "maxInclusive"); public final static Property maxLength = ResourceFactory.createProperty(NS + "maxLength"); public final static Property message = ResourceFactory.createProperty(NS + "message"); public final static Property minCount = ResourceFactory.createProperty(NS + "minCount"); public final static Property minExclusive = ResourceFactory.createProperty(NS + "minExclusive"); public final static Property minInclusive = ResourceFactory.createProperty(NS + "minInclusive"); public final static Property minLength = ResourceFactory.createProperty(NS + "minLength"); public final static Property name = ResourceFactory.createProperty(NS + "name"); public final static Property namespace = ResourceFactory.createProperty(NS + "namespace"); public final static Property node = ResourceFactory.createProperty(NS + "node"); public final static Property nodeKind = ResourceFactory.createProperty(NS + "nodeKind"); public final static Property nodeValidator = ResourceFactory.createProperty(NS + "nodeValidator"); public final static Property not = ResourceFactory.createProperty(NS + "not"); public final static Property oneOrMorePath = ResourceFactory.createProperty(NS + "oneOrMorePath"); public final static Property optional = ResourceFactory.createProperty(NS + "optional"); public final static Property or = ResourceFactory.createProperty(NS + "or"); public final static Property order = ResourceFactory.createProperty(NS + "order"); public final static Property parameter = ResourceFactory.createProperty(NS + "parameter"); public final static Property path = ResourceFactory.createProperty(NS + "path"); public final static Property pattern = ResourceFactory.createProperty(NS + "pattern"); public final static Property prefix = ResourceFactory.createProperty(NS + "prefix"); public final static Property prefixes = ResourceFactory.createProperty(NS + "prefixes"); public final static Property property = ResourceFactory.createProperty(NS + "property"); public final static Property propertyValidator = ResourceFactory.createProperty(NS + "propertyValidator"); public final static Property qualifiedMaxCount = ResourceFactory.createProperty(NS + "qualifiedMaxCount"); public final static Property qualifiedMinCount = ResourceFactory.createProperty(NS + "qualifiedMinCount"); public final static Property qualifiedValueShape = ResourceFactory.createProperty(NS + "qualifiedValueShape"); public final static Property qualifiedValueShapesDisjoint = ResourceFactory.createProperty(NS + "qualifiedValueShapesDisjoint"); public final static Property result = ResourceFactory.createProperty(NS + "result"); public final static Property resultMessage = ResourceFactory.createProperty(NS + "resultMessage"); public final static Property resultPath = ResourceFactory.createProperty(NS + "resultPath"); public final static Property resultSeverity = ResourceFactory.createProperty(NS + "resultSeverity"); public final static Property select = ResourceFactory.createProperty(NS + "select"); public final static Property severity = ResourceFactory.createProperty(NS + "severity"); public final static Property shapesGraph = ResourceFactory.createProperty(NS + "shapesGraph"); public final static Property sourceConstraint = ResourceFactory.createProperty(NS + "sourceConstraint"); public final static Property sourceConstraintComponent = ResourceFactory.createProperty(NS + "sourceConstraintComponent"); public final static Property sourceShape = ResourceFactory.createProperty(NS + "sourceShape"); public final static Property sparql = ResourceFactory.createProperty(NS + "sparql"); public final static Property targetClass = ResourceFactory.createProperty(NS + "targetClass"); public final static Property targetNode = ResourceFactory.createProperty(NS + "targetNode"); public final static Property targetObjectsOf = ResourceFactory.createProperty(NS + "targetObjectsOf"); public final static Property targetSubjectsOf = ResourceFactory.createProperty(NS + "targetSubjectsOf"); public final static Property uniqueLang = ResourceFactory.createProperty(NS + "uniqueLang"); public final static Property update = ResourceFactory.createProperty(NS + "update"); public final static Property validator = ResourceFactory.createProperty(NS + "validator"); public final static Property value = ResourceFactory.createProperty(NS + "value"); public final static Property zeroOrMorePath = ResourceFactory.createProperty(NS + "zeroOrMorePath"); public final static Property zeroOrOnePath = ResourceFactory.createProperty(NS + "zeroOrOnePath"); // Advanced features public final static Resource ExpressionConstraintComponent = ResourceFactory.createResource(NS + "ExpressionConstraintComponent"); public final static Resource Function = ResourceFactory.createResource(NS + "Function"); public final static Resource JSConstraint = ResourceFactory.createResource(NS + "JSConstraint"); public final static Resource JSConstraintComponent = ResourceFactory.createResource(NS + "JSConstraintComponent"); public final static Resource JSExecutable = ResourceFactory.createResource(NS + "JSExecutable"); public final static Resource JSFunction = ResourceFactory.createResource(NS + "JSFunction"); public final static Resource JSLibrary = ResourceFactory.createResource(NS + "JSLibrary"); public final static Resource JSRule = ResourceFactory.createResource(NS + "JSRule"); public final static Resource JSTarget = ResourceFactory.createResource(NS + "JSTarget"); public final static Resource JSTargetType = ResourceFactory.createResource(NS + "JSTargetType"); public final static Resource JSValidator = ResourceFactory.createResource(NS + "JSValidator"); public final static Resource Rule = ResourceFactory.createResource(NS + "Rule"); public final static Resource Rules = ResourceFactory.createResource(NS + "Rules"); public final static Resource SPARQLRule = ResourceFactory.createResource(NS + "SPARQLRule"); public final static Resource Target = ResourceFactory.createResource(NS + "Target"); public final static Resource this_ = ResourceFactory.createResource(NS + "this"); public final static Resource TripleRule = ResourceFactory.createResource(NS + "TripleRule"); public final static Property expression = ResourceFactory.createProperty(NS + "expression"); public final static Property filterShape = ResourceFactory.createProperty(NS + "filterShape"); public final static Property intersection = ResourceFactory.createProperty(NS + "intersection"); public final static Property js = ResourceFactory.createProperty(NS + "js"); public final static Property jsFunctionName = ResourceFactory.createProperty(NS + "jsFunctionName"); public final static Property jsLibrary = ResourceFactory.createProperty(NS + "jsLibrary"); public final static Property jsLibraryURL = ResourceFactory.createProperty(NS + "jsLibraryURL"); public final static Property member = ResourceFactory.createProperty(NS + "member"); public final static Property nodes = ResourceFactory.createProperty(NS + "nodes"); public final static Property object = ResourceFactory.createProperty(NS + "object"); public final static Property predicate = ResourceFactory.createProperty(NS + "predicate"); public final static Property returnType = ResourceFactory.createProperty(NS + "returnType"); public final static Property rule = ResourceFactory.createProperty(NS + "rule"); public final static Property subject = ResourceFactory.createProperty(NS + "subject"); public final static Property target = ResourceFactory.createProperty(NS + "target"); public final static Property union = ResourceFactory.createProperty(NS + "union"); // Features not in SHACL 1.0 but candidates for next release public final static Property count = ResourceFactory.createProperty(NS + "count"); public final static Property desc = ResourceFactory.createProperty(NS + "desc"); public final static Property distinct = ResourceFactory.createProperty(NS + "distinct"); public final static Property else_ = ResourceFactory.createProperty(NS + "else"); public final static Property exists = ResourceFactory.createProperty(NS + "exists"); public final static Property groupConcat = ResourceFactory.createProperty(NS + "groupConcat"); public final static Property if_ = ResourceFactory.createProperty(NS + "if"); public final static Property limit = ResourceFactory.createProperty(NS + "limit"); public final static Property max = ResourceFactory.createProperty(NS + "max"); public final static Property min = ResourceFactory.createProperty(NS + "min"); public final static Property minus = ResourceFactory.createProperty(NS + "minus"); public final static Property offset = ResourceFactory.createProperty(NS + "offset"); public final static Property orderBy = ResourceFactory.createProperty(NS + "orderBy"); public final static Property separator = ResourceFactory.createProperty(NS + "separator"); public final static Property sum = ResourceFactory.createProperty(NS + "sum"); public final static Property then = ResourceFactory.createProperty(NS + "then"); public final static Property values = ResourceFactory.createProperty(NS + "values"); public static final Var currentShapeVar = Var.alloc("currentShape"); public static final Var failureVar = Var.alloc("failure"); public static final Var PATHVar = Var.alloc("PATH"); public static final Var pathVar = Var.alloc(path.getLocalName()); public static final Var shapesGraphVar = Var.alloc("shapesGraph"); public static final Var thisVar = Var.alloc("this"); public static final Var valueVar = Var.alloc("value"); public final static String JS_DATA_VAR = "$data"; public final static String JS_SHAPES_VAR = "$shapes"; public static String getURI() { return NS; } } <MSG> Dropped Xor, renamed sh:Error to sh:Violation <DFF> @@ -37,8 +37,6 @@ public class SH { public final static Resource DefaultValueTypeRule = ResourceFactory.createResource(NS + "DefaultValueTypeRule"); - public final static Resource Error = ResourceFactory.createResource(NS + "Error"); - public final static Resource Function = ResourceFactory.createResource(NS + "Function"); public final static Resource Functions = ResourceFactory.createResource(NS + "Functions"); @@ -85,6 +83,8 @@ public class SH { public final static Resource ValidationResult = ResourceFactory.createResource(NS + "ValidationResult"); + public final static Resource Violation = ResourceFactory.createResource(NS + "Violation"); + public final static Resource Warning = ResourceFactory.createResource(NS + "Warning");
2
Dropped Xor, renamed sh:Error to sh:Violation
2
.java
java
apache-2.0
TopQuadrant/shacl
395
<NME> SH.java <BEF> /* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * See the NOTICE file distributed with this work for additional * information regarding copyright ownership. */ package org.topbraid.shacl.vocabulary; import org.apache.jena.rdf.model.Property; import org.apache.jena.rdf.model.Resource; import org.apache.jena.rdf.model.ResourceFactory; import org.apache.jena.sparql.core.Var; /** * Vocabulary for http://www.w3.org/ns/shacl# * * @author Holger Knublauch */ public class SH { public final static String BASE_URI = "http://www.w3.org/ns/shacl#"; public final static String NAME = "SHACL"; public final static String NS = BASE_URI; public final static Resource DefaultValueTypeRule = ResourceFactory.createResource(NS + "DefaultValueTypeRule"); public final static Resource Error = ResourceFactory.createResource(NS + "Error"); public final static Resource Function = ResourceFactory.createResource(NS + "Function"); public final static Resource Functions = ResourceFactory.createResource(NS + "Functions"); public final static Resource BlankNode = ResourceFactory.createResource(NS + "BlankNode"); public final static Resource BlankNodeOrIRI = ResourceFactory.createResource(NS + "BlankNodeOrIRI"); public final static Resource BlankNodeOrLiteral = ResourceFactory.createResource(NS + "BlankNodeOrLiteral"); public final static Resource ClassConstraintComponent = ResourceFactory.createResource(NS + "ClassConstraintComponent"); public final static Resource ClosedConstraintComponent = ResourceFactory.createResource(NS + "ClosedConstraintComponent"); public final static Resource Constraint = ResourceFactory.createResource(NS + "Constraint"); public final static Resource ConstraintComponent = ResourceFactory.createResource(NS + "ConstraintComponent"); public final static Resource DatatypeConstraintComponent = ResourceFactory.createResource(NS + "DatatypeConstraintComponent"); public final static Resource DisjointConstraintComponent = ResourceFactory.createResource(NS + "DisjointConstraintComponent"); public final static Resource EqualsConstraintComponent = ResourceFactory.createResource(NS + "EqualsConstraintComponent"); public final static Resource HasValueConstraintComponent = ResourceFactory.createResource(NS + "HasValueConstraintComponent"); public final static Resource InConstraintComponent = ResourceFactory.createResource(NS + "InConstraintComponent"); public final static Resource Info = ResourceFactory.createResource(NS + "Info"); public final static Resource IRI = ResourceFactory.createResource(NS + "IRI"); public final static Resource IRIOrLiteral = ResourceFactory.createResource(NS + "IRIOrLiteral"); public final static Resource LanguageInConstraintComponent = ResourceFactory.createResource(NS + "LanguageInConstraintComponent"); public final static Resource LessThanConstraintComponent = ResourceFactory.createResource(NS + "LessThanConstraintComponent"); public final static Resource LessThanOrEqualsConstraintComponent = ResourceFactory.createResource(NS + "LessThanOrEqualsConstraintComponent"); public final static Resource Literal = ResourceFactory.createResource(NS + "Literal"); public final static Resource MaxCountConstraintComponent = ResourceFactory.createResource(NS + "MaxCountConstraintComponent"); public final static Resource ValidationResult = ResourceFactory.createResource(NS + "ValidationResult"); public final static Resource Warning = ResourceFactory.createResource(NS + "Warning"); public final static Resource MinExclusiveConstraintComponent = ResourceFactory.createResource(NS + "MinExclusiveConstraintComponent"); public final static Resource MinInclusiveConstraintComponent = ResourceFactory.createResource(NS + "MinInclusiveConstraintComponent"); public final static Resource MinLengthConstraintComponent = ResourceFactory.createResource(NS + "MinLengthConstraintComponent"); public final static Resource NodeConstraintComponent = ResourceFactory.createResource(NS + "NodeConstraintComponent"); public final static Resource NodeKindConstraintComponent = ResourceFactory.createResource(NS + "NodeKindConstraintComponent"); public final static Resource NodeShape = ResourceFactory.createResource(NS + "NodeShape"); public final static Resource NotConstraintComponent = ResourceFactory.createResource(NS + "NotConstraintComponent"); public final static Resource OrConstraintComponent = ResourceFactory.createResource(NS + "OrConstraintComponent"); public final static Resource Parameter = ResourceFactory.createResource(NS + "Parameter"); public final static Resource Parameterizable = ResourceFactory.createResource(NS + "Parameterizable"); public final static Resource PatternConstraintComponent = ResourceFactory.createResource(NS + "PatternConstraintComponent"); public final static Resource PrefixDeclaration = ResourceFactory.createResource(NS + "PrefixDeclaration"); public final static Resource PropertyGroup = ResourceFactory.createResource(NS + "PropertyGroup"); public final static Resource PropertyShape = ResourceFactory.createResource(NS + "PropertyShape"); public final static Resource PropertyConstraintComponent = ResourceFactory.createResource(NS + "PropertyConstraintComponent"); public final static Resource QualifiedMaxCountConstraintComponent = ResourceFactory.createResource(NS + "QualifiedMaxCountConstraintComponent"); public final static Resource QualifiedMinCountConstraintComponent = ResourceFactory.createResource(NS + "QualifiedMinCountConstraintComponent"); public final static Resource ResultAnnotation = ResourceFactory.createResource(NS + "ResultAnnotation"); public final static Resource Shape = ResourceFactory.createResource(NS + "Shape"); public final static Resource SPARQLAskValidator = ResourceFactory.createResource(NS + "SPARQLAskValidator"); public final static Resource SPARQLConstraint = ResourceFactory.createResource(NS + "SPARQLConstraint"); public final static Resource SPARQLConstraintComponent = ResourceFactory.createResource(NS + "SPARQLConstraintComponent"); public final static Resource SPARQLConstructRule = ResourceFactory.createResource(NS + "SPARQLConstructRule"); public final static Resource SPARQLExecutable = ResourceFactory.createResource(NS + "SPARQLExecutable"); public final static Resource SPARQLFunction = ResourceFactory.createResource(NS + "SPARQLFunction"); public final static Resource SPARQLSelectValidator = ResourceFactory.createResource(NS + "SPARQLSelectValidator"); public final static Resource SPARQLTarget = ResourceFactory.createResource(NS + "SPARQLTarget"); public final static Resource SPARQLValuesDeriver = ResourceFactory.createResource(NS + "SPARQLValuesDeriver"); public final static Resource UniqueLangConstraintComponent = ResourceFactory.createResource(NS + "UniqueLangConstraintComponent"); public final static Resource ValidationReport = ResourceFactory.createResource(NS + "ValidationReport"); public final static Resource ValidationResult = ResourceFactory.createResource(NS + "ValidationResult"); public final static Resource Validator = ResourceFactory.createResource(NS + "Validator"); public final static Resource Violation = ResourceFactory.createResource(NS + "Violation"); public final static Resource Warning = ResourceFactory.createResource(NS + "Warning"); public final static Resource XoneConstraintComponent = ResourceFactory.createResource(NS + "XoneConstraintComponent"); public final static Property alternativePath = ResourceFactory.createProperty(NS + "alternativePath"); public final static Property and = ResourceFactory.createProperty(NS + "and"); public final static Property ask = ResourceFactory.createProperty(NS + "ask"); public final static Property class_ = ResourceFactory.createProperty(NS + "class"); public final static Property closed = ResourceFactory.createProperty(NS + "closed"); public final static Property condition = ResourceFactory.createProperty(NS + "condition"); public final static Property conforms = ResourceFactory.createProperty(NS + "conforms"); public final static Property construct = ResourceFactory.createProperty(NS + "construct"); public final static Property datatype = ResourceFactory.createProperty(NS + "datatype"); public final static Property deactivated = ResourceFactory.createProperty(NS + "deactivated"); public final static Property declare = ResourceFactory.createProperty(NS + "declare"); public final static Property defaultValue = ResourceFactory.createProperty(NS + "defaultValue"); public final static Property detail = ResourceFactory.createProperty(NS + "detail"); public final static Property description = ResourceFactory.createProperty(NS + "description"); public final static Property disjoint = ResourceFactory.createProperty(NS + "disjoint"); public final static Property entailment = ResourceFactory.createProperty(NS + "entailment"); public final static Property equals = ResourceFactory.createProperty(NS + "equals"); public final static Property flags = ResourceFactory.createProperty(NS + "flags"); public final static Property focusNode = ResourceFactory.createProperty(NS + "focusNode"); public final static Property group = ResourceFactory.createProperty(NS + "group"); public final static Property hasValue = ResourceFactory.createProperty(NS + "hasValue"); public final static Property ignoredProperties = ResourceFactory.createProperty(NS + "ignoredProperties"); public final static Property in = ResourceFactory.createProperty(NS + "in"); public final static Property inversePath = ResourceFactory.createProperty(NS + "inversePath"); public final static Property labelTemplate = ResourceFactory.createProperty(NS + "labelTemplate"); public final static Property languageIn = ResourceFactory.createProperty(NS + "languageIn"); public final static Property lessThan = ResourceFactory.createProperty(NS + "lessThan"); public final static Property lessThanOrEquals = ResourceFactory.createProperty(NS + "lessThanOrEquals"); public final static Property maxCount = ResourceFactory.createProperty(NS + "maxCount"); public final static Property maxExclusive = ResourceFactory.createProperty(NS + "maxExclusive"); public final static Property maxInclusive = ResourceFactory.createProperty(NS + "maxInclusive"); public final static Property maxLength = ResourceFactory.createProperty(NS + "maxLength"); public final static Property message = ResourceFactory.createProperty(NS + "message"); public final static Property minCount = ResourceFactory.createProperty(NS + "minCount"); public final static Property minExclusive = ResourceFactory.createProperty(NS + "minExclusive"); public final static Property minInclusive = ResourceFactory.createProperty(NS + "minInclusive"); public final static Property minLength = ResourceFactory.createProperty(NS + "minLength"); public final static Property name = ResourceFactory.createProperty(NS + "name"); public final static Property namespace = ResourceFactory.createProperty(NS + "namespace"); public final static Property node = ResourceFactory.createProperty(NS + "node"); public final static Property nodeKind = ResourceFactory.createProperty(NS + "nodeKind"); public final static Property nodeValidator = ResourceFactory.createProperty(NS + "nodeValidator"); public final static Property not = ResourceFactory.createProperty(NS + "not"); public final static Property oneOrMorePath = ResourceFactory.createProperty(NS + "oneOrMorePath"); public final static Property optional = ResourceFactory.createProperty(NS + "optional"); public final static Property or = ResourceFactory.createProperty(NS + "or"); public final static Property order = ResourceFactory.createProperty(NS + "order"); public final static Property parameter = ResourceFactory.createProperty(NS + "parameter"); public final static Property path = ResourceFactory.createProperty(NS + "path"); public final static Property pattern = ResourceFactory.createProperty(NS + "pattern"); public final static Property prefix = ResourceFactory.createProperty(NS + "prefix"); public final static Property prefixes = ResourceFactory.createProperty(NS + "prefixes"); public final static Property property = ResourceFactory.createProperty(NS + "property"); public final static Property propertyValidator = ResourceFactory.createProperty(NS + "propertyValidator"); public final static Property qualifiedMaxCount = ResourceFactory.createProperty(NS + "qualifiedMaxCount"); public final static Property qualifiedMinCount = ResourceFactory.createProperty(NS + "qualifiedMinCount"); public final static Property qualifiedValueShape = ResourceFactory.createProperty(NS + "qualifiedValueShape"); public final static Property qualifiedValueShapesDisjoint = ResourceFactory.createProperty(NS + "qualifiedValueShapesDisjoint"); public final static Property result = ResourceFactory.createProperty(NS + "result"); public final static Property resultMessage = ResourceFactory.createProperty(NS + "resultMessage"); public final static Property resultPath = ResourceFactory.createProperty(NS + "resultPath"); public final static Property resultSeverity = ResourceFactory.createProperty(NS + "resultSeverity"); public final static Property select = ResourceFactory.createProperty(NS + "select"); public final static Property severity = ResourceFactory.createProperty(NS + "severity"); public final static Property shapesGraph = ResourceFactory.createProperty(NS + "shapesGraph"); public final static Property sourceConstraint = ResourceFactory.createProperty(NS + "sourceConstraint"); public final static Property sourceConstraintComponent = ResourceFactory.createProperty(NS + "sourceConstraintComponent"); public final static Property sourceShape = ResourceFactory.createProperty(NS + "sourceShape"); public final static Property sparql = ResourceFactory.createProperty(NS + "sparql"); public final static Property targetClass = ResourceFactory.createProperty(NS + "targetClass"); public final static Property targetNode = ResourceFactory.createProperty(NS + "targetNode"); public final static Property targetObjectsOf = ResourceFactory.createProperty(NS + "targetObjectsOf"); public final static Property targetSubjectsOf = ResourceFactory.createProperty(NS + "targetSubjectsOf"); public final static Property uniqueLang = ResourceFactory.createProperty(NS + "uniqueLang"); public final static Property update = ResourceFactory.createProperty(NS + "update"); public final static Property validator = ResourceFactory.createProperty(NS + "validator"); public final static Property value = ResourceFactory.createProperty(NS + "value"); public final static Property zeroOrMorePath = ResourceFactory.createProperty(NS + "zeroOrMorePath"); public final static Property zeroOrOnePath = ResourceFactory.createProperty(NS + "zeroOrOnePath"); // Advanced features public final static Resource ExpressionConstraintComponent = ResourceFactory.createResource(NS + "ExpressionConstraintComponent"); public final static Resource Function = ResourceFactory.createResource(NS + "Function"); public final static Resource JSConstraint = ResourceFactory.createResource(NS + "JSConstraint"); public final static Resource JSConstraintComponent = ResourceFactory.createResource(NS + "JSConstraintComponent"); public final static Resource JSExecutable = ResourceFactory.createResource(NS + "JSExecutable"); public final static Resource JSFunction = ResourceFactory.createResource(NS + "JSFunction"); public final static Resource JSLibrary = ResourceFactory.createResource(NS + "JSLibrary"); public final static Resource JSRule = ResourceFactory.createResource(NS + "JSRule"); public final static Resource JSTarget = ResourceFactory.createResource(NS + "JSTarget"); public final static Resource JSTargetType = ResourceFactory.createResource(NS + "JSTargetType"); public final static Resource JSValidator = ResourceFactory.createResource(NS + "JSValidator"); public final static Resource Rule = ResourceFactory.createResource(NS + "Rule"); public final static Resource Rules = ResourceFactory.createResource(NS + "Rules"); public final static Resource SPARQLRule = ResourceFactory.createResource(NS + "SPARQLRule"); public final static Resource Target = ResourceFactory.createResource(NS + "Target"); public final static Resource this_ = ResourceFactory.createResource(NS + "this"); public final static Resource TripleRule = ResourceFactory.createResource(NS + "TripleRule"); public final static Property expression = ResourceFactory.createProperty(NS + "expression"); public final static Property filterShape = ResourceFactory.createProperty(NS + "filterShape"); public final static Property intersection = ResourceFactory.createProperty(NS + "intersection"); public final static Property js = ResourceFactory.createProperty(NS + "js"); public final static Property jsFunctionName = ResourceFactory.createProperty(NS + "jsFunctionName"); public final static Property jsLibrary = ResourceFactory.createProperty(NS + "jsLibrary"); public final static Property jsLibraryURL = ResourceFactory.createProperty(NS + "jsLibraryURL"); public final static Property member = ResourceFactory.createProperty(NS + "member"); public final static Property nodes = ResourceFactory.createProperty(NS + "nodes"); public final static Property object = ResourceFactory.createProperty(NS + "object"); public final static Property predicate = ResourceFactory.createProperty(NS + "predicate"); public final static Property returnType = ResourceFactory.createProperty(NS + "returnType"); public final static Property rule = ResourceFactory.createProperty(NS + "rule"); public final static Property subject = ResourceFactory.createProperty(NS + "subject"); public final static Property target = ResourceFactory.createProperty(NS + "target"); public final static Property union = ResourceFactory.createProperty(NS + "union"); // Features not in SHACL 1.0 but candidates for next release public final static Property count = ResourceFactory.createProperty(NS + "count"); public final static Property desc = ResourceFactory.createProperty(NS + "desc"); public final static Property distinct = ResourceFactory.createProperty(NS + "distinct"); public final static Property else_ = ResourceFactory.createProperty(NS + "else"); public final static Property exists = ResourceFactory.createProperty(NS + "exists"); public final static Property groupConcat = ResourceFactory.createProperty(NS + "groupConcat"); public final static Property if_ = ResourceFactory.createProperty(NS + "if"); public final static Property limit = ResourceFactory.createProperty(NS + "limit"); public final static Property max = ResourceFactory.createProperty(NS + "max"); public final static Property min = ResourceFactory.createProperty(NS + "min"); public final static Property minus = ResourceFactory.createProperty(NS + "minus"); public final static Property offset = ResourceFactory.createProperty(NS + "offset"); public final static Property orderBy = ResourceFactory.createProperty(NS + "orderBy"); public final static Property separator = ResourceFactory.createProperty(NS + "separator"); public final static Property sum = ResourceFactory.createProperty(NS + "sum"); public final static Property then = ResourceFactory.createProperty(NS + "then"); public final static Property values = ResourceFactory.createProperty(NS + "values"); public static final Var currentShapeVar = Var.alloc("currentShape"); public static final Var failureVar = Var.alloc("failure"); public static final Var PATHVar = Var.alloc("PATH"); public static final Var pathVar = Var.alloc(path.getLocalName()); public static final Var shapesGraphVar = Var.alloc("shapesGraph"); public static final Var thisVar = Var.alloc("this"); public static final Var valueVar = Var.alloc("value"); public final static String JS_DATA_VAR = "$data"; public final static String JS_SHAPES_VAR = "$shapes"; public static String getURI() { return NS; } } <MSG> Dropped Xor, renamed sh:Error to sh:Violation <DFF> @@ -37,8 +37,6 @@ public class SH { public final static Resource DefaultValueTypeRule = ResourceFactory.createResource(NS + "DefaultValueTypeRule"); - public final static Resource Error = ResourceFactory.createResource(NS + "Error"); - public final static Resource Function = ResourceFactory.createResource(NS + "Function"); public final static Resource Functions = ResourceFactory.createResource(NS + "Functions"); @@ -85,6 +83,8 @@ public class SH { public final static Resource ValidationResult = ResourceFactory.createResource(NS + "ValidationResult"); + public final static Resource Violation = ResourceFactory.createResource(NS + "Violation"); + public final static Resource Warning = ResourceFactory.createResource(NS + "Warning");
2
Dropped Xor, renamed sh:Error to sh:Violation
2
.java
java
apache-2.0
TopQuadrant/shacl
396
<NME> square.test.ttl <BEF> # baseURI: http://datashapes.org/shasf/tests/rules/classification/square.test # imports: http://datashapes.org/dash # prefix: ex @prefix dash: <http://datashapes.org/dash#> . @prefix ex: <http://datashapes.org/shasf/tests/rules/classification/square.test#> . @prefix owl: <http://www.w3.org/2002/07/owl#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix sh: <http://www.w3.org/ns/shacl#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . <http://datashapes.org/shasf/tests/rules/classification/square.test> rdf:type owl:Ontology ; rdfs:label "Test of sh:classification using squares" ; owl:imports <http://datashapes.org/dash> ; . ex:InferencingTestCase rdf:type dash:InferencingTestCase ; dash:expectedResult [ rdf:object ex:Square ; rdf:predicate rdf:type ; rdf:subject ex:SquareRectangle ; ] ; . ex:InvalidRectangle rdf:type ex:Rectangle ; rdfs:label "Invalid rectangle" ; . ex:NonSquareRectangle rdf:type ex:Rectangle ; ex:height 2 ; ex:width 3 ; . ex:Rectangle rdf:type rdfs:Class ; rdf:type sh:NodeShape ; rdfs:label "Rectangle" ; rdfs:subClassOf rdfs:Resource ; sh:property [ sh:path ex:height ; sh:datatype xsd:integer ; sh:maxCount 1 ; sh:minCount 1 ; sh:name "height" ; ] ; sh:property [ sh:path ex:width ; sh:datatype xsd:integer ; sh:maxCount 1 ; sh:minCount 1 ; sh:name "width" ; ] ; sh:rule [ rdf:type sh:ClassificationRule ; sh:classification ex:Square ; sh:condition ex:Rectangle ; sh:condition [ sh:property [ sh:path ex:width ; sh:equals ex:height ; ] ; ] ; ] ; . ex:Square rdf:type rdfs:Class ; rdfs:label "Square" ; . ex:SquareRectangle rdf:type ex:Rectangle ; ex:height 4 ; ex:width 4 ; rdfs:label "Square rectangle" ; . <MSG> Tracking latest SHACL Advanced Features progress, removed shacljs.ttl dependency <DFF> @@ -1,18 +1,18 @@ -# baseURI: http://datashapes.org/shasf/tests/rules/classification/square.test +# baseURI: http://datashapes.org/shasf/tests/rules/triple/square.test # imports: http://datashapes.org/dash # prefix: ex @prefix dash: <http://datashapes.org/dash#> . -@prefix ex: <http://datashapes.org/shasf/tests/rules/classification/square.test#> . +@prefix ex: <http://datashapes.org/shasf/tests/rules/triple/square.test#> . @prefix owl: <http://www.w3.org/2002/07/owl#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix sh: <http://www.w3.org/ns/shacl#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . -<http://datashapes.org/shasf/tests/rules/classification/square.test> +<http://datashapes.org/shasf/tests/rules/triple/square.test> rdf:type owl:Ontology ; - rdfs:label "Test of sh:classification using squares" ; + rdfs:label "Test of classification using squares" ; owl:imports <http://datashapes.org/dash> ; . ex:InferencingTestCase @@ -52,8 +52,7 @@ ex:Rectangle sh:name "width" ; ] ; sh:rule [ - rdf:type sh:ClassificationRule ; - sh:classification ex:Square ; + rdf:type sh:TripleRule ; sh:condition ex:Rectangle ; sh:condition [ sh:property [ @@ -61,6 +60,9 @@ ex:Rectangle sh:equals ex:height ; ] ; ] ; + sh:object ex:Square ; + sh:predicate rdf:type ; + sh:subject sh:this ; ] ; . ex:Square
8
Tracking latest SHACL Advanced Features progress, removed shacljs.ttl dependency
6
.ttl
test
apache-2.0
TopQuadrant/shacl
397
<NME> square.test.ttl <BEF> # baseURI: http://datashapes.org/shasf/tests/rules/classification/square.test # imports: http://datashapes.org/dash # prefix: ex @prefix dash: <http://datashapes.org/dash#> . @prefix ex: <http://datashapes.org/shasf/tests/rules/classification/square.test#> . @prefix owl: <http://www.w3.org/2002/07/owl#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix sh: <http://www.w3.org/ns/shacl#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . <http://datashapes.org/shasf/tests/rules/classification/square.test> rdf:type owl:Ontology ; rdfs:label "Test of sh:classification using squares" ; owl:imports <http://datashapes.org/dash> ; . ex:InferencingTestCase rdf:type dash:InferencingTestCase ; dash:expectedResult [ rdf:object ex:Square ; rdf:predicate rdf:type ; rdf:subject ex:SquareRectangle ; ] ; . ex:InvalidRectangle rdf:type ex:Rectangle ; rdfs:label "Invalid rectangle" ; . ex:NonSquareRectangle rdf:type ex:Rectangle ; ex:height 2 ; ex:width 3 ; . ex:Rectangle rdf:type rdfs:Class ; rdf:type sh:NodeShape ; rdfs:label "Rectangle" ; rdfs:subClassOf rdfs:Resource ; sh:property [ sh:path ex:height ; sh:datatype xsd:integer ; sh:maxCount 1 ; sh:minCount 1 ; sh:name "height" ; ] ; sh:property [ sh:path ex:width ; sh:datatype xsd:integer ; sh:maxCount 1 ; sh:minCount 1 ; sh:name "width" ; ] ; sh:rule [ rdf:type sh:ClassificationRule ; sh:classification ex:Square ; sh:condition ex:Rectangle ; sh:condition [ sh:property [ sh:path ex:width ; sh:equals ex:height ; ] ; ] ; ] ; . ex:Square rdf:type rdfs:Class ; rdfs:label "Square" ; . ex:SquareRectangle rdf:type ex:Rectangle ; ex:height 4 ; ex:width 4 ; rdfs:label "Square rectangle" ; . <MSG> Tracking latest SHACL Advanced Features progress, removed shacljs.ttl dependency <DFF> @@ -1,18 +1,18 @@ -# baseURI: http://datashapes.org/shasf/tests/rules/classification/square.test +# baseURI: http://datashapes.org/shasf/tests/rules/triple/square.test # imports: http://datashapes.org/dash # prefix: ex @prefix dash: <http://datashapes.org/dash#> . -@prefix ex: <http://datashapes.org/shasf/tests/rules/classification/square.test#> . +@prefix ex: <http://datashapes.org/shasf/tests/rules/triple/square.test#> . @prefix owl: <http://www.w3.org/2002/07/owl#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix sh: <http://www.w3.org/ns/shacl#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . -<http://datashapes.org/shasf/tests/rules/classification/square.test> +<http://datashapes.org/shasf/tests/rules/triple/square.test> rdf:type owl:Ontology ; - rdfs:label "Test of sh:classification using squares" ; + rdfs:label "Test of classification using squares" ; owl:imports <http://datashapes.org/dash> ; . ex:InferencingTestCase @@ -52,8 +52,7 @@ ex:Rectangle sh:name "width" ; ] ; sh:rule [ - rdf:type sh:ClassificationRule ; - sh:classification ex:Square ; + rdf:type sh:TripleRule ; sh:condition ex:Rectangle ; sh:condition [ sh:property [ @@ -61,6 +60,9 @@ ex:Rectangle sh:equals ex:height ; ] ; ] ; + sh:object ex:Square ; + sh:predicate rdf:type ; + sh:subject sh:this ; ] ; . ex:Square
8
Tracking latest SHACL Advanced Features progress, removed shacljs.ttl dependency
6
.ttl
test
apache-2.0
TopQuadrant/shacl
398
<NME> SH.java <BEF> /* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * See the NOTICE file distributed with this work for additional * information regarding copyright ownership. */ package org.topbraid.shacl.vocabulary; import org.apache.jena.rdf.model.Property; import org.apache.jena.rdf.model.Resource; import org.apache.jena.rdf.model.ResourceFactory; import org.apache.jena.sparql.core.Var; /** * Vocabulary for http://www.w3.org/ns/shacl# * * @author Holger Knublauch */ public class SH { public final static String BASE_URI = "http://www.w3.org/ns/shacl#"; public final static String NAME = "SHACL"; public final static String NS = BASE_URI; public final static String PREFIX = "sh"; public final static Resource AbstractResult = ResourceFactory.createResource(NS + "AbstractResult"); public final static Resource AndConstraintComponent = ResourceFactory.createResource(NS + "AndConstraintComponent"); public final static Resource BlankNode = ResourceFactory.createResource(NS + "BlankNode"); public final static Resource Functions = ResourceFactory.createResource(NS + "Functions"); public final static Resource Graph = ResourceFactory.createResource(NS + "Graph"); public final static Resource Info = ResourceFactory.createResource(NS + "Info"); public final static Resource InversePropertyConstraint = ResourceFactory.createResource(NS + "InversePropertyConstraint"); public final static Resource ClosedConstraintComponent = ResourceFactory.createResource(NS + "ClosedConstraintComponent"); public final static Resource Constraint = ResourceFactory.createResource(NS + "Constraint"); public final static Resource ConstraintComponent = ResourceFactory.createResource(NS + "ConstraintComponent"); public final static Resource DatatypeConstraintComponent = ResourceFactory.createResource(NS + "DatatypeConstraintComponent"); public final static Resource DisjointConstraintComponent = ResourceFactory.createResource(NS + "DisjointConstraintComponent"); public final static Resource EqualsConstraintComponent = ResourceFactory.createResource(NS + "EqualsConstraintComponent"); public final static Resource HasValueConstraintComponent = ResourceFactory.createResource(NS + "HasValueConstraintComponent"); public final static Resource InConstraintComponent = ResourceFactory.createResource(NS + "InConstraintComponent"); public final static Resource Info = ResourceFactory.createResource(NS + "Info"); public final static Resource IRI = ResourceFactory.createResource(NS + "IRI"); public final static Resource IRIOrLiteral = ResourceFactory.createResource(NS + "IRIOrLiteral"); public final static Resource LanguageInConstraintComponent = ResourceFactory.createResource(NS + "LanguageInConstraintComponent"); public final static Resource LessThanConstraintComponent = ResourceFactory.createResource(NS + "LessThanConstraintComponent"); public final static Resource LessThanOrEqualsConstraintComponent = ResourceFactory.createResource(NS + "LessThanOrEqualsConstraintComponent"); public final static Resource Literal = ResourceFactory.createResource(NS + "Literal"); public final static Resource MaxCountConstraintComponent = ResourceFactory.createResource(NS + "MaxCountConstraintComponent"); public final static Resource MaxExclusiveConstraintComponent = ResourceFactory.createResource(NS + "MaxExclusiveConstraintComponent"); public final static Resource MaxInclusiveConstraintComponent = ResourceFactory.createResource(NS + "MaxInclusiveConstraintComponent"); public final static Resource MaxLengthConstraintComponent = ResourceFactory.createResource(NS + "MaxLengthConstraintComponent"); public final static Resource MinCountConstraintComponent = ResourceFactory.createResource(NS + "MinCountConstraintComponent"); public final static Resource MinExclusiveConstraintComponent = ResourceFactory.createResource(NS + "MinExclusiveConstraintComponent"); public final static Resource MinInclusiveConstraintComponent = ResourceFactory.createResource(NS + "MinInclusiveConstraintComponent"); public final static Resource MinLengthConstraintComponent = ResourceFactory.createResource(NS + "MinLengthConstraintComponent"); public final static Resource NodeConstraintComponent = ResourceFactory.createResource(NS + "NodeConstraintComponent"); public final static Resource NodeKindConstraintComponent = ResourceFactory.createResource(NS + "NodeKindConstraintComponent"); public final static Resource NodeShape = ResourceFactory.createResource(NS + "NodeShape"); public final static Property argument = ResourceFactory.createProperty(NS + "argument"); public final static Property cachable = ResourceFactory.createProperty(NS + "cachable"); public final static Property class_ = ResourceFactory.createProperty(NS + "class"); public final static Property constraint = ResourceFactory.createProperty(NS + "constraint"); public final static Resource Parameterizable = ResourceFactory.createResource(NS + "Parameterizable"); public final static Resource PatternConstraintComponent = ResourceFactory.createResource(NS + "PatternConstraintComponent"); public final static Resource PrefixDeclaration = ResourceFactory.createResource(NS + "PrefixDeclaration"); public final static Resource PropertyGroup = ResourceFactory.createResource(NS + "PropertyGroup"); public final static Resource PropertyShape = ResourceFactory.createResource(NS + "PropertyShape"); public final static Resource PropertyConstraintComponent = ResourceFactory.createResource(NS + "PropertyConstraintComponent"); public final static Resource QualifiedMaxCountConstraintComponent = ResourceFactory.createResource(NS + "QualifiedMaxCountConstraintComponent"); public final static Resource QualifiedMinCountConstraintComponent = ResourceFactory.createResource(NS + "QualifiedMinCountConstraintComponent"); public final static Resource ResultAnnotation = ResourceFactory.createResource(NS + "ResultAnnotation"); public final static Resource Shape = ResourceFactory.createResource(NS + "Shape"); public final static Resource SPARQLAskValidator = ResourceFactory.createResource(NS + "SPARQLAskValidator"); public final static Resource SPARQLConstraint = ResourceFactory.createResource(NS + "SPARQLConstraint"); public final static Resource SPARQLConstraintComponent = ResourceFactory.createResource(NS + "SPARQLConstraintComponent"); public final static Resource SPARQLConstructRule = ResourceFactory.createResource(NS + "SPARQLConstructRule"); public final static Resource SPARQLExecutable = ResourceFactory.createResource(NS + "SPARQLExecutable"); public final static Resource SPARQLFunction = ResourceFactory.createResource(NS + "SPARQLFunction"); public final static Resource SPARQLSelectValidator = ResourceFactory.createResource(NS + "SPARQLSelectValidator"); public final static Resource SPARQLTarget = ResourceFactory.createResource(NS + "SPARQLTarget"); public final static Resource SPARQLValuesDeriver = ResourceFactory.createResource(NS + "SPARQLValuesDeriver"); public final static Resource UniqueLangConstraintComponent = ResourceFactory.createResource(NS + "UniqueLangConstraintComponent"); public final static Resource ValidationReport = ResourceFactory.createResource(NS + "ValidationReport"); public final static Resource ValidationResult = ResourceFactory.createResource(NS + "ValidationResult"); public final static Resource Validator = ResourceFactory.createResource(NS + "Validator"); public final static Resource Violation = ResourceFactory.createResource(NS + "Violation"); public final static Resource Warning = ResourceFactory.createResource(NS + "Warning"); public final static Resource XoneConstraintComponent = ResourceFactory.createResource(NS + "XoneConstraintComponent"); public final static Property alternativePath = ResourceFactory.createProperty(NS + "alternativePath"); public final static Property and = ResourceFactory.createProperty(NS + "and"); public final static Property ask = ResourceFactory.createProperty(NS + "ask"); public final static Property class_ = ResourceFactory.createProperty(NS + "class"); public final static Property closed = ResourceFactory.createProperty(NS + "closed"); public final static Property optionalWhenInherited = ResourceFactory.createProperty(NS + "optionalWhenInherited"); public final static Property predicate = ResourceFactory.createProperty(NS + "predicate"); public final static Property private_ = ResourceFactory.createProperty(NS + "private"); public final static Property property = ResourceFactory.createProperty(NS + "property"); public final static Property datatype = ResourceFactory.createProperty(NS + "datatype"); public final static Property deactivated = ResourceFactory.createProperty(NS + "deactivated"); public final static Property declare = ResourceFactory.createProperty(NS + "declare"); public final static Property defaultValue = ResourceFactory.createProperty(NS + "defaultValue"); public final static Property detail = ResourceFactory.createProperty(NS + "detail"); public final static Property description = ResourceFactory.createProperty(NS + "description"); public final static Property disjoint = ResourceFactory.createProperty(NS + "disjoint"); public final static Property entailment = ResourceFactory.createProperty(NS + "entailment"); public final static Property equals = ResourceFactory.createProperty(NS + "equals"); public final static Property flags = ResourceFactory.createProperty(NS + "flags"); public final static Property focusNode = ResourceFactory.createProperty(NS + "focusNode"); public final static Property group = ResourceFactory.createProperty(NS + "group"); public final static Property hasValue = ResourceFactory.createProperty(NS + "hasValue"); public final static Property ignoredProperties = ResourceFactory.createProperty(NS + "ignoredProperties"); public final static Property in = ResourceFactory.createProperty(NS + "in"); public final static Property inversePath = ResourceFactory.createProperty(NS + "inversePath"); public final static Property labelTemplate = ResourceFactory.createProperty(NS + "labelTemplate"); public final static Property languageIn = ResourceFactory.createProperty(NS + "languageIn"); public final static Property lessThan = ResourceFactory.createProperty(NS + "lessThan"); public final static Property lessThanOrEquals = ResourceFactory.createProperty(NS + "lessThanOrEquals"); public final static Property maxCount = ResourceFactory.createProperty(NS + "maxCount"); public final static Property maxExclusive = ResourceFactory.createProperty(NS + "maxExclusive"); public final static Property maxInclusive = ResourceFactory.createProperty(NS + "maxInclusive"); public final static Property maxLength = ResourceFactory.createProperty(NS + "maxLength"); public final static Property message = ResourceFactory.createProperty(NS + "message"); public final static Property minCount = ResourceFactory.createProperty(NS + "minCount"); public final static Property minExclusive = ResourceFactory.createProperty(NS + "minExclusive"); public final static Property minInclusive = ResourceFactory.createProperty(NS + "minInclusive"); public final static Property minLength = ResourceFactory.createProperty(NS + "minLength"); public final static Property name = ResourceFactory.createProperty(NS + "name"); public final static Property namespace = ResourceFactory.createProperty(NS + "namespace"); public final static Property node = ResourceFactory.createProperty(NS + "node"); public final static Property nodeKind = ResourceFactory.createProperty(NS + "nodeKind"); public final static Property nodeValidator = ResourceFactory.createProperty(NS + "nodeValidator"); public final static Property not = ResourceFactory.createProperty(NS + "not"); public final static Property oneOrMorePath = ResourceFactory.createProperty(NS + "oneOrMorePath"); public final static Property optional = ResourceFactory.createProperty(NS + "optional"); public final static Property or = ResourceFactory.createProperty(NS + "or"); public final static Property order = ResourceFactory.createProperty(NS + "order"); public final static Property parameter = ResourceFactory.createProperty(NS + "parameter"); public final static Property path = ResourceFactory.createProperty(NS + "path"); public final static Property pattern = ResourceFactory.createProperty(NS + "pattern"); public final static Property prefix = ResourceFactory.createProperty(NS + "prefix"); public final static Property prefixes = ResourceFactory.createProperty(NS + "prefixes"); public final static Property property = ResourceFactory.createProperty(NS + "property"); public final static Property propertyValidator = ResourceFactory.createProperty(NS + "propertyValidator"); public final static Property qualifiedMaxCount = ResourceFactory.createProperty(NS + "qualifiedMaxCount"); public final static Property qualifiedMinCount = ResourceFactory.createProperty(NS + "qualifiedMinCount"); public final static Property qualifiedValueShape = ResourceFactory.createProperty(NS + "qualifiedValueShape"); public final static Property qualifiedValueShapesDisjoint = ResourceFactory.createProperty(NS + "qualifiedValueShapesDisjoint"); public final static Property result = ResourceFactory.createProperty(NS + "result"); public final static Property resultMessage = ResourceFactory.createProperty(NS + "resultMessage"); public final static Property resultPath = ResourceFactory.createProperty(NS + "resultPath"); public final static Property resultSeverity = ResourceFactory.createProperty(NS + "resultSeverity"); public final static Property select = ResourceFactory.createProperty(NS + "select"); public final static Property severity = ResourceFactory.createProperty(NS + "severity"); public final static Property shapesGraph = ResourceFactory.createProperty(NS + "shapesGraph"); public final static Property sourceConstraint = ResourceFactory.createProperty(NS + "sourceConstraint"); public final static Property sourceConstraintComponent = ResourceFactory.createProperty(NS + "sourceConstraintComponent"); public final static Property sourceShape = ResourceFactory.createProperty(NS + "sourceShape"); public final static Property sparql = ResourceFactory.createProperty(NS + "sparql"); public final static Property targetClass = ResourceFactory.createProperty(NS + "targetClass"); public final static Property targetNode = ResourceFactory.createProperty(NS + "targetNode"); public final static Property targetObjectsOf = ResourceFactory.createProperty(NS + "targetObjectsOf"); public final static Property targetSubjectsOf = ResourceFactory.createProperty(NS + "targetSubjectsOf"); public final static Property uniqueLang = ResourceFactory.createProperty(NS + "uniqueLang"); public final static Property update = ResourceFactory.createProperty(NS + "update"); public final static Property validator = ResourceFactory.createProperty(NS + "validator"); public final static Property value = ResourceFactory.createProperty(NS + "value"); public final static Property zeroOrMorePath = ResourceFactory.createProperty(NS + "zeroOrMorePath"); public final static Property zeroOrOnePath = ResourceFactory.createProperty(NS + "zeroOrOnePath"); // Advanced features public final static Resource ExpressionConstraintComponent = ResourceFactory.createResource(NS + "ExpressionConstraintComponent"); public final static Resource Function = ResourceFactory.createResource(NS + "Function"); public final static Resource JSConstraint = ResourceFactory.createResource(NS + "JSConstraint"); public final static Resource JSConstraintComponent = ResourceFactory.createResource(NS + "JSConstraintComponent"); public final static Resource JSExecutable = ResourceFactory.createResource(NS + "JSExecutable"); public final static Resource JSFunction = ResourceFactory.createResource(NS + "JSFunction"); public final static Resource JSLibrary = ResourceFactory.createResource(NS + "JSLibrary"); public final static Resource JSRule = ResourceFactory.createResource(NS + "JSRule"); public final static Resource JSTarget = ResourceFactory.createResource(NS + "JSTarget"); public final static Resource JSTargetType = ResourceFactory.createResource(NS + "JSTargetType"); public final static Resource JSValidator = ResourceFactory.createResource(NS + "JSValidator"); public final static Resource Rule = ResourceFactory.createResource(NS + "Rule"); public final static Resource Rules = ResourceFactory.createResource(NS + "Rules"); public final static Resource SPARQLRule = ResourceFactory.createResource(NS + "SPARQLRule"); public final static Resource Target = ResourceFactory.createResource(NS + "Target"); public final static Resource this_ = ResourceFactory.createResource(NS + "this"); public final static Resource TripleRule = ResourceFactory.createResource(NS + "TripleRule"); public final static Property expression = ResourceFactory.createProperty(NS + "expression"); public final static Property filterShape = ResourceFactory.createProperty(NS + "filterShape"); public final static Property intersection = ResourceFactory.createProperty(NS + "intersection"); public final static Property js = ResourceFactory.createProperty(NS + "js"); public final static Property jsFunctionName = ResourceFactory.createProperty(NS + "jsFunctionName"); public final static Property jsLibrary = ResourceFactory.createProperty(NS + "jsLibrary"); public final static Property jsLibraryURL = ResourceFactory.createProperty(NS + "jsLibraryURL"); public final static Property member = ResourceFactory.createProperty(NS + "member"); public final static Property nodes = ResourceFactory.createProperty(NS + "nodes"); public final static Property object = ResourceFactory.createProperty(NS + "object"); public final static Property predicate = ResourceFactory.createProperty(NS + "predicate"); public final static Property returnType = ResourceFactory.createProperty(NS + "returnType"); public final static Property rule = ResourceFactory.createProperty(NS + "rule"); public final static Property subject = ResourceFactory.createProperty(NS + "subject"); public final static Property target = ResourceFactory.createProperty(NS + "target"); public final static Property union = ResourceFactory.createProperty(NS + "union"); // Features not in SHACL 1.0 but candidates for next release public final static Property count = ResourceFactory.createProperty(NS + "count"); public final static Property desc = ResourceFactory.createProperty(NS + "desc"); public final static Property distinct = ResourceFactory.createProperty(NS + "distinct"); public final static Property else_ = ResourceFactory.createProperty(NS + "else"); public final static Property exists = ResourceFactory.createProperty(NS + "exists"); public final static Property groupConcat = ResourceFactory.createProperty(NS + "groupConcat"); public final static Property if_ = ResourceFactory.createProperty(NS + "if"); public final static Property limit = ResourceFactory.createProperty(NS + "limit"); public final static Property max = ResourceFactory.createProperty(NS + "max"); public final static Property min = ResourceFactory.createProperty(NS + "min"); public final static Property minus = ResourceFactory.createProperty(NS + "minus"); public final static Property offset = ResourceFactory.createProperty(NS + "offset"); public final static Property orderBy = ResourceFactory.createProperty(NS + "orderBy"); public final static Property separator = ResourceFactory.createProperty(NS + "separator"); public final static Property sum = ResourceFactory.createProperty(NS + "sum"); public final static Property then = ResourceFactory.createProperty(NS + "then"); public final static Property values = ResourceFactory.createProperty(NS + "values"); public static final Var currentShapeVar = Var.alloc("currentShape"); public static final Var failureVar = Var.alloc("failure"); public static final Var PATHVar = Var.alloc("PATH"); public static final Var pathVar = Var.alloc(path.getLocalName()); public static final Var shapesGraphVar = Var.alloc("shapesGraph"); public static final Var thisVar = Var.alloc("this"); public static final Var valueVar = Var.alloc("value"); public final static String JS_DATA_VAR = "$data"; public final static String JS_SHAPES_VAR = "$shapes"; public static String getURI() { return NS; } } <MSG> Updated SHACL system ontology <DFF> @@ -45,8 +45,6 @@ public class SH { public final static Resource Functions = ResourceFactory.createResource(NS + "Functions"); - public final static Resource Graph = ResourceFactory.createResource(NS + "Graph"); - public final static Resource Info = ResourceFactory.createResource(NS + "Info"); public final static Resource InversePropertyConstraint = ResourceFactory.createResource(NS + "InversePropertyConstraint"); @@ -106,8 +104,6 @@ public class SH { public final static Property argument = ResourceFactory.createProperty(NS + "argument"); - public final static Property cachable = ResourceFactory.createProperty(NS + "cachable"); - public final static Property class_ = ResourceFactory.createProperty(NS + "class"); public final static Property constraint = ResourceFactory.createProperty(NS + "constraint"); @@ -177,8 +173,6 @@ public class SH { public final static Property optionalWhenInherited = ResourceFactory.createProperty(NS + "optionalWhenInherited"); public final static Property predicate = ResourceFactory.createProperty(NS + "predicate"); - - public final static Property private_ = ResourceFactory.createProperty(NS + "private"); public final static Property property = ResourceFactory.createProperty(NS + "property");
0
Updated SHACL system ontology
6
.java
java
apache-2.0
TopQuadrant/shacl
399
<NME> SH.java <BEF> /* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * See the NOTICE file distributed with this work for additional * information regarding copyright ownership. */ package org.topbraid.shacl.vocabulary; import org.apache.jena.rdf.model.Property; import org.apache.jena.rdf.model.Resource; import org.apache.jena.rdf.model.ResourceFactory; import org.apache.jena.sparql.core.Var; /** * Vocabulary for http://www.w3.org/ns/shacl# * * @author Holger Knublauch */ public class SH { public final static String BASE_URI = "http://www.w3.org/ns/shacl#"; public final static String NAME = "SHACL"; public final static String NS = BASE_URI; public final static String PREFIX = "sh"; public final static Resource AbstractResult = ResourceFactory.createResource(NS + "AbstractResult"); public final static Resource AndConstraintComponent = ResourceFactory.createResource(NS + "AndConstraintComponent"); public final static Resource BlankNode = ResourceFactory.createResource(NS + "BlankNode"); public final static Resource Functions = ResourceFactory.createResource(NS + "Functions"); public final static Resource Graph = ResourceFactory.createResource(NS + "Graph"); public final static Resource Info = ResourceFactory.createResource(NS + "Info"); public final static Resource InversePropertyConstraint = ResourceFactory.createResource(NS + "InversePropertyConstraint"); public final static Resource ClosedConstraintComponent = ResourceFactory.createResource(NS + "ClosedConstraintComponent"); public final static Resource Constraint = ResourceFactory.createResource(NS + "Constraint"); public final static Resource ConstraintComponent = ResourceFactory.createResource(NS + "ConstraintComponent"); public final static Resource DatatypeConstraintComponent = ResourceFactory.createResource(NS + "DatatypeConstraintComponent"); public final static Resource DisjointConstraintComponent = ResourceFactory.createResource(NS + "DisjointConstraintComponent"); public final static Resource EqualsConstraintComponent = ResourceFactory.createResource(NS + "EqualsConstraintComponent"); public final static Resource HasValueConstraintComponent = ResourceFactory.createResource(NS + "HasValueConstraintComponent"); public final static Resource InConstraintComponent = ResourceFactory.createResource(NS + "InConstraintComponent"); public final static Resource Info = ResourceFactory.createResource(NS + "Info"); public final static Resource IRI = ResourceFactory.createResource(NS + "IRI"); public final static Resource IRIOrLiteral = ResourceFactory.createResource(NS + "IRIOrLiteral"); public final static Resource LanguageInConstraintComponent = ResourceFactory.createResource(NS + "LanguageInConstraintComponent"); public final static Resource LessThanConstraintComponent = ResourceFactory.createResource(NS + "LessThanConstraintComponent"); public final static Resource LessThanOrEqualsConstraintComponent = ResourceFactory.createResource(NS + "LessThanOrEqualsConstraintComponent"); public final static Resource Literal = ResourceFactory.createResource(NS + "Literal"); public final static Resource MaxCountConstraintComponent = ResourceFactory.createResource(NS + "MaxCountConstraintComponent"); public final static Resource MaxExclusiveConstraintComponent = ResourceFactory.createResource(NS + "MaxExclusiveConstraintComponent"); public final static Resource MaxInclusiveConstraintComponent = ResourceFactory.createResource(NS + "MaxInclusiveConstraintComponent"); public final static Resource MaxLengthConstraintComponent = ResourceFactory.createResource(NS + "MaxLengthConstraintComponent"); public final static Resource MinCountConstraintComponent = ResourceFactory.createResource(NS + "MinCountConstraintComponent"); public final static Resource MinExclusiveConstraintComponent = ResourceFactory.createResource(NS + "MinExclusiveConstraintComponent"); public final static Resource MinInclusiveConstraintComponent = ResourceFactory.createResource(NS + "MinInclusiveConstraintComponent"); public final static Resource MinLengthConstraintComponent = ResourceFactory.createResource(NS + "MinLengthConstraintComponent"); public final static Resource NodeConstraintComponent = ResourceFactory.createResource(NS + "NodeConstraintComponent"); public final static Resource NodeKindConstraintComponent = ResourceFactory.createResource(NS + "NodeKindConstraintComponent"); public final static Resource NodeShape = ResourceFactory.createResource(NS + "NodeShape"); public final static Property argument = ResourceFactory.createProperty(NS + "argument"); public final static Property cachable = ResourceFactory.createProperty(NS + "cachable"); public final static Property class_ = ResourceFactory.createProperty(NS + "class"); public final static Property constraint = ResourceFactory.createProperty(NS + "constraint"); public final static Resource Parameterizable = ResourceFactory.createResource(NS + "Parameterizable"); public final static Resource PatternConstraintComponent = ResourceFactory.createResource(NS + "PatternConstraintComponent"); public final static Resource PrefixDeclaration = ResourceFactory.createResource(NS + "PrefixDeclaration"); public final static Resource PropertyGroup = ResourceFactory.createResource(NS + "PropertyGroup"); public final static Resource PropertyShape = ResourceFactory.createResource(NS + "PropertyShape"); public final static Resource PropertyConstraintComponent = ResourceFactory.createResource(NS + "PropertyConstraintComponent"); public final static Resource QualifiedMaxCountConstraintComponent = ResourceFactory.createResource(NS + "QualifiedMaxCountConstraintComponent"); public final static Resource QualifiedMinCountConstraintComponent = ResourceFactory.createResource(NS + "QualifiedMinCountConstraintComponent"); public final static Resource ResultAnnotation = ResourceFactory.createResource(NS + "ResultAnnotation"); public final static Resource Shape = ResourceFactory.createResource(NS + "Shape"); public final static Resource SPARQLAskValidator = ResourceFactory.createResource(NS + "SPARQLAskValidator"); public final static Resource SPARQLConstraint = ResourceFactory.createResource(NS + "SPARQLConstraint"); public final static Resource SPARQLConstraintComponent = ResourceFactory.createResource(NS + "SPARQLConstraintComponent"); public final static Resource SPARQLConstructRule = ResourceFactory.createResource(NS + "SPARQLConstructRule"); public final static Resource SPARQLExecutable = ResourceFactory.createResource(NS + "SPARQLExecutable"); public final static Resource SPARQLFunction = ResourceFactory.createResource(NS + "SPARQLFunction"); public final static Resource SPARQLSelectValidator = ResourceFactory.createResource(NS + "SPARQLSelectValidator"); public final static Resource SPARQLTarget = ResourceFactory.createResource(NS + "SPARQLTarget"); public final static Resource SPARQLValuesDeriver = ResourceFactory.createResource(NS + "SPARQLValuesDeriver"); public final static Resource UniqueLangConstraintComponent = ResourceFactory.createResource(NS + "UniqueLangConstraintComponent"); public final static Resource ValidationReport = ResourceFactory.createResource(NS + "ValidationReport"); public final static Resource ValidationResult = ResourceFactory.createResource(NS + "ValidationResult"); public final static Resource Validator = ResourceFactory.createResource(NS + "Validator"); public final static Resource Violation = ResourceFactory.createResource(NS + "Violation"); public final static Resource Warning = ResourceFactory.createResource(NS + "Warning"); public final static Resource XoneConstraintComponent = ResourceFactory.createResource(NS + "XoneConstraintComponent"); public final static Property alternativePath = ResourceFactory.createProperty(NS + "alternativePath"); public final static Property and = ResourceFactory.createProperty(NS + "and"); public final static Property ask = ResourceFactory.createProperty(NS + "ask"); public final static Property class_ = ResourceFactory.createProperty(NS + "class"); public final static Property closed = ResourceFactory.createProperty(NS + "closed"); public final static Property optionalWhenInherited = ResourceFactory.createProperty(NS + "optionalWhenInherited"); public final static Property predicate = ResourceFactory.createProperty(NS + "predicate"); public final static Property private_ = ResourceFactory.createProperty(NS + "private"); public final static Property property = ResourceFactory.createProperty(NS + "property"); public final static Property datatype = ResourceFactory.createProperty(NS + "datatype"); public final static Property deactivated = ResourceFactory.createProperty(NS + "deactivated"); public final static Property declare = ResourceFactory.createProperty(NS + "declare"); public final static Property defaultValue = ResourceFactory.createProperty(NS + "defaultValue"); public final static Property detail = ResourceFactory.createProperty(NS + "detail"); public final static Property description = ResourceFactory.createProperty(NS + "description"); public final static Property disjoint = ResourceFactory.createProperty(NS + "disjoint"); public final static Property entailment = ResourceFactory.createProperty(NS + "entailment"); public final static Property equals = ResourceFactory.createProperty(NS + "equals"); public final static Property flags = ResourceFactory.createProperty(NS + "flags"); public final static Property focusNode = ResourceFactory.createProperty(NS + "focusNode"); public final static Property group = ResourceFactory.createProperty(NS + "group"); public final static Property hasValue = ResourceFactory.createProperty(NS + "hasValue"); public final static Property ignoredProperties = ResourceFactory.createProperty(NS + "ignoredProperties"); public final static Property in = ResourceFactory.createProperty(NS + "in"); public final static Property inversePath = ResourceFactory.createProperty(NS + "inversePath"); public final static Property labelTemplate = ResourceFactory.createProperty(NS + "labelTemplate"); public final static Property languageIn = ResourceFactory.createProperty(NS + "languageIn"); public final static Property lessThan = ResourceFactory.createProperty(NS + "lessThan"); public final static Property lessThanOrEquals = ResourceFactory.createProperty(NS + "lessThanOrEquals"); public final static Property maxCount = ResourceFactory.createProperty(NS + "maxCount"); public final static Property maxExclusive = ResourceFactory.createProperty(NS + "maxExclusive"); public final static Property maxInclusive = ResourceFactory.createProperty(NS + "maxInclusive"); public final static Property maxLength = ResourceFactory.createProperty(NS + "maxLength"); public final static Property message = ResourceFactory.createProperty(NS + "message"); public final static Property minCount = ResourceFactory.createProperty(NS + "minCount"); public final static Property minExclusive = ResourceFactory.createProperty(NS + "minExclusive"); public final static Property minInclusive = ResourceFactory.createProperty(NS + "minInclusive"); public final static Property minLength = ResourceFactory.createProperty(NS + "minLength"); public final static Property name = ResourceFactory.createProperty(NS + "name"); public final static Property namespace = ResourceFactory.createProperty(NS + "namespace"); public final static Property node = ResourceFactory.createProperty(NS + "node"); public final static Property nodeKind = ResourceFactory.createProperty(NS + "nodeKind"); public final static Property nodeValidator = ResourceFactory.createProperty(NS + "nodeValidator"); public final static Property not = ResourceFactory.createProperty(NS + "not"); public final static Property oneOrMorePath = ResourceFactory.createProperty(NS + "oneOrMorePath"); public final static Property optional = ResourceFactory.createProperty(NS + "optional"); public final static Property or = ResourceFactory.createProperty(NS + "or"); public final static Property order = ResourceFactory.createProperty(NS + "order"); public final static Property parameter = ResourceFactory.createProperty(NS + "parameter"); public final static Property path = ResourceFactory.createProperty(NS + "path"); public final static Property pattern = ResourceFactory.createProperty(NS + "pattern"); public final static Property prefix = ResourceFactory.createProperty(NS + "prefix"); public final static Property prefixes = ResourceFactory.createProperty(NS + "prefixes"); public final static Property property = ResourceFactory.createProperty(NS + "property"); public final static Property propertyValidator = ResourceFactory.createProperty(NS + "propertyValidator"); public final static Property qualifiedMaxCount = ResourceFactory.createProperty(NS + "qualifiedMaxCount"); public final static Property qualifiedMinCount = ResourceFactory.createProperty(NS + "qualifiedMinCount"); public final static Property qualifiedValueShape = ResourceFactory.createProperty(NS + "qualifiedValueShape"); public final static Property qualifiedValueShapesDisjoint = ResourceFactory.createProperty(NS + "qualifiedValueShapesDisjoint"); public final static Property result = ResourceFactory.createProperty(NS + "result"); public final static Property resultMessage = ResourceFactory.createProperty(NS + "resultMessage"); public final static Property resultPath = ResourceFactory.createProperty(NS + "resultPath"); public final static Property resultSeverity = ResourceFactory.createProperty(NS + "resultSeverity"); public final static Property select = ResourceFactory.createProperty(NS + "select"); public final static Property severity = ResourceFactory.createProperty(NS + "severity"); public final static Property shapesGraph = ResourceFactory.createProperty(NS + "shapesGraph"); public final static Property sourceConstraint = ResourceFactory.createProperty(NS + "sourceConstraint"); public final static Property sourceConstraintComponent = ResourceFactory.createProperty(NS + "sourceConstraintComponent"); public final static Property sourceShape = ResourceFactory.createProperty(NS + "sourceShape"); public final static Property sparql = ResourceFactory.createProperty(NS + "sparql"); public final static Property targetClass = ResourceFactory.createProperty(NS + "targetClass"); public final static Property targetNode = ResourceFactory.createProperty(NS + "targetNode"); public final static Property targetObjectsOf = ResourceFactory.createProperty(NS + "targetObjectsOf"); public final static Property targetSubjectsOf = ResourceFactory.createProperty(NS + "targetSubjectsOf"); public final static Property uniqueLang = ResourceFactory.createProperty(NS + "uniqueLang"); public final static Property update = ResourceFactory.createProperty(NS + "update"); public final static Property validator = ResourceFactory.createProperty(NS + "validator"); public final static Property value = ResourceFactory.createProperty(NS + "value"); public final static Property zeroOrMorePath = ResourceFactory.createProperty(NS + "zeroOrMorePath"); public final static Property zeroOrOnePath = ResourceFactory.createProperty(NS + "zeroOrOnePath"); // Advanced features public final static Resource ExpressionConstraintComponent = ResourceFactory.createResource(NS + "ExpressionConstraintComponent"); public final static Resource Function = ResourceFactory.createResource(NS + "Function"); public final static Resource JSConstraint = ResourceFactory.createResource(NS + "JSConstraint"); public final static Resource JSConstraintComponent = ResourceFactory.createResource(NS + "JSConstraintComponent"); public final static Resource JSExecutable = ResourceFactory.createResource(NS + "JSExecutable"); public final static Resource JSFunction = ResourceFactory.createResource(NS + "JSFunction"); public final static Resource JSLibrary = ResourceFactory.createResource(NS + "JSLibrary"); public final static Resource JSRule = ResourceFactory.createResource(NS + "JSRule"); public final static Resource JSTarget = ResourceFactory.createResource(NS + "JSTarget"); public final static Resource JSTargetType = ResourceFactory.createResource(NS + "JSTargetType"); public final static Resource JSValidator = ResourceFactory.createResource(NS + "JSValidator"); public final static Resource Rule = ResourceFactory.createResource(NS + "Rule"); public final static Resource Rules = ResourceFactory.createResource(NS + "Rules"); public final static Resource SPARQLRule = ResourceFactory.createResource(NS + "SPARQLRule"); public final static Resource Target = ResourceFactory.createResource(NS + "Target"); public final static Resource this_ = ResourceFactory.createResource(NS + "this"); public final static Resource TripleRule = ResourceFactory.createResource(NS + "TripleRule"); public final static Property expression = ResourceFactory.createProperty(NS + "expression"); public final static Property filterShape = ResourceFactory.createProperty(NS + "filterShape"); public final static Property intersection = ResourceFactory.createProperty(NS + "intersection"); public final static Property js = ResourceFactory.createProperty(NS + "js"); public final static Property jsFunctionName = ResourceFactory.createProperty(NS + "jsFunctionName"); public final static Property jsLibrary = ResourceFactory.createProperty(NS + "jsLibrary"); public final static Property jsLibraryURL = ResourceFactory.createProperty(NS + "jsLibraryURL"); public final static Property member = ResourceFactory.createProperty(NS + "member"); public final static Property nodes = ResourceFactory.createProperty(NS + "nodes"); public final static Property object = ResourceFactory.createProperty(NS + "object"); public final static Property predicate = ResourceFactory.createProperty(NS + "predicate"); public final static Property returnType = ResourceFactory.createProperty(NS + "returnType"); public final static Property rule = ResourceFactory.createProperty(NS + "rule"); public final static Property subject = ResourceFactory.createProperty(NS + "subject"); public final static Property target = ResourceFactory.createProperty(NS + "target"); public final static Property union = ResourceFactory.createProperty(NS + "union"); // Features not in SHACL 1.0 but candidates for next release public final static Property count = ResourceFactory.createProperty(NS + "count"); public final static Property desc = ResourceFactory.createProperty(NS + "desc"); public final static Property distinct = ResourceFactory.createProperty(NS + "distinct"); public final static Property else_ = ResourceFactory.createProperty(NS + "else"); public final static Property exists = ResourceFactory.createProperty(NS + "exists"); public final static Property groupConcat = ResourceFactory.createProperty(NS + "groupConcat"); public final static Property if_ = ResourceFactory.createProperty(NS + "if"); public final static Property limit = ResourceFactory.createProperty(NS + "limit"); public final static Property max = ResourceFactory.createProperty(NS + "max"); public final static Property min = ResourceFactory.createProperty(NS + "min"); public final static Property minus = ResourceFactory.createProperty(NS + "minus"); public final static Property offset = ResourceFactory.createProperty(NS + "offset"); public final static Property orderBy = ResourceFactory.createProperty(NS + "orderBy"); public final static Property separator = ResourceFactory.createProperty(NS + "separator"); public final static Property sum = ResourceFactory.createProperty(NS + "sum"); public final static Property then = ResourceFactory.createProperty(NS + "then"); public final static Property values = ResourceFactory.createProperty(NS + "values"); public static final Var currentShapeVar = Var.alloc("currentShape"); public static final Var failureVar = Var.alloc("failure"); public static final Var PATHVar = Var.alloc("PATH"); public static final Var pathVar = Var.alloc(path.getLocalName()); public static final Var shapesGraphVar = Var.alloc("shapesGraph"); public static final Var thisVar = Var.alloc("this"); public static final Var valueVar = Var.alloc("value"); public final static String JS_DATA_VAR = "$data"; public final static String JS_SHAPES_VAR = "$shapes"; public static String getURI() { return NS; } } <MSG> Updated SHACL system ontology <DFF> @@ -45,8 +45,6 @@ public class SH { public final static Resource Functions = ResourceFactory.createResource(NS + "Functions"); - public final static Resource Graph = ResourceFactory.createResource(NS + "Graph"); - public final static Resource Info = ResourceFactory.createResource(NS + "Info"); public final static Resource InversePropertyConstraint = ResourceFactory.createResource(NS + "InversePropertyConstraint"); @@ -106,8 +104,6 @@ public class SH { public final static Property argument = ResourceFactory.createProperty(NS + "argument"); - public final static Property cachable = ResourceFactory.createProperty(NS + "cachable"); - public final static Property class_ = ResourceFactory.createProperty(NS + "class"); public final static Property constraint = ResourceFactory.createProperty(NS + "constraint"); @@ -177,8 +173,6 @@ public class SH { public final static Property optionalWhenInherited = ResourceFactory.createProperty(NS + "optionalWhenInherited"); public final static Property predicate = ResourceFactory.createProperty(NS + "predicate"); - - public final static Property private_ = ResourceFactory.createProperty(NS + "private"); public final static Property property = ResourceFactory.createProperty(NS + "property");
0
Updated SHACL system ontology
6
.java
java
apache-2.0
TopQuadrant/shacl