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
100
<NME> HasShapeFunction.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.functions; import java.net.URI; import java.util.Collections; import org.apache.jena.graph.Graph; import org.apache.jena.graph.Node; import org.apache.jena.query.Dataset; import org.apache.jena.query.DatasetFactory; import org.apache.jena.rdf.model.Model; import org.apache.jena.rdf.model.ModelFactory; import org.apache.jena.rdf.model.RDFNode; import org.apache.jena.rdf.model.Resource; import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.function.FunctionEnv; import org.apache.jena.vocabulary.RDF; import org.topbraid.jenax.functions.AbstractFunction3; import org.topbraid.jenax.util.ARQFactory; import org.topbraid.jenax.util.JenaDatatypes; import org.topbraid.jenax.util.JenaUtil; import org.topbraid.shacl.engine.ShapesGraph; import org.topbraid.shacl.engine.ShapesGraphFactory; import org.topbraid.shacl.util.FailureLog; import org.topbraid.shacl.util.RecursionGuard; import org.topbraid.shacl.validation.DefaultShapesGraphProvider; import org.topbraid.shacl.validation.ValidationEngine; import org.topbraid.shacl.validation.ValidationEngineConfiguration; import org.topbraid.shacl.validation.ValidationEngineFactory; import org.topbraid.shacl.vocabulary.DASH; import org.topbraid.shacl.vocabulary.SH; /** * The implementation of the tosh:hasShape function. * * @author Holger Knublauch Resource resource = (Resource) model.asRDFNode(resourceNode); Dataset dataset = DatasetImpl.wrap(env.getDataset()); Resource shape = (Resource) dataset.getDefaultModel().asRDFNode(shapeNode); Model results = ResourceConstraintValidator.get().validateNodeAgainstShape( dataset, URI.create(shapesGraphNode.getURI()), resource.asNode(), shape.asNode(), SH.Error, null); if(results.contains(null, RDF.type, SH.FatalError)) { throw new ExprEvalException("Propagating fatal error from nested shapes"); } private static ThreadLocal<ShapesGraph> shapesGraph = new ThreadLocal<>(); private static ThreadLocal<URI> shapesGraphURI = new ThreadLocal<URI>(); public static Model getResultsModel() { return resultsModelTL.get(); } recursionIsErrorFlag.set(oldFlag); } } } public static void setShapesGraph(ShapesGraph value, URI uri) { if(value == null && uri != null) { Model shapesModel = ARQFactory.getNamedModel(uri.toString()); value = new ShapesGraph(shapesModel); } shapesGraph.set(value); shapesGraphURI.set(uri); } @Override protected NodeValue exec(Node focusNode, Node shapeNode, Node recursionIsError, FunctionEnv env) { return exec(focusNode, shapeNode, recursionIsError, env.getActiveGraph(), DatasetFactory.wrap(env.getDataset())); } public static NodeValue exec(Node focusNode, Node shapeNode, Node recursionIsError, Graph activeGraph, Dataset dataset) { Boolean oldFlag = recursionIsErrorFlag.get(); if(JenaDatatypes.TRUE.asNode().equals(recursionIsError)) { recursionIsErrorFlag.set(true); } try { if(RecursionGuard.start(focusNode, shapeNode)) { RecursionGuard.end(focusNode, shapeNode); if(JenaDatatypes.TRUE.asNode().equals(recursionIsError) || (oldFlag != null && oldFlag)) { String message = "Unsupported recursion"; Model resultsModel = resultsModelTL.get(); Resource failure = resultsModel.createResource(DASH.FailureResult); failure.addProperty(SH.resultMessage, message); failure.addProperty(SH.focusNode, resultsModel.asRDFNode(focusNode)); failure.addProperty(SH.sourceShape, resultsModel.asRDFNode(shapeNode)); FailureLog.get().logFailure(message); throw new ExprEvalException("Unsupported recursion"); } else { return NodeValue.TRUE; } } else { try { Model model = ModelFactory.createModelForGraph(activeGraph); RDFNode resource = model.asRDFNode(focusNode); Resource shape = (Resource) dataset.getDefaultModel().asRDFNode(shapeNode); Model results = doRun(resource, shape, dataset); if(resultsModelTL.get() != null) { resultsModelTL.get().add(results); } if(results.contains(null, RDF.type, DASH.FailureResult)) { throw new ExprEvalException("Propagating failure from nested shapes"); } if(ValidationEngine.getCurrent() != null && ValidationEngine.getCurrent().getConfiguration().getReportDetails()) { boolean result = true; for(Resource r : results.listSubjectsWithProperty(RDF.type, SH.ValidationResult).toList()) { if(!results.contains(null, SH.detail, r)) { result = false; break; } } return NodeValue.makeBoolean(result); } else { boolean result = !results.contains(null, RDF.type, SH.ValidationResult); return NodeValue.makeBoolean(result); } } finally { RecursionGuard.end(focusNode, shapeNode); } } } finally { recursionIsErrorFlag.set(oldFlag); } } private static Model doRun(RDFNode focusNode, Resource shape, Dataset dataset) { URI sgURI = shapesGraphURI.get(); ShapesGraph sg = shapesGraph.get(); if(sgURI == null) { sgURI = DefaultShapesGraphProvider.get().getDefaultShapesGraphURI(dataset); Model shapesModel = dataset.getNamedModel(sgURI.toString()); sg = ShapesGraphFactory.get().createShapesGraph(shapesModel); } else if(sg == null) { Model shapesModel = dataset.getNamedModel(sgURI.toString()); sg = ShapesGraphFactory.get().createShapesGraph(shapesModel); shapesGraph.set(sg); } Model reportModel = JenaUtil.createMemoryModel(); Resource report = reportModel.createResource(SH.ValidationReport); // This avoids the expensive setNsPrefixes call in ValidationEngine constructor ValidationEngine engine = ValidationEngineFactory.get().create(dataset, sgURI, sg, report); if(ValidationEngine.getCurrent() != null) { ValidationEngineConfiguration cloned = ValidationEngine.getCurrent().getConfiguration().clone(); cloned.setValidationErrorBatch(-1); engine.setConfiguration(cloned); } engine.validateNodesAgainstShape(Collections.singletonList(focusNode), shape.asNode()); return reportModel; } } <MSG> Updated test cases, generalized sh:hasShape function for easier overloading <DFF> @@ -53,8 +53,7 @@ public class HasShapeFunction extends AbstractFunction4 { Resource resource = (Resource) model.asRDFNode(resourceNode); Dataset dataset = DatasetImpl.wrap(env.getDataset()); Resource shape = (Resource) dataset.getDefaultModel().asRDFNode(shapeNode); - Model results = ResourceConstraintValidator.get().validateNodeAgainstShape( - dataset, URI.create(shapesGraphNode.getURI()), resource.asNode(), shape.asNode(), SH.Error, null); + Model results = doRun(resource, shape, dataset, shapesGraphNode); if(results.contains(null, RDF.type, SH.FatalError)) { throw new ExprEvalException("Propagating fatal error from nested shapes"); } @@ -69,4 +68,11 @@ public class HasShapeFunction extends AbstractFunction4 { recursionIsErrorFlag.set(oldFlag); } } + + + protected Model doRun(Resource resource, Resource shape, Dataset dataset, + Node shapesGraphNode) { + return ResourceConstraintValidator.get().validateNodeAgainstShape( + dataset, URI.create(shapesGraphNode.getURI()), resource.asNode(), shape.asNode(), SH.Error, null); + } }
8
Updated test cases, generalized sh:hasShape function for easier overloading
2
.java
java
apache-2.0
TopQuadrant/shacl
101
<NME> HasShapeFunction.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.functions; import java.net.URI; import java.util.Collections; import org.apache.jena.graph.Graph; import org.apache.jena.graph.Node; import org.apache.jena.query.Dataset; import org.apache.jena.query.DatasetFactory; import org.apache.jena.rdf.model.Model; import org.apache.jena.rdf.model.ModelFactory; import org.apache.jena.rdf.model.RDFNode; import org.apache.jena.rdf.model.Resource; import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.function.FunctionEnv; import org.apache.jena.vocabulary.RDF; import org.topbraid.jenax.functions.AbstractFunction3; import org.topbraid.jenax.util.ARQFactory; import org.topbraid.jenax.util.JenaDatatypes; import org.topbraid.jenax.util.JenaUtil; import org.topbraid.shacl.engine.ShapesGraph; import org.topbraid.shacl.engine.ShapesGraphFactory; import org.topbraid.shacl.util.FailureLog; import org.topbraid.shacl.util.RecursionGuard; import org.topbraid.shacl.validation.DefaultShapesGraphProvider; import org.topbraid.shacl.validation.ValidationEngine; import org.topbraid.shacl.validation.ValidationEngineConfiguration; import org.topbraid.shacl.validation.ValidationEngineFactory; import org.topbraid.shacl.vocabulary.DASH; import org.topbraid.shacl.vocabulary.SH; /** * The implementation of the tosh:hasShape function. * * @author Holger Knublauch Resource resource = (Resource) model.asRDFNode(resourceNode); Dataset dataset = DatasetImpl.wrap(env.getDataset()); Resource shape = (Resource) dataset.getDefaultModel().asRDFNode(shapeNode); Model results = ResourceConstraintValidator.get().validateNodeAgainstShape( dataset, URI.create(shapesGraphNode.getURI()), resource.asNode(), shape.asNode(), SH.Error, null); if(results.contains(null, RDF.type, SH.FatalError)) { throw new ExprEvalException("Propagating fatal error from nested shapes"); } private static ThreadLocal<ShapesGraph> shapesGraph = new ThreadLocal<>(); private static ThreadLocal<URI> shapesGraphURI = new ThreadLocal<URI>(); public static Model getResultsModel() { return resultsModelTL.get(); } recursionIsErrorFlag.set(oldFlag); } } } public static void setShapesGraph(ShapesGraph value, URI uri) { if(value == null && uri != null) { Model shapesModel = ARQFactory.getNamedModel(uri.toString()); value = new ShapesGraph(shapesModel); } shapesGraph.set(value); shapesGraphURI.set(uri); } @Override protected NodeValue exec(Node focusNode, Node shapeNode, Node recursionIsError, FunctionEnv env) { return exec(focusNode, shapeNode, recursionIsError, env.getActiveGraph(), DatasetFactory.wrap(env.getDataset())); } public static NodeValue exec(Node focusNode, Node shapeNode, Node recursionIsError, Graph activeGraph, Dataset dataset) { Boolean oldFlag = recursionIsErrorFlag.get(); if(JenaDatatypes.TRUE.asNode().equals(recursionIsError)) { recursionIsErrorFlag.set(true); } try { if(RecursionGuard.start(focusNode, shapeNode)) { RecursionGuard.end(focusNode, shapeNode); if(JenaDatatypes.TRUE.asNode().equals(recursionIsError) || (oldFlag != null && oldFlag)) { String message = "Unsupported recursion"; Model resultsModel = resultsModelTL.get(); Resource failure = resultsModel.createResource(DASH.FailureResult); failure.addProperty(SH.resultMessage, message); failure.addProperty(SH.focusNode, resultsModel.asRDFNode(focusNode)); failure.addProperty(SH.sourceShape, resultsModel.asRDFNode(shapeNode)); FailureLog.get().logFailure(message); throw new ExprEvalException("Unsupported recursion"); } else { return NodeValue.TRUE; } } else { try { Model model = ModelFactory.createModelForGraph(activeGraph); RDFNode resource = model.asRDFNode(focusNode); Resource shape = (Resource) dataset.getDefaultModel().asRDFNode(shapeNode); Model results = doRun(resource, shape, dataset); if(resultsModelTL.get() != null) { resultsModelTL.get().add(results); } if(results.contains(null, RDF.type, DASH.FailureResult)) { throw new ExprEvalException("Propagating failure from nested shapes"); } if(ValidationEngine.getCurrent() != null && ValidationEngine.getCurrent().getConfiguration().getReportDetails()) { boolean result = true; for(Resource r : results.listSubjectsWithProperty(RDF.type, SH.ValidationResult).toList()) { if(!results.contains(null, SH.detail, r)) { result = false; break; } } return NodeValue.makeBoolean(result); } else { boolean result = !results.contains(null, RDF.type, SH.ValidationResult); return NodeValue.makeBoolean(result); } } finally { RecursionGuard.end(focusNode, shapeNode); } } } finally { recursionIsErrorFlag.set(oldFlag); } } private static Model doRun(RDFNode focusNode, Resource shape, Dataset dataset) { URI sgURI = shapesGraphURI.get(); ShapesGraph sg = shapesGraph.get(); if(sgURI == null) { sgURI = DefaultShapesGraphProvider.get().getDefaultShapesGraphURI(dataset); Model shapesModel = dataset.getNamedModel(sgURI.toString()); sg = ShapesGraphFactory.get().createShapesGraph(shapesModel); } else if(sg == null) { Model shapesModel = dataset.getNamedModel(sgURI.toString()); sg = ShapesGraphFactory.get().createShapesGraph(shapesModel); shapesGraph.set(sg); } Model reportModel = JenaUtil.createMemoryModel(); Resource report = reportModel.createResource(SH.ValidationReport); // This avoids the expensive setNsPrefixes call in ValidationEngine constructor ValidationEngine engine = ValidationEngineFactory.get().create(dataset, sgURI, sg, report); if(ValidationEngine.getCurrent() != null) { ValidationEngineConfiguration cloned = ValidationEngine.getCurrent().getConfiguration().clone(); cloned.setValidationErrorBatch(-1); engine.setConfiguration(cloned); } engine.validateNodesAgainstShape(Collections.singletonList(focusNode), shape.asNode()); return reportModel; } } <MSG> Updated test cases, generalized sh:hasShape function for easier overloading <DFF> @@ -53,8 +53,7 @@ public class HasShapeFunction extends AbstractFunction4 { Resource resource = (Resource) model.asRDFNode(resourceNode); Dataset dataset = DatasetImpl.wrap(env.getDataset()); Resource shape = (Resource) dataset.getDefaultModel().asRDFNode(shapeNode); - Model results = ResourceConstraintValidator.get().validateNodeAgainstShape( - dataset, URI.create(shapesGraphNode.getURI()), resource.asNode(), shape.asNode(), SH.Error, null); + Model results = doRun(resource, shape, dataset, shapesGraphNode); if(results.contains(null, RDF.type, SH.FatalError)) { throw new ExprEvalException("Propagating fatal error from nested shapes"); } @@ -69,4 +68,11 @@ public class HasShapeFunction extends AbstractFunction4 { recursionIsErrorFlag.set(oldFlag); } } + + + protected Model doRun(Resource resource, Resource shape, Dataset dataset, + Node shapesGraphNode) { + return ResourceConstraintValidator.get().validateNodeAgainstShape( + dataset, URI.create(shapesGraphNode.getURI()), resource.asNode(), shape.asNode(), SH.Error, null); + } }
8
Updated test cases, generalized sh:hasShape function for easier overloading
2
.java
java
apache-2.0
TopQuadrant/shacl
102
<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> Bumped up version, switched to new dash and tosh files (note this may introduce additional constraint violations because tosh now has many more system vocabulary checks built in), fixed issue with ValidationEngineConfiguration interfering with nested hasShape calls <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
Bumped up version, switched to new dash and tosh files (note this may introduce additional constraint violations because tosh now has many more system vocabulary checks built in), fixed issue with ValidationEngineConfiguration interfering with nested hasShape calls
3
.java
java
apache-2.0
TopQuadrant/shacl
103
<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> Bumped up version, switched to new dash and tosh files (note this may introduce additional constraint violations because tosh now has many more system vocabulary checks built in), fixed issue with ValidationEngineConfiguration interfering with nested hasShape calls <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
Bumped up version, switched to new dash and tosh files (note this may introduce additional constraint violations because tosh now has many more system vocabulary checks built in), fixed issue with ValidationEngineConfiguration interfering with nested hasShape calls
3
.java
java
apache-2.0
TopQuadrant/shacl
104
<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 import java.util.List; import java.util.Set; import org.topbraid.shacl.model.SHACLArgument; import org.topbraid.shacl.model.SHACLConstraintViolation; import org.topbraid.shacl.model.SHACLFactory; import org.topbraid.shacl.model.SHACLPropertyConstraint; import org.topbraid.shacl.vocabulary.SH; import org.topbraid.spin.arq.ARQFactory; import org.topbraid.spin.util.JenaUtil; import com.hp.hpl.jena.graph.Graph; import com.hp.hpl.jena.graph.Triple; import com.hp.hpl.jena.graph.compose.MultiUnion; import com.hp.hpl.jena.query.Query; import com.hp.hpl.jena.query.QueryExecution; import com.hp.hpl.jena.query.QuerySolutionMap; 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)); } } } } /** /** * 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) { 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> GitHub ISSUE-2: Engine now supports other execution languages than SPARQL for sh:scope <DFF> @@ -7,17 +7,22 @@ import java.util.LinkedList; import java.util.List; import java.util.Set; +import org.topbraid.shacl.constraints.ExecutionLanguage; +import org.topbraid.shacl.constraints.ExecutionLanguageSelector; import org.topbraid.shacl.model.SHACLArgument; import org.topbraid.shacl.model.SHACLConstraintViolation; import org.topbraid.shacl.model.SHACLFactory; import org.topbraid.shacl.model.SHACLPropertyConstraint; +import org.topbraid.shacl.model.SHACLTemplateCall; import org.topbraid.shacl.vocabulary.SH; import org.topbraid.spin.arq.ARQFactory; import org.topbraid.spin.util.JenaUtil; import com.hp.hpl.jena.graph.Graph; +import com.hp.hpl.jena.graph.Node; import com.hp.hpl.jena.graph.Triple; import com.hp.hpl.jena.graph.compose.MultiUnion; +import com.hp.hpl.jena.query.Dataset; import com.hp.hpl.jena.query.Query; import com.hp.hpl.jena.query.QueryExecution; import com.hp.hpl.jena.query.QuerySolutionMap; @@ -107,6 +112,30 @@ public class SHACLUtil { } } } + + + /** + * Adds all resources from a given sh:scope to a given results Set of Nodes. + * @param scope the value of sh:scope (template call or native scope) + * @param dataset the dataset to operate on + * @param results the Set to add the resulting Nodes to + */ + public static void addNodesInScope(Resource scope, Dataset dataset, Set<Node> results) { + Resource type = JenaUtil.getType(scope); + Resource executable; + SHACLTemplateCall templateCall = null; + if(type == null || SH.NativeScope.equals(type)) { + executable = scope; + } + else { + executable = type; + templateCall = SHACLFactory.asTemplateCall(scope); + } + ExecutionLanguage language = ExecutionLanguageSelector.get().getLanguageForScope(executable); + for(Resource focusNode : language.executeScope(dataset, executable, templateCall)) { + results.add(focusNode.asNode()); + } + } /**
29
GitHub ISSUE-2: Engine now supports other execution languages than SPARQL for sh:scope
0
.java
java
apache-2.0
TopQuadrant/shacl
105
<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 import java.util.List; import java.util.Set; import org.topbraid.shacl.model.SHACLArgument; import org.topbraid.shacl.model.SHACLConstraintViolation; import org.topbraid.shacl.model.SHACLFactory; import org.topbraid.shacl.model.SHACLPropertyConstraint; import org.topbraid.shacl.vocabulary.SH; import org.topbraid.spin.arq.ARQFactory; import org.topbraid.spin.util.JenaUtil; import com.hp.hpl.jena.graph.Graph; import com.hp.hpl.jena.graph.Triple; import com.hp.hpl.jena.graph.compose.MultiUnion; import com.hp.hpl.jena.query.Query; import com.hp.hpl.jena.query.QueryExecution; import com.hp.hpl.jena.query.QuerySolutionMap; 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)); } } } } /** /** * 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) { 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> GitHub ISSUE-2: Engine now supports other execution languages than SPARQL for sh:scope <DFF> @@ -7,17 +7,22 @@ import java.util.LinkedList; import java.util.List; import java.util.Set; +import org.topbraid.shacl.constraints.ExecutionLanguage; +import org.topbraid.shacl.constraints.ExecutionLanguageSelector; import org.topbraid.shacl.model.SHACLArgument; import org.topbraid.shacl.model.SHACLConstraintViolation; import org.topbraid.shacl.model.SHACLFactory; import org.topbraid.shacl.model.SHACLPropertyConstraint; +import org.topbraid.shacl.model.SHACLTemplateCall; import org.topbraid.shacl.vocabulary.SH; import org.topbraid.spin.arq.ARQFactory; import org.topbraid.spin.util.JenaUtil; import com.hp.hpl.jena.graph.Graph; +import com.hp.hpl.jena.graph.Node; import com.hp.hpl.jena.graph.Triple; import com.hp.hpl.jena.graph.compose.MultiUnion; +import com.hp.hpl.jena.query.Dataset; import com.hp.hpl.jena.query.Query; import com.hp.hpl.jena.query.QueryExecution; import com.hp.hpl.jena.query.QuerySolutionMap; @@ -107,6 +112,30 @@ public class SHACLUtil { } } } + + + /** + * Adds all resources from a given sh:scope to a given results Set of Nodes. + * @param scope the value of sh:scope (template call or native scope) + * @param dataset the dataset to operate on + * @param results the Set to add the resulting Nodes to + */ + public static void addNodesInScope(Resource scope, Dataset dataset, Set<Node> results) { + Resource type = JenaUtil.getType(scope); + Resource executable; + SHACLTemplateCall templateCall = null; + if(type == null || SH.NativeScope.equals(type)) { + executable = scope; + } + else { + executable = type; + templateCall = SHACLFactory.asTemplateCall(scope); + } + ExecutionLanguage language = ExecutionLanguageSelector.get().getLanguageForScope(executable); + for(Resource focusNode : language.executeScope(dataset, executable, templateCall)) { + results.add(focusNode.asNode()); + } + } /**
29
GitHub ISSUE-2: Engine now supports other execution languages than SPARQL for sh:scope
0
.java
java
apache-2.0
TopQuadrant/shacl
106
<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 (holger@topquadrant.com) 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). 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) `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> Added command line instructions <DFF> @@ -25,3 +25,27 @@ 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) + +## Command Line Usage + +Download the latest release from the Release tab. + +Two command line utilities are included: validate (performs constraint validation) and infer (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 JENAROOT=C:\Users\Holger\Desktop\shacl-1.0.0-bin +SET PATH=%PATH%;%JENAROOT%\bin + +Both tools take the following parameters, for example: + +shaclvalidate.bat -datafile myfile.ttl -shapesfile myshapes.ttl + +whereby -shapesfile is optional and falls back to using the data graph as shapes graph. + +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 SHACL license.
24
Added command line instructions
0
.md
md
apache-2.0
TopQuadrant/shacl
107
<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 (holger@topquadrant.com) 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). 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) `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> Added command line instructions <DFF> @@ -25,3 +25,27 @@ 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) + +## Command Line Usage + +Download the latest release from the Release tab. + +Two command line utilities are included: validate (performs constraint validation) and infer (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 JENAROOT=C:\Users\Holger\Desktop\shacl-1.0.0-bin +SET PATH=%PATH%;%JENAROOT%\bin + +Both tools take the following parameters, for example: + +shaclvalidate.bat -datafile myfile.ttl -shapesfile myshapes.ttl + +whereby -shapesfile is optional and falls back to using the data graph as shapes graph. + +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 SHACL license.
24
Added command line instructions
0
.md
md
apache-2.0
TopQuadrant/shacl
108
<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 ; . 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 ; . 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" ; 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)." ; rdfs:label "Type of Values" ; sh:order 3 ; . 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." ; 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:open a rdf:Property ; rdfs:comment "If set to true, then the corresponding form section will be open by default. This only has an effect if sh:openable is set to true as well." ; rdfs:domain sh:PropertyGroup ; rdfs:label "open" ; rdfs:range xsd:boolean ; . tosh:openable a rdf:Property ; rdfs:comment "If set to true, then the corresponding form section shall be openable/closable (and show up closed)." ; rdfs:domain sh:PropertyGroup ; rdfs:label "openable" ; rdfs:range xsd:boolean ; . 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 ; . 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
16
Small performance optimization, updated DASH/TOSH namespaces
4
.ttl
ttl
apache-2.0
TopQuadrant/shacl
109
<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 ; . 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 ; . 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" ; 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)." ; rdfs:label "Type of Values" ; sh:order 3 ; . 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." ; 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:open a rdf:Property ; rdfs:comment "If set to true, then the corresponding form section will be open by default. This only has an effect if sh:openable is set to true as well." ; rdfs:domain sh:PropertyGroup ; rdfs:label "open" ; rdfs:range xsd:boolean ; . tosh:openable a rdf:Property ; rdfs:comment "If set to true, then the corresponding form section shall be openable/closable (and show up closed)." ; rdfs:domain sh:PropertyGroup ; rdfs:label "openable" ; rdfs:range xsd:boolean ; . 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 ; . 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
16
Small performance optimization, updated DASH/TOSH namespaces
4
.ttl
ttl
apache-2.0
TopQuadrant/shacl
110
<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.vocabulary.RDFS; import org.topbraid.shacl.constraints.ExecutionLanguage; import org.topbraid.shacl.constraints.ExecutionLanguageSelector; import org.topbraid.shacl.model.SHConstraintComponent; import org.topbraid.shacl.model.SHFactory; import org.topbraid.shacl.model.SHNodeShape; 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:"; static { constraintProperties.add(SH.property); constraintProperties.add(SH.sparql); } private final static List<Property> constraintPropertiesIncludingParameter = new LinkedList<Property>(); } 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) { 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 to SHACL-JS <DFF> @@ -30,6 +30,7 @@ import org.apache.jena.vocabulary.RDF; import org.apache.jena.vocabulary.RDFS; import org.topbraid.shacl.constraints.ExecutionLanguage; import org.topbraid.shacl.constraints.ExecutionLanguageSelector; +import org.topbraid.shacl.js.SHJS; import org.topbraid.shacl.model.SHConstraintComponent; import org.topbraid.shacl.model.SHFactory; import org.topbraid.shacl.model.SHNodeShape; @@ -82,6 +83,7 @@ public class SHACLUtil { static { constraintProperties.add(SH.property); constraintProperties.add(SH.sparql); + constraintProperties.add(SHJS.js); } private final static List<Property> constraintPropertiesIncludingParameter = new LinkedList<Property>();
2
Updates to SHACL-JS
0
.java
java
apache-2.0
TopQuadrant/shacl
111
<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.vocabulary.RDFS; import org.topbraid.shacl.constraints.ExecutionLanguage; import org.topbraid.shacl.constraints.ExecutionLanguageSelector; import org.topbraid.shacl.model.SHConstraintComponent; import org.topbraid.shacl.model.SHFactory; import org.topbraid.shacl.model.SHNodeShape; 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:"; static { constraintProperties.add(SH.property); constraintProperties.add(SH.sparql); } private final static List<Property> constraintPropertiesIncludingParameter = new LinkedList<Property>(); } 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) { 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 to SHACL-JS <DFF> @@ -30,6 +30,7 @@ import org.apache.jena.vocabulary.RDF; import org.apache.jena.vocabulary.RDFS; import org.topbraid.shacl.constraints.ExecutionLanguage; import org.topbraid.shacl.constraints.ExecutionLanguageSelector; +import org.topbraid.shacl.js.SHJS; import org.topbraid.shacl.model.SHConstraintComponent; import org.topbraid.shacl.model.SHFactory; import org.topbraid.shacl.model.SHNodeShape; @@ -82,6 +83,7 @@ public class SHACLUtil { static { constraintProperties.add(SH.property); constraintProperties.add(SH.sparql); + constraintProperties.add(SHJS.js); } private final static List<Property> constraintPropertiesIncludingParameter = new LinkedList<Property>();
2
Updates to SHACL-JS
0
.java
java
apache-2.0
TopQuadrant/shacl
112
<NME> nodeValidator-001.test.ttl <BEF> # baseURI: http://datashapes.org/sh/tests/sparql/component/nodeValidator-ask-001.test # imports: http://datashapes.org/dash # prefix: ex @prefix dash: <http://datashapes.org/dash#> . @prefix ex: <http://datashapes.org/sh/tests/sparql/component/nodeValidator-ask-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/sparql/component/nodeValidator-ask-001.test> rdf:type owl:Ontology ; rdfs:label "Test of sh:nodeValidator with ASK 001" ; owl:imports <http://datashapes.org/dash> ; owl:versionInfo "Created with TopBraid Composer" ; sh:declare [ rdf:type sh:PrefixDeclaration ; sh:namespace "http://datashapes.org/sh/tests/sparql/component/nodeValidator-ask-001.test#"^^xsd:anyURI ; sh:prefix "ex" ; ] ; . 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:InvalidResource1 ; sh:resultSeverity sh:Violation ; sh:sourceConstraintComponent ex:TestConstraintComponent ; sh:sourceShape ex:TestShape ; sh:value ex:InvalidResource1 ; ] ; ] ; . ex:InvalidResource1 ex:property "Other" ; . ex:TestConstraintComponent rdf:type sh:ConstraintComponent ; rdfs:label "Test constraint component" ; sh:nodeValidator [ rdf:type sh:SPARQLAskValidator ; sh:ask """ASK { $this ex:property ?requiredParam . }""" ; sh:prefixes <http://datashapes.org/sh/tests/sparql/component/nodeValidator-ask-001.test> ; ] ; sh:parameter [ sh:path ex:optionalParam ; sh:datatype xsd:integer ; sh:name "optional param" ; sh:optional "true"^^xsd:boolean ; ] ; sh:parameter [ sh:path ex:requiredParam ; sh:datatype xsd:string ; sh:name "required param" ; ] ; . ex:TestShape rdf:type sh:NodeShape ; ex:requiredParam "Value" ; rdfs:label "Test shape" ; sh:targetNode ex:InvalidResource1 ; sh:targetNode ex:ValidResource1 ; . ex:ValidResource1 ex:property "Value" ; . <MSG> Fixed interpretation of sh:inversePath with nested expressions, updated test cases <DFF> @@ -1,23 +1,22 @@ -# baseURI: http://datashapes.org/sh/tests/sparql/component/nodeValidator-ask-001.test +# baseURI: http://datashapes.org/sh/tests/sparql/component/nodeValidator-001.test # imports: http://datashapes.org/dash # prefix: ex @prefix dash: <http://datashapes.org/dash#> . -@prefix ex: <http://datashapes.org/sh/tests/sparql/component/nodeValidator-ask-001.test#> . +@prefix ex: <http://datashapes.org/sh/tests/sparql/component/nodeValidator-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/sparql/component/nodeValidator-ask-001.test> +<http://datashapes.org/sh/tests/sparql/component/nodeValidator-001.test> rdf:type owl:Ontology ; - rdfs:label "Test of sh:nodeValidator with ASK 001" ; + rdfs:label "Test of sh:nodeValidator 001" ; owl:imports <http://datashapes.org/dash> ; - owl:versionInfo "Created with TopBraid Composer" ; sh:declare [ rdf:type sh:PrefixDeclaration ; - sh:namespace "http://datashapes.org/sh/tests/sparql/component/nodeValidator-ask-001.test#"^^xsd:anyURI ; + sh:namespace "http://datashapes.org/sh/tests/sparql/component/nodeValidator-001.test#"^^xsd:anyURI ; sh:prefix "ex" ; ] ; . @@ -43,11 +42,15 @@ ex:TestConstraintComponent rdf:type sh:ConstraintComponent ; rdfs:label "Test constraint component" ; sh:nodeValidator [ - rdf:type sh:SPARQLAskValidator ; - sh:ask """ASK { - $this ex:property ?requiredParam . -}""" ; - sh:prefixes <http://datashapes.org/sh/tests/sparql/component/nodeValidator-ask-001.test> ; + rdf:type sh:SPARQLSelectValidator ; + sh:prefixes <http://datashapes.org/sh/tests/sparql/component/nodeValidator-001.test> ; + sh:select """ + SELECT DISTINCT $this + WHERE { + $this ?p ?o . + FILTER NOT EXISTS { + $this ex:property ?requiredParam . + }}""" ; ] ; sh:parameter [ sh:path ex:optionalParam ;
14
Fixed interpretation of sh:inversePath with nested expressions, updated test cases
11
.ttl
test
apache-2.0
TopQuadrant/shacl
113
<NME> nodeValidator-001.test.ttl <BEF> # baseURI: http://datashapes.org/sh/tests/sparql/component/nodeValidator-ask-001.test # imports: http://datashapes.org/dash # prefix: ex @prefix dash: <http://datashapes.org/dash#> . @prefix ex: <http://datashapes.org/sh/tests/sparql/component/nodeValidator-ask-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/sparql/component/nodeValidator-ask-001.test> rdf:type owl:Ontology ; rdfs:label "Test of sh:nodeValidator with ASK 001" ; owl:imports <http://datashapes.org/dash> ; owl:versionInfo "Created with TopBraid Composer" ; sh:declare [ rdf:type sh:PrefixDeclaration ; sh:namespace "http://datashapes.org/sh/tests/sparql/component/nodeValidator-ask-001.test#"^^xsd:anyURI ; sh:prefix "ex" ; ] ; . 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:InvalidResource1 ; sh:resultSeverity sh:Violation ; sh:sourceConstraintComponent ex:TestConstraintComponent ; sh:sourceShape ex:TestShape ; sh:value ex:InvalidResource1 ; ] ; ] ; . ex:InvalidResource1 ex:property "Other" ; . ex:TestConstraintComponent rdf:type sh:ConstraintComponent ; rdfs:label "Test constraint component" ; sh:nodeValidator [ rdf:type sh:SPARQLAskValidator ; sh:ask """ASK { $this ex:property ?requiredParam . }""" ; sh:prefixes <http://datashapes.org/sh/tests/sparql/component/nodeValidator-ask-001.test> ; ] ; sh:parameter [ sh:path ex:optionalParam ; sh:datatype xsd:integer ; sh:name "optional param" ; sh:optional "true"^^xsd:boolean ; ] ; sh:parameter [ sh:path ex:requiredParam ; sh:datatype xsd:string ; sh:name "required param" ; ] ; . ex:TestShape rdf:type sh:NodeShape ; ex:requiredParam "Value" ; rdfs:label "Test shape" ; sh:targetNode ex:InvalidResource1 ; sh:targetNode ex:ValidResource1 ; . ex:ValidResource1 ex:property "Value" ; . <MSG> Fixed interpretation of sh:inversePath with nested expressions, updated test cases <DFF> @@ -1,23 +1,22 @@ -# baseURI: http://datashapes.org/sh/tests/sparql/component/nodeValidator-ask-001.test +# baseURI: http://datashapes.org/sh/tests/sparql/component/nodeValidator-001.test # imports: http://datashapes.org/dash # prefix: ex @prefix dash: <http://datashapes.org/dash#> . -@prefix ex: <http://datashapes.org/sh/tests/sparql/component/nodeValidator-ask-001.test#> . +@prefix ex: <http://datashapes.org/sh/tests/sparql/component/nodeValidator-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/sparql/component/nodeValidator-ask-001.test> +<http://datashapes.org/sh/tests/sparql/component/nodeValidator-001.test> rdf:type owl:Ontology ; - rdfs:label "Test of sh:nodeValidator with ASK 001" ; + rdfs:label "Test of sh:nodeValidator 001" ; owl:imports <http://datashapes.org/dash> ; - owl:versionInfo "Created with TopBraid Composer" ; sh:declare [ rdf:type sh:PrefixDeclaration ; - sh:namespace "http://datashapes.org/sh/tests/sparql/component/nodeValidator-ask-001.test#"^^xsd:anyURI ; + sh:namespace "http://datashapes.org/sh/tests/sparql/component/nodeValidator-001.test#"^^xsd:anyURI ; sh:prefix "ex" ; ] ; . @@ -43,11 +42,15 @@ ex:TestConstraintComponent rdf:type sh:ConstraintComponent ; rdfs:label "Test constraint component" ; sh:nodeValidator [ - rdf:type sh:SPARQLAskValidator ; - sh:ask """ASK { - $this ex:property ?requiredParam . -}""" ; - sh:prefixes <http://datashapes.org/sh/tests/sparql/component/nodeValidator-ask-001.test> ; + rdf:type sh:SPARQLSelectValidator ; + sh:prefixes <http://datashapes.org/sh/tests/sparql/component/nodeValidator-001.test> ; + sh:select """ + SELECT DISTINCT $this + WHERE { + $this ?p ?o . + FILTER NOT EXISTS { + $this ex:property ?requiredParam . + }}""" ; ] ; sh:parameter [ sh:path ex:optionalParam ;
14
Fixed interpretation of sh:inversePath with nested expressions, updated test cases
11
.ttl
test
apache-2.0
TopQuadrant/shacl
114
<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 Scope = ResourceFactory.createResource(NS + "Scope"); 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 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 Templates = ResourceFactory.createResource(NS + "Templates"); public final static Resource text = ResourceFactory.createResource(NS + "text"); public final static Resource ValidationResult = ResourceFactory.createResource(NS + "ValidationResult"); public final static Resource Violation = ResourceFactory.createResource(NS + "Violation"); public final static Resource MinLengthConstraintComponent = ResourceFactory.createResource(NS + "MinLengthConstraintComponent"); public final static Property abstract_ = ResourceFactory.createProperty(NS + "abstract"); public final static Property argument = ResourceFactory.createProperty(NS + "argument"); 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 Property derivedValues = ResourceFactory.createProperty(NS + "derivedValues"); public final static Property directType = ResourceFactory.createProperty(NS + "directType"); public final static Property entailment = ResourceFactory.createProperty(NS + "entailment"); 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 Property in = ResourceFactory.createProperty(NS + "in"); public final static Property index = ResourceFactory.createProperty(NS + "index"); public final static Property inverse = ResourceFactory.createProperty(NS + "inverse"); public final static Property inverseProperty = ResourceFactory.createProperty(NS + "inverseProperty"); 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 Property minInclusive = ResourceFactory.createProperty(NS + "minInclusive"); public final static Property nodeKind = ResourceFactory.createProperty(NS + "nodeKind"); public final static Property object = ResourceFactory.createProperty(NS + "object"); public final static Property class_ = ResourceFactory.createProperty(NS + "class"); public final static Property optional = ResourceFactory.createProperty(NS + "optional"); public final static Property optionalWhenInherited = ResourceFactory.createProperty(NS + "optionalWhenInherited"); public final static Property predicate = ResourceFactory.createProperty(NS + "predicate"); 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 severity = ResourceFactory.createProperty(NS + "severity"); public final static Property shape = ResourceFactory.createProperty(NS + "shape"); public final static Property shapes = ResourceFactory.createProperty(NS + "shapes"); public final static Property shapesGraph = ResourceFactory.createProperty(NS + "shapesGraph"); 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> Replaced sh:ShapeClass with sh:Shape + rdfs:Class <DFF> @@ -76,8 +76,6 @@ public class SH { public final static Resource Scope = ResourceFactory.createResource(NS + "Scope"); 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"); @@ -91,8 +89,6 @@ public class SH { public final static Resource Templates = ResourceFactory.createResource(NS + "Templates"); - public final static Resource text = ResourceFactory.createResource(NS + "text"); - public final static Resource ValidationResult = ResourceFactory.createResource(NS + "ValidationResult"); public final static Resource Violation = ResourceFactory.createResource(NS + "Violation"); @@ -101,6 +97,8 @@ public class SH { public final static Property abstract_ = ResourceFactory.createProperty(NS + "abstract"); + + public final static Property and = ResourceFactory.createProperty(NS + "and"); public final static Property argument = ResourceFactory.createProperty(NS + "argument"); @@ -116,6 +114,8 @@ public class SH { public final static Property derivedValues = ResourceFactory.createProperty(NS + "derivedValues"); + public final static Property description = ResourceFactory.createProperty(NS + "description"); + public final static Property directType = ResourceFactory.createProperty(NS + "directType"); public final static Property entailment = ResourceFactory.createProperty(NS + "entailment"); @@ -136,8 +136,6 @@ public class SH { public final static Property in = ResourceFactory.createProperty(NS + "in"); - public final static Property index = ResourceFactory.createProperty(NS + "index"); - public final static Property inverse = ResourceFactory.createProperty(NS + "inverse"); public final static Property inverseProperty = ResourceFactory.createProperty(NS + "inverseProperty"); @@ -160,7 +158,11 @@ public class SH { public final static Property minInclusive = ResourceFactory.createProperty(NS + "minInclusive"); + public final static Property name = ResourceFactory.createProperty(NS + "name"); + public final static Property nodeKind = ResourceFactory.createProperty(NS + "nodeKind"); + + public final static Property not = ResourceFactory.createProperty(NS + "not"); public final static Property object = ResourceFactory.createProperty(NS + "object"); @@ -169,6 +171,10 @@ public class SH { public final static Property optional = ResourceFactory.createProperty(NS + "optional"); public final static Property optionalWhenInherited = ResourceFactory.createProperty(NS + "optionalWhenInherited"); + + public final static Property or = ResourceFactory.createProperty(NS + "or"); + + public final static Property order = ResourceFactory.createProperty(NS + "order"); public final static Property predicate = ResourceFactory.createProperty(NS + "predicate"); @@ -185,8 +191,6 @@ public class SH { public final static Property severity = ResourceFactory.createProperty(NS + "severity"); public final static Property shape = ResourceFactory.createProperty(NS + "shape"); - - public final static Property shapes = ResourceFactory.createProperty(NS + "shapes"); public final static Property shapesGraph = ResourceFactory.createProperty(NS + "shapesGraph");
12
Replaced sh:ShapeClass with sh:Shape + rdfs:Class
8
.java
java
apache-2.0
TopQuadrant/shacl
115
<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 Scope = ResourceFactory.createResource(NS + "Scope"); 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 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 Templates = ResourceFactory.createResource(NS + "Templates"); public final static Resource text = ResourceFactory.createResource(NS + "text"); public final static Resource ValidationResult = ResourceFactory.createResource(NS + "ValidationResult"); public final static Resource Violation = ResourceFactory.createResource(NS + "Violation"); public final static Resource MinLengthConstraintComponent = ResourceFactory.createResource(NS + "MinLengthConstraintComponent"); public final static Property abstract_ = ResourceFactory.createProperty(NS + "abstract"); public final static Property argument = ResourceFactory.createProperty(NS + "argument"); 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 Property derivedValues = ResourceFactory.createProperty(NS + "derivedValues"); public final static Property directType = ResourceFactory.createProperty(NS + "directType"); public final static Property entailment = ResourceFactory.createProperty(NS + "entailment"); 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 Property in = ResourceFactory.createProperty(NS + "in"); public final static Property index = ResourceFactory.createProperty(NS + "index"); public final static Property inverse = ResourceFactory.createProperty(NS + "inverse"); public final static Property inverseProperty = ResourceFactory.createProperty(NS + "inverseProperty"); 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 Property minInclusive = ResourceFactory.createProperty(NS + "minInclusive"); public final static Property nodeKind = ResourceFactory.createProperty(NS + "nodeKind"); public final static Property object = ResourceFactory.createProperty(NS + "object"); public final static Property class_ = ResourceFactory.createProperty(NS + "class"); public final static Property optional = ResourceFactory.createProperty(NS + "optional"); public final static Property optionalWhenInherited = ResourceFactory.createProperty(NS + "optionalWhenInherited"); public final static Property predicate = ResourceFactory.createProperty(NS + "predicate"); 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 severity = ResourceFactory.createProperty(NS + "severity"); public final static Property shape = ResourceFactory.createProperty(NS + "shape"); public final static Property shapes = ResourceFactory.createProperty(NS + "shapes"); public final static Property shapesGraph = ResourceFactory.createProperty(NS + "shapesGraph"); 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> Replaced sh:ShapeClass with sh:Shape + rdfs:Class <DFF> @@ -76,8 +76,6 @@ public class SH { public final static Resource Scope = ResourceFactory.createResource(NS + "Scope"); 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"); @@ -91,8 +89,6 @@ public class SH { public final static Resource Templates = ResourceFactory.createResource(NS + "Templates"); - public final static Resource text = ResourceFactory.createResource(NS + "text"); - public final static Resource ValidationResult = ResourceFactory.createResource(NS + "ValidationResult"); public final static Resource Violation = ResourceFactory.createResource(NS + "Violation"); @@ -101,6 +97,8 @@ public class SH { public final static Property abstract_ = ResourceFactory.createProperty(NS + "abstract"); + + public final static Property and = ResourceFactory.createProperty(NS + "and"); public final static Property argument = ResourceFactory.createProperty(NS + "argument"); @@ -116,6 +114,8 @@ public class SH { public final static Property derivedValues = ResourceFactory.createProperty(NS + "derivedValues"); + public final static Property description = ResourceFactory.createProperty(NS + "description"); + public final static Property directType = ResourceFactory.createProperty(NS + "directType"); public final static Property entailment = ResourceFactory.createProperty(NS + "entailment"); @@ -136,8 +136,6 @@ public class SH { public final static Property in = ResourceFactory.createProperty(NS + "in"); - public final static Property index = ResourceFactory.createProperty(NS + "index"); - public final static Property inverse = ResourceFactory.createProperty(NS + "inverse"); public final static Property inverseProperty = ResourceFactory.createProperty(NS + "inverseProperty"); @@ -160,7 +158,11 @@ public class SH { public final static Property minInclusive = ResourceFactory.createProperty(NS + "minInclusive"); + public final static Property name = ResourceFactory.createProperty(NS + "name"); + public final static Property nodeKind = ResourceFactory.createProperty(NS + "nodeKind"); + + public final static Property not = ResourceFactory.createProperty(NS + "not"); public final static Property object = ResourceFactory.createProperty(NS + "object"); @@ -169,6 +171,10 @@ public class SH { public final static Property optional = ResourceFactory.createProperty(NS + "optional"); public final static Property optionalWhenInherited = ResourceFactory.createProperty(NS + "optionalWhenInherited"); + + public final static Property or = ResourceFactory.createProperty(NS + "or"); + + public final static Property order = ResourceFactory.createProperty(NS + "order"); public final static Property predicate = ResourceFactory.createProperty(NS + "predicate"); @@ -185,8 +191,6 @@ public class SH { public final static Property severity = ResourceFactory.createProperty(NS + "severity"); public final static Property shape = ResourceFactory.createProperty(NS + "shape"); - - public final static Property shapes = ResourceFactory.createProperty(NS + "shapes"); public final static Property shapesGraph = ResourceFactory.createProperty(NS + "shapesGraph");
12
Replaced sh:ShapeClass with sh:Shape + rdfs:Class
8
.java
java
apache-2.0
TopQuadrant/shacl
116
<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 ShapeClass = ResourceFactory.createResource(NS + "ShapeClass"); public final static Resource Template = ResourceFactory.createResource(NS + "Template"); public final static Resource TemplateConstraint = ResourceFactory.createResource(NS + "TemplateConstraint"); 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 spec and associated code changes, added validation listener mechanism <DFF> @@ -73,6 +73,8 @@ public class SH { public final static Resource ShapeClass = ResourceFactory.createResource(NS + "ShapeClass"); + public final static Resource SuccessResult = ResourceFactory.createResource(NS + "SuccessResult"); + public final static Resource Template = ResourceFactory.createResource(NS + "Template"); public final static Resource TemplateConstraint = ResourceFactory.createResource(NS + "TemplateConstraint");
2
Latest spec and associated code changes, added validation listener mechanism
0
.java
java
apache-2.0
TopQuadrant/shacl
117
<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 ShapeClass = ResourceFactory.createResource(NS + "ShapeClass"); public final static Resource Template = ResourceFactory.createResource(NS + "Template"); public final static Resource TemplateConstraint = ResourceFactory.createResource(NS + "TemplateConstraint"); 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 spec and associated code changes, added validation listener mechanism <DFF> @@ -73,6 +73,8 @@ public class SH { public final static Resource ShapeClass = ResourceFactory.createResource(NS + "ShapeClass"); + public final static Resource SuccessResult = ResourceFactory.createResource(NS + "SuccessResult"); + public final static Resource Template = ResourceFactory.createResource(NS + "Template"); public final static Resource TemplateConstraint = ResourceFactory.createResource(NS + "TemplateConstraint");
2
Latest spec and associated code changes, added validation listener mechanism
0
.java
java
apache-2.0
TopQuadrant/shacl
118
<NME> anon-shape-002.test.ttl <BEF> # baseURI: http://datashapes.org/sh/tests/shapedefs/anon-shape-002.test # imports: http://datashapes.org/dash # prefix: ex @prefix dash: <http://datashapes.org/dash#> . @prefix ex: <http://datashapes.org/sh/tests/shapedefs/anon-shape-002.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/shapedefs/anon-shape-002.test> rdf:type owl:Ontology ; rdfs:label "Test of anonymous shape definition 002" ; owl:imports <http://datashapes.org/dash> ; . ex:GraphValidationTestCase ex:GraphValidationTestCase rdf:type dash:GraphValidationTestCase ; dash:expectedResult [ rdf:type sh:ValidationResult ; sh:focusNode ex:InvalidNode1 ; sh:resultPath ex:property ; sh:resultSeverity sh:Violation ; sh:sourceConstraintComponent sh:MinCountConstraintComponent ; ] ; . ex:InvalidNode1 ex:InvalidNode1 rdfs:label "Invalid node 1" ; . ex:ValidNode1 ex:property 42 ; . [ rdf:type sh:NodeShape ; rdfs:label "Anon shape" ; sh:property [ sh:path ex:property ; sh:datatype xsd:integer ; sh:maxCount 1 ; sh:minCount 1 ; sh:name "property" ; ] ; sh:targetNode ex:InvalidNode1 ; sh:targetNode ex:ValidNode1 ; ]. <MSG> Tracking the spec <DFF> @@ -19,11 +19,15 @@ ex:GraphValidationTestCase rdf:type dash:GraphValidationTestCase ; dash:expectedResult [ - rdf:type sh:ValidationResult ; - sh:focusNode ex:InvalidNode1 ; - sh:resultPath ex:property ; - sh:resultSeverity sh:Violation ; - sh:sourceConstraintComponent sh:MinCountConstraintComponent ; + rdf:type sh:ValidationReport ; + sh:conforms "false"^^xsd:boolean ; + sh:result [ + rdf:type sh:ValidationResult ; + sh:focusNode ex:InvalidNode1 ; + sh:resultPath ex:property ; + sh:resultSeverity sh:Violation ; + sh:sourceConstraintComponent sh:MinCountConstraintComponent ; + ] ; ] ; . ex:InvalidNode1
9
Tracking the spec
5
.ttl
test
apache-2.0
TopQuadrant/shacl
119
<NME> anon-shape-002.test.ttl <BEF> # baseURI: http://datashapes.org/sh/tests/shapedefs/anon-shape-002.test # imports: http://datashapes.org/dash # prefix: ex @prefix dash: <http://datashapes.org/dash#> . @prefix ex: <http://datashapes.org/sh/tests/shapedefs/anon-shape-002.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/shapedefs/anon-shape-002.test> rdf:type owl:Ontology ; rdfs:label "Test of anonymous shape definition 002" ; owl:imports <http://datashapes.org/dash> ; . ex:GraphValidationTestCase ex:GraphValidationTestCase rdf:type dash:GraphValidationTestCase ; dash:expectedResult [ rdf:type sh:ValidationResult ; sh:focusNode ex:InvalidNode1 ; sh:resultPath ex:property ; sh:resultSeverity sh:Violation ; sh:sourceConstraintComponent sh:MinCountConstraintComponent ; ] ; . ex:InvalidNode1 ex:InvalidNode1 rdfs:label "Invalid node 1" ; . ex:ValidNode1 ex:property 42 ; . [ rdf:type sh:NodeShape ; rdfs:label "Anon shape" ; sh:property [ sh:path ex:property ; sh:datatype xsd:integer ; sh:maxCount 1 ; sh:minCount 1 ; sh:name "property" ; ] ; sh:targetNode ex:InvalidNode1 ; sh:targetNode ex:ValidNode1 ; ]. <MSG> Tracking the spec <DFF> @@ -19,11 +19,15 @@ ex:GraphValidationTestCase rdf:type dash:GraphValidationTestCase ; dash:expectedResult [ - rdf:type sh:ValidationResult ; - sh:focusNode ex:InvalidNode1 ; - sh:resultPath ex:property ; - sh:resultSeverity sh:Violation ; - sh:sourceConstraintComponent sh:MinCountConstraintComponent ; + rdf:type sh:ValidationReport ; + sh:conforms "false"^^xsd:boolean ; + sh:result [ + rdf:type sh:ValidationResult ; + sh:focusNode ex:InvalidNode1 ; + sh:resultPath ex:property ; + sh:resultSeverity sh:Violation ; + sh:sourceConstraintComponent sh:MinCountConstraintComponent ; + ] ; ] ; . ex:InvalidNode1
9
Tracking the spec
5
.ttl
test
apache-2.0
TopQuadrant/shacl
120
<NME> qualifiedValueShapesDisjoint-001.test.ttl <BEF> # baseURI: http://datashapes.org/sh/tests/core/property/qualifiedValueShapesDisjoint-001.test # imports: http://datashapes.org/dash # prefix: ex @prefix dash: <http://datashapes.org/dash#> . @prefix ex: <http://datashapes.org/sh/tests/core/property/qualifiedValueShapesDisjoint-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/qualifiedValueShapesDisjoint-001.test> rdf:type owl:Ontology ; rdfs:label "Test of sh:qualifiedValueShapesDisjoint at property shape 001" ; owl:imports <http://datashapes.org/dash> ; . ex:Finger rdf:type rdfs:Class ; rdf:type sh:NodeShape ; rdfs:label "Finger" ; rdfs:subClassOf rdfs:Resource ; . ex:Finger1 rdf:type ex:Finger ; rdfs:label "Finger1" ; . ex:Finger2 rdf:type ex:Finger ; rdfs:label "Finger2" ; . ex:Finger3 rdf:type ex:Finger ; rdfs:label "Finger3" ; . ex:Finger4 rdf:type ex:Finger ; rdfs:label "Finger4" ; . ex:FingerAndThumb rdf:type ex:Finger ; rdf:type ex:Thumb ; rdfs:label "Finger and thumb" ; . 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:InvalidHand1 ; sh:resultPath ex:digit ; sh:resultSeverity sh:Violation ; sh:sourceConstraintComponent sh:QualifiedMinCountConstraintComponent ; sh:sourceShape ex:HandShape-digit1 ; ] ; sh:result [ rdf:type sh:ValidationResult ; sh:focusNode ex:InvalidHand1 ; sh:resultPath ex:digit ; sh:resultSeverity sh:Violation ; sh:sourceConstraintComponent sh:QualifiedMinCountConstraintComponent ; sh:sourceShape ex:HandShape-digit4 ; ] ; ] ; . ex:Hand rdf:type rdfs:Class ; rdf:type sh:NodeShape ; rdfs:label "Hand" ; rdfs:subClassOf rdfs:Resource ; . ex:HandShape rdf:type sh:NodeShape ; sh:property ex:HandShape-digit1 ; sh:property ex:HandShape-digit4 ; sh:qualifiedValueShape [ sh:class ex:Thumb ; ] ; ] ; sh:property [ sh:path ex:digit ; sh:class ex:Thumb ; ] ; sh:qualifiedValueShape [ sh:class ex:Finger ; ] ; ] ; sh:qualifiedValueShapesDisjoint "true"^^xsd:boolean ; sh:targetClass ex:Hand ; . ex:InvalidHand1 ] ; sh:qualifiedValueShapesDisjoint true ; . ex:InvalidHand1 rdf:type ex:Hand ; ex:digit ex:Finger1 ; ex:digit ex:Finger2 ; ex:digit ex:Finger3 ; ex:digit ex:FingerAndThumb ; . ex:Thumb rdf:type rdfs:Class ; rdf:type sh:NodeShape ; rdfs:label "Thumb" ; rdfs:subClassOf rdfs:Resource ; . ex:Thumb1 rdf:type ex:Thumb ; rdfs:label "Thumb1" ; . ex:ValidHand rdf:type ex:Hand ; ex:digit ex:Finger1 ; ex:digit ex:Finger2 ; ex:digit ex:Finger3 ; ex:digit ex:Finger4 ; ex:digit ex:Thumb1 ; rdfs:label "Valid hand" ; . <MSG> Tracking latest SHACL spec <DFF> @@ -78,6 +78,7 @@ ex:HandShape sh:qualifiedValueShape [ sh:class ex:Thumb ; ] ; + sh:qualifiedValueShapesDisjoint true ; ] ; sh:property [ sh:path ex:digit ; @@ -86,8 +87,8 @@ ex:HandShape sh:qualifiedValueShape [ sh:class ex:Finger ; ] ; + sh:qualifiedValueShapesDisjoint true ; ] ; - sh:qualifiedValueShapesDisjoint "true"^^xsd:boolean ; sh:targetClass ex:Hand ; . ex:InvalidHand1
2
Tracking latest SHACL spec
1
.ttl
test
apache-2.0
TopQuadrant/shacl
121
<NME> qualifiedValueShapesDisjoint-001.test.ttl <BEF> # baseURI: http://datashapes.org/sh/tests/core/property/qualifiedValueShapesDisjoint-001.test # imports: http://datashapes.org/dash # prefix: ex @prefix dash: <http://datashapes.org/dash#> . @prefix ex: <http://datashapes.org/sh/tests/core/property/qualifiedValueShapesDisjoint-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/qualifiedValueShapesDisjoint-001.test> rdf:type owl:Ontology ; rdfs:label "Test of sh:qualifiedValueShapesDisjoint at property shape 001" ; owl:imports <http://datashapes.org/dash> ; . ex:Finger rdf:type rdfs:Class ; rdf:type sh:NodeShape ; rdfs:label "Finger" ; rdfs:subClassOf rdfs:Resource ; . ex:Finger1 rdf:type ex:Finger ; rdfs:label "Finger1" ; . ex:Finger2 rdf:type ex:Finger ; rdfs:label "Finger2" ; . ex:Finger3 rdf:type ex:Finger ; rdfs:label "Finger3" ; . ex:Finger4 rdf:type ex:Finger ; rdfs:label "Finger4" ; . ex:FingerAndThumb rdf:type ex:Finger ; rdf:type ex:Thumb ; rdfs:label "Finger and thumb" ; . 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:InvalidHand1 ; sh:resultPath ex:digit ; sh:resultSeverity sh:Violation ; sh:sourceConstraintComponent sh:QualifiedMinCountConstraintComponent ; sh:sourceShape ex:HandShape-digit1 ; ] ; sh:result [ rdf:type sh:ValidationResult ; sh:focusNode ex:InvalidHand1 ; sh:resultPath ex:digit ; sh:resultSeverity sh:Violation ; sh:sourceConstraintComponent sh:QualifiedMinCountConstraintComponent ; sh:sourceShape ex:HandShape-digit4 ; ] ; ] ; . ex:Hand rdf:type rdfs:Class ; rdf:type sh:NodeShape ; rdfs:label "Hand" ; rdfs:subClassOf rdfs:Resource ; . ex:HandShape rdf:type sh:NodeShape ; sh:property ex:HandShape-digit1 ; sh:property ex:HandShape-digit4 ; sh:qualifiedValueShape [ sh:class ex:Thumb ; ] ; ] ; sh:property [ sh:path ex:digit ; sh:class ex:Thumb ; ] ; sh:qualifiedValueShape [ sh:class ex:Finger ; ] ; ] ; sh:qualifiedValueShapesDisjoint "true"^^xsd:boolean ; sh:targetClass ex:Hand ; . ex:InvalidHand1 ] ; sh:qualifiedValueShapesDisjoint true ; . ex:InvalidHand1 rdf:type ex:Hand ; ex:digit ex:Finger1 ; ex:digit ex:Finger2 ; ex:digit ex:Finger3 ; ex:digit ex:FingerAndThumb ; . ex:Thumb rdf:type rdfs:Class ; rdf:type sh:NodeShape ; rdfs:label "Thumb" ; rdfs:subClassOf rdfs:Resource ; . ex:Thumb1 rdf:type ex:Thumb ; rdfs:label "Thumb1" ; . ex:ValidHand rdf:type ex:Hand ; ex:digit ex:Finger1 ; ex:digit ex:Finger2 ; ex:digit ex:Finger3 ; ex:digit ex:Finger4 ; ex:digit ex:Thumb1 ; rdfs:label "Valid hand" ; . <MSG> Tracking latest SHACL spec <DFF> @@ -78,6 +78,7 @@ ex:HandShape sh:qualifiedValueShape [ sh:class ex:Thumb ; ] ; + sh:qualifiedValueShapesDisjoint true ; ] ; sh:property [ sh:path ex:digit ; @@ -86,8 +87,8 @@ ex:HandShape sh:qualifiedValueShape [ sh:class ex:Finger ; ] ; + sh:qualifiedValueShapesDisjoint true ; ] ; - sh:qualifiedValueShapesDisjoint "true"^^xsd:boolean ; sh:targetClass ex:Hand ; . ex:InvalidHand1
2
Tracking latest SHACL spec
1
.ttl
test
apache-2.0
TopQuadrant/shacl
122
<NME> sparqlTarget-001.test.ttl <BEF> ADDFILE <MSG> Tracked latest TopBraid changes, added SHACL rules support <DFF> @@ -0,0 +1,60 @@ +# baseURI: http://datashapes.org/sh/tests/sparql/target/sparqlTarget-001.test +# imports: http://datashapes.org/dash +# prefix: ex + +@prefix dash: <http://datashapes.org/dash#> . +@prefix ex: <http://datashapes.org/sh/tests/sparql/target/sparqlTarget-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/sparql/target/sparqlTarget-001.test> + rdf:type owl:Ontology ; + rdfs:label "Test of sh:SPARQLTarget 001" ; + owl:imports <http://datashapes.org/dash> ; +. +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:InvalidInstance1 ; + sh:resultPath rdfs:label ; + sh:resultSeverity sh:Violation ; + sh:sourceConstraintComponent sh:MaxCountConstraintComponent ; + sh:sourceShape ex:TestShape-label ; + ] ; + ] ; +. +ex:InvalidInstance1 + rdf:type owl:Thing ; + rdfs:label "Invalid instance1" ; +. +ex:TestShape + rdf:type sh:NodeShape ; + rdfs:label "Test shape" ; + sh:property ex:TestShape-label ; + sh:target [ + rdf:type sh:SPARQLTarget ; + sh:prefixes <http://datashapes.org/sh/tests/sparql/target/sparqlTarget-001.test> ; + sh:select """ + SELECT ?this + WHERE { + ?this a owl:Thing . + }""" ; + ] ; +. +ex:TestShape-label + sh:path rdfs:label ; + rdfs:comment "Must not have any rdfs:label" ; + rdfs:label "label" ; + sh:datatype xsd:string ; + sh:maxCount 0 ; +. +ex:ValidInstance1 + rdf:type owl:Thing ; +.
60
Tracked latest TopBraid changes, added SHACL rules support
0
.ttl
test
apache-2.0
TopQuadrant/shacl
123
<NME> sparqlTarget-001.test.ttl <BEF> ADDFILE <MSG> Tracked latest TopBraid changes, added SHACL rules support <DFF> @@ -0,0 +1,60 @@ +# baseURI: http://datashapes.org/sh/tests/sparql/target/sparqlTarget-001.test +# imports: http://datashapes.org/dash +# prefix: ex + +@prefix dash: <http://datashapes.org/dash#> . +@prefix ex: <http://datashapes.org/sh/tests/sparql/target/sparqlTarget-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/sparql/target/sparqlTarget-001.test> + rdf:type owl:Ontology ; + rdfs:label "Test of sh:SPARQLTarget 001" ; + owl:imports <http://datashapes.org/dash> ; +. +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:InvalidInstance1 ; + sh:resultPath rdfs:label ; + sh:resultSeverity sh:Violation ; + sh:sourceConstraintComponent sh:MaxCountConstraintComponent ; + sh:sourceShape ex:TestShape-label ; + ] ; + ] ; +. +ex:InvalidInstance1 + rdf:type owl:Thing ; + rdfs:label "Invalid instance1" ; +. +ex:TestShape + rdf:type sh:NodeShape ; + rdfs:label "Test shape" ; + sh:property ex:TestShape-label ; + sh:target [ + rdf:type sh:SPARQLTarget ; + sh:prefixes <http://datashapes.org/sh/tests/sparql/target/sparqlTarget-001.test> ; + sh:select """ + SELECT ?this + WHERE { + ?this a owl:Thing . + }""" ; + ] ; +. +ex:TestShape-label + sh:path rdfs:label ; + rdfs:comment "Must not have any rdfs:label" ; + rdfs:label "label" ; + sh:datatype xsd:string ; + sh:maxCount 0 ; +. +ex:ValidInstance1 + rdf:type owl:Thing ; +.
60
Tracked latest TopBraid changes, added SHACL rules support
0
.ttl
test
apache-2.0
TopQuadrant/shacl
124
<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 ; . 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 ; . 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" ; 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: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 ; . 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 rdfs:isDefinedBy sh: ; rdfs:label "distinct"@en ; . sh:groupConcat a rdf:Property ; rdfs:comment "Resources with values for sh:groupConcat are node expressions that produce an xsd:string consisting of the concatenation of all values of the associated node expression, possibly separated by the value of sh:separator."@en ; rdfs:isDefinedBy sh: ; rdfs:label "group concat"@en ; . sh:limit a rdf:Property ; rdfs:comment "Resources with values N for sh:limit are node expressions that produce only the first N values of the associated node expression sh:nodes."@en ; 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 ; . rdfs:isDefinedBy sh: ; rdfs:label "sum"@en ; . sh:values a rdf:Property ; rdfs:comment "Links a property shape with one or more SHACL node expressions that are used to determine the values of the associated predicate based on the current focus node. Only valid for property shapes where the sh:path is an IRI."@en ; . 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 ;
24
Clean up related to node expressions and addition of sh:exists and IF-THEN-ELSE (sh:if)
0
.ttl
ttl
apache-2.0
TopQuadrant/shacl
125
<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 ; . 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 ; . 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" ; 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: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 ; . 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 rdfs:isDefinedBy sh: ; rdfs:label "distinct"@en ; . sh:groupConcat a rdf:Property ; rdfs:comment "Resources with values for sh:groupConcat are node expressions that produce an xsd:string consisting of the concatenation of all values of the associated node expression, possibly separated by the value of sh:separator."@en ; rdfs:isDefinedBy sh: ; rdfs:label "group concat"@en ; . sh:limit a rdf:Property ; rdfs:comment "Resources with values N for sh:limit are node expressions that produce only the first N values of the associated node expression sh:nodes."@en ; 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 ; . rdfs:isDefinedBy sh: ; rdfs:label "sum"@en ; . sh:values a rdf:Property ; rdfs:comment "Links a property shape with one or more SHACL node expressions that are used to determine the values of the associated predicate based on the current focus node. Only valid for property shapes where the sh:path is an IRI."@en ; . 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 ;
24
Clean up related to node expressions and addition of sh:exists and IF-THEN-ELSE (sh:if)
0
.ttl
ttl
apache-2.0
TopQuadrant/shacl
126
<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> Updates for using Apache Jena 4.0.0. <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
Updates for using Apache Jena 4.0.0.
0
.java
java
apache-2.0
TopQuadrant/shacl
127
<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> Updates for using Apache Jena 4.0.0. <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
Updates for using Apache Jena 4.0.0.
0
.java
java
apache-2.0
TopQuadrant/shacl
128
<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 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 Property description = ResourceFactory.createProperty(NS + "description"); public final static Property entailment = ResourceFactory.createProperty(NS + "entailment"); public final static Property focusNode = ResourceFactory.createProperty(NS + "focusNode"); public final static Property hasValue = ResourceFactory.createProperty(NS + "hasValue"); public final static Resource QualifiedMinCountConstraintComponent = ResourceFactory.createResource(NS + "QualifiedMinCountConstraintComponent"); public final static Resource ResultAnnotation = ResourceFactory.createResource(NS + "ResultAnnotation"); public final static Property labelTemplate = ResourceFactory.createProperty(NS + "labelTemplate"); 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 member = ResourceFactory.createProperty(NS + "member"); public final static Property message = ResourceFactory.createProperty(NS + "message"); public final static Resource SPARQLValuesDeriver = ResourceFactory.createResource(NS + "SPARQLValuesDeriver"); public final static Resource UniqueLangConstraintComponent = ResourceFactory.createResource(NS + "UniqueLangConstraintComponent"); public final static Property minInclusive = ResourceFactory.createProperty(NS + "minInclusive"); public final static Property name = ResourceFactory.createProperty(NS + "name"); public final static Property namespace = ResourceFactory.createProperty(NS + "namespace"); 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 path = ResourceFactory.createProperty(NS + "path"); public final static Property predicate = ResourceFactory.createProperty(NS + "predicate"); public final static Property prefix = ResourceFactory.createProperty(NS + "prefix"); 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 targetSubjectsOf = ResourceFactory.createProperty(NS + "targetSubjectsOf"); public final static Property update = ResourceFactory.createProperty(NS + "update"); public final static Property validator = ResourceFactory.createProperty(NS + "validator"); 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 SHACL support (e.g. moved sh:stem to dash:stem), improved rendering of rdf:Lists <DFF> @@ -112,8 +112,12 @@ public class SH { 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 focusNode = ResourceFactory.createProperty(NS + "focusNode"); public final static Property hasValue = ResourceFactory.createProperty(NS + "hasValue"); @@ -124,12 +128,18 @@ public class SH { public final static Property labelTemplate = ResourceFactory.createProperty(NS + "labelTemplate"); + 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 member = ResourceFactory.createProperty(NS + "member"); public final static Property message = ResourceFactory.createProperty(NS + "message"); @@ -140,6 +150,8 @@ public class SH { 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"); @@ -160,6 +172,8 @@ public class SH { public final static Property path = ResourceFactory.createProperty(NS + "path"); + public final static Property pattern = ResourceFactory.createProperty(NS + "pattern"); + public final static Property predicate = ResourceFactory.createProperty(NS + "predicate"); public final static Property prefix = ResourceFactory.createProperty(NS + "prefix"); @@ -208,6 +222,8 @@ public class SH { 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");
16
Latest SHACL support (e.g. moved sh:stem to dash:stem), improved rendering of rdf:Lists
0
.java
java
apache-2.0
TopQuadrant/shacl
129
<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 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 Property description = ResourceFactory.createProperty(NS + "description"); public final static Property entailment = ResourceFactory.createProperty(NS + "entailment"); public final static Property focusNode = ResourceFactory.createProperty(NS + "focusNode"); public final static Property hasValue = ResourceFactory.createProperty(NS + "hasValue"); public final static Resource QualifiedMinCountConstraintComponent = ResourceFactory.createResource(NS + "QualifiedMinCountConstraintComponent"); public final static Resource ResultAnnotation = ResourceFactory.createResource(NS + "ResultAnnotation"); public final static Property labelTemplate = ResourceFactory.createProperty(NS + "labelTemplate"); 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 member = ResourceFactory.createProperty(NS + "member"); public final static Property message = ResourceFactory.createProperty(NS + "message"); public final static Resource SPARQLValuesDeriver = ResourceFactory.createResource(NS + "SPARQLValuesDeriver"); public final static Resource UniqueLangConstraintComponent = ResourceFactory.createResource(NS + "UniqueLangConstraintComponent"); public final static Property minInclusive = ResourceFactory.createProperty(NS + "minInclusive"); public final static Property name = ResourceFactory.createProperty(NS + "name"); public final static Property namespace = ResourceFactory.createProperty(NS + "namespace"); 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 path = ResourceFactory.createProperty(NS + "path"); public final static Property predicate = ResourceFactory.createProperty(NS + "predicate"); public final static Property prefix = ResourceFactory.createProperty(NS + "prefix"); 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 targetSubjectsOf = ResourceFactory.createProperty(NS + "targetSubjectsOf"); public final static Property update = ResourceFactory.createProperty(NS + "update"); public final static Property validator = ResourceFactory.createProperty(NS + "validator"); 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 SHACL support (e.g. moved sh:stem to dash:stem), improved rendering of rdf:Lists <DFF> @@ -112,8 +112,12 @@ public class SH { 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 focusNode = ResourceFactory.createProperty(NS + "focusNode"); public final static Property hasValue = ResourceFactory.createProperty(NS + "hasValue"); @@ -124,12 +128,18 @@ public class SH { public final static Property labelTemplate = ResourceFactory.createProperty(NS + "labelTemplate"); + 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 member = ResourceFactory.createProperty(NS + "member"); public final static Property message = ResourceFactory.createProperty(NS + "message"); @@ -140,6 +150,8 @@ public class SH { 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"); @@ -160,6 +172,8 @@ public class SH { public final static Property path = ResourceFactory.createProperty(NS + "path"); + public final static Property pattern = ResourceFactory.createProperty(NS + "pattern"); + public final static Property predicate = ResourceFactory.createProperty(NS + "predicate"); public final static Property prefix = ResourceFactory.createProperty(NS + "prefix"); @@ -208,6 +222,8 @@ public class SH { 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");
16
Latest SHACL support (e.g. moved sh:stem to dash:stem), improved rendering of rdf:Lists
0
.java
java
apache-2.0
TopQuadrant/shacl
130
<NME> node_tests.js <BEF> ADDFILE <MSG> Adding support to re-generate the vocabularies <DFF> @@ -0,0 +1,3 @@ +/** + * Created by antoniogarrote on 10/07/2017. + */
3
Adding support to re-generate the vocabularies
0
.js
js
apache-2.0
TopQuadrant/shacl
131
<NME> node_tests.js <BEF> ADDFILE <MSG> Adding support to re-generate the vocabularies <DFF> @@ -0,0 +1,3 @@ +/** + * Created by antoniogarrote on 10/07/2017. + */
3
Adding support to re-generate the vocabularies
0
.js
js
apache-2.0
TopQuadrant/shacl
132
<NME> gulpfile.js <BEF> ADDFILE <MSG> Adding .gitignore <DFF> @@ -0,0 +1,3 @@ +/** + * Created by antoniogarrote on 23/06/2017. + */
3
Adding .gitignore
0
.js
js
apache-2.0
TopQuadrant/shacl
133
<NME> gulpfile.js <BEF> ADDFILE <MSG> Adding .gitignore <DFF> @@ -0,0 +1,3 @@ +/** + * Created by antoniogarrote on 23/06/2017. + */
3
Adding .gitignore
0
.js
js
apache-2.0
TopQuadrant/shacl
134
<NME> tosh.ttl <BEF> ADDFILE <MSG> Adding test infrastructure <DFF> @@ -0,0 +1,972 @@ +# baseURI: http://topbraid.org/tosh +# imports: http://datashapes.org/dash +# prefix: tosh + +@prefix dash: <http://datashapes.org/dash#> . +@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"^^xsd:boolean ; +. +dash:ClosedByTypesConstraintComponent-closedByTypes + sh:group tosh:OtherConstraintPropertyGroup ; +. +dash:NonRecursiveConstraintComponent + dash:propertySuggestionGenerator tosh:DeleteTripleSuggestionGenerator ; + sh:property [ + sh:path dash:nonRecursive ; + sh:group tosh:RelationshipPropertyGroup ; + ] ; +. +dash:RootClassConstraintComponent + dash:propertySuggestionGenerator tosh:DeleteTripleSuggestionGenerator ; +. +dash:StemConstraintComponent-stem + sh:group tosh:StringBasedConstraintPropertyGroup ; +. +<http://spinrdf.org/sp#> + tosh:systemNamespace "true"^^xsd:boolean ; +. +<http://spinrdf.org/spin#> + tosh:systemNamespace "true"^^xsd:boolean ; +. +<http://spinrdf.org/spl#> + tosh:systemNamespace "true"^^xsd:boolean ; +. +<http://topbraid.org/tosh> + rdf:type owl:Ontology ; + rdfs:comment """A collection of SHACL features that are used whenever SHACL graphs are used within TopBraid Suite products. This includes things like suggested PropertyGroups and Shapes that control the layout of forms. Some of these may be of general use outside of TopBraid too. + +This namespace also includes the function tosh:hasShape, which can be used to implement some advanced constraint components using SPARQL only.""" ; + rdfs:label "TopBraid Data Shapes Library" ; + owl:imports <http://datashapes.org/dash> ; + sh:declare [ + rdf:type sh:PrefixDeclaration ; + sh:namespace "http://jena.hpl.hp.com/ARQ/function#"^^xsd:anyURI ; + sh:prefix "afn" ; + ] ; + sh:declare [ + rdf:type sh:PrefixDeclaration ; + 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 ; + sh:prefix "tosh" ; + ] ; +. +tosh: + tosh:systemNamespace "true"^^xsd:boolean ; +. +tosh:AboutPropertyGroup + rdf:type sh:PropertyGroup ; + rdfs:label "This Shape" ; + sh:order 0 ; +. +tosh:CardinalityConstraintPropertyGroup + rdf:type sh:PropertyGroup ; + rdfs:label "Cardinality" ; + sh:order 2 ; +. +tosh:ComplexConstraintPropertyGroup + rdf:type sh:PropertyGroup ; + tosh:openable "true"^^xsd:boolean ; + rdfs:label "Complex Constraints" ; + sh:order 9 ; +. +tosh:ConstraintMetadataPropertyGroup + rdf:type sh:PropertyGroup ; + rdfs:label "Constraint Metadata" ; +. +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 + 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 + rdf:type 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 [ + rdf:type sh:SPARQLSelectValidator ; + sh:message "List member {?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 + rdf:type 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:OtherConstraintPropertyGroup + rdf:type sh:PropertyGroup ; + tosh:openable "true"^^xsd:boolean ; + rdfs:label "Other Constraints" ; + sh:order 10 ; +. +tosh:PropertyPairConstraintPropertyGroup + rdf:type sh:PropertyGroup ; + tosh:openable "true"^^xsd:boolean ; + rdfs:label "Property Pairs" ; + sh:order 6 ; +. +tosh:PropertyShapeShape + rdf:type sh:NodeShape ; + rdfs:label "Property shape shape" ; + sh:property [ + sh:path tosh:editWidget ; + tosh:editWidget <http://topbraid.org/swaeditor#WidgetDropDownEditor> ; + tosh:viewWidget swa:ResourceInUIGraphViewer ; + sh:description "The swa:ObjectEditorClass that shall be used to edit values of this predicate." ; + sh:group tosh:DisplayPropertyGroup ; + sh:maxCount 1 ; + sh:name "edit widget" ; + sh:nodeKind sh:IRI ; + sh:order 21 ; + ] ; + sh:property [ + sh:path tosh:searchWidget ; + tosh:editWidget <http://topbraid.org/swaeditor#WidgetDropDownEditor> ; + tosh:viewWidget swa:ResourceInUIGraphViewer ; + sh:description "The swa:ObjectFacetClass that shall be used to search for values of this predicate." ; + sh:group tosh:DisplayPropertyGroup ; + sh:maxCount 1 ; + sh:name "search widget" ; + sh:nodeKind sh:IRI ; + sh:order 22 ; + ] ; + sh:property [ + sh:path tosh:viewWidget ; + tosh:editWidget <http://topbraid.org/swaeditor#WidgetDropDownEditor> ; + tosh:viewWidget swa:ResourceInUIGraphViewer ; + sh:description "The swa:ObjectViewerClass that shall be used to view values of this predicate." ; + sh:group tosh:DisplayPropertyGroup ; + sh:maxCount 1 ; + sh:name "view widget" ; + sh:nodeKind sh:IRI ; + sh:order 20 ; + ] ; + sh:property [ + sh:path sh:defaultValue ; + tosh:editWidget <http://topbraid.org/tosh.ui#UseDeclaredDatatypeEditor> ; + tosh:useDeclaredDatatype "true"^^xsd:boolean ; + sh:description "The default value to be used for this property at new instances." ; + sh:group tosh:ValueTypeConstraintPropertyGroup ; + ] ; + sh:property [ + sh:path sh:description ; + tosh:editWidget swa:TextAreaEditor ; + sh:description "A human-readable description of the role of the property in the constraint." ; + sh:group tosh:DisplayPropertyGroup ; + sh:name "description" ; + sh:order 2 ; + ] ; + sh:property [ + sh:path sh:group ; + sh:description "The sh:PropertyGroup that the property belongs to." ; + sh:group tosh:DisplayPropertyGroup ; + sh:maxCount 1 ; + sh:name "group" ; + sh:order 10 ; + ] ; + sh:property [ + sh:path sh:name ; + tosh:editWidget swa:TextFieldEditorWithLang ; + sh:description "The display name of the property." ; + sh:group tosh:DisplayPropertyGroup ; + sh:name "name" ; + sh:order 1 ; + ] ; + sh:property [ + sh:path sh:order ; + sh:description "The relative position of the property among its peers, e.g. a property with order 5 shows up before one with order 6." ; + sh:group tosh:DisplayPropertyGroup ; + sh:maxCount 1 ; + sh:name "order" ; + sh:order 11 ; + ] ; + sh:property [ + sh:path sh:path ; + sh:group tosh:AboutPropertyGroup ; + sh:maxCount 1 ; + sh:name "on property" ; + sh:order 0 ; + ] ; + sh:targetClass sh:PropertyShape ; +. +tosh:RelationshipPropertyGroup + rdf:type sh:PropertyGroup ; + tosh:openable "true"^^xsd:boolean ; + rdfs:label "Relationship" ; + sh:order 8 ; +. +tosh:ShapeShape + rdf:type sh:NodeShape ; + rdfs:label "Shape of shapes" ; + sh:property tosh:ShapeShape-deactivated ; + sh:property tosh:ShapeShape-severity ; + sh:targetClass sh:Shape ; +. +tosh:ShapeShape-deactivated + rdf:type sh:PropertyShape ; + sh:path sh:deactivated ; + sh:description "Can be used to deactivate the whole constraint." ; + sh:group tosh:AboutPropertyGroup ; + sh:maxCount 1 ; + sh:name "deactivated" ; + sh:order "1"^^xsd:decimal ; +. +tosh:ShapeShape-severity + rdf:type sh:PropertyShape ; + sh:path sh:severity ; + tosh:editWidget swa:InstancesSelectEditor ; + sh:class sh:Severity ; + sh:description "The severity to be used for validation results produced by the associated constraint." ; + sh:group tosh:AboutPropertyGroup ; + sh:maxCount 1 ; + sh:name "severity" ; + sh:order "2"^^xsd:decimal ; +. +tosh:StringBasedConstraintPropertyGroup + rdf:type sh:PropertyGroup ; + tosh:openable "true"^^xsd:boolean ; + rdfs:label "String Constraints" ; + sh:order 7 ; +. +tosh:SystemNamespaceShape + rdf:type 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 [ + rdf:type 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:UseDeclaredDatatypeConstraintComponent + rdf:type sh:ConstraintComponent ; + 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 . +} +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 [ + 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 [ + rdf:type sh:SPARQLSelectValidator ; + sh:message "Datatype must match the declared datatype {?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:ValueRangeConstraintPropertyGroup + rdf:type sh:PropertyGroup ; + tosh:openable "true"^^xsd:boolean ; + rdfs:label "Value Range" ; + sh:order 5 ; +. +tosh:ValueTypeConstraintPropertyGroup + rdf:type sh:PropertyGroup ; + rdfs:comment "A property group for constraint parameters that restrict the value types of values." ; + rdfs:label "Value Type" ; + sh:order 3 ; +. +tosh:countShapesWithMatchResult + rdf:type 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 [ + sh:path sh:expectedValue ; + sh:datatype xsd:boolean ; + sh:description "The expected value of tosh:hasShape to count." ; + sh:order 3 ; + ] ; + sh:parameter [ + sh:path sh:focusNode ; + sh:class rdfs:Resource ; + sh:description "The focus node." ; + sh:order 0 ; + ] ; + sh:parameter [ + sh:path sh:shapes ; + sh:class rdf:List ; + sh:description "The list of shapes to walk through." ; + sh:order 1 ; + ] ; + sh:parameter [ + sh:path sh:shapesGraph ; + sh:class rdfs:Resource ; + sh:description "The shapes graph." ; + sh:order 2 ; + ] ; + 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:editWidget + 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." ; + rdfs:label "has datatype" ; + sh:ask """ + ASK { + FILTER (datatype($value) = $datatype && spif:isValidForDatatype($value, $datatype)) . + } + """ ; + sh:prefixes <http://topbraid.org/tosh> ; +. +tosh:hasShape + rdf:type sh:Function ; + 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 [ + sh:path tosh:node ; + sh:description "The node to validate." ; + ] ; + sh:parameter [ + sh:path tosh:shape ; + sh:description "The shape that the node is supposed to have." ; + ] ; + sh:returnType xsd:boolean ; +. +tosh:open + rdf:type rdf:Property ; + rdfs:comment "If set to true, then the corresponding form section will be open by default. This only has an effect if sh:openable is set to true as well." ; + rdfs:domain sh:PropertyGroup ; + rdfs:label "open" ; + rdfs:range xsd:boolean ; +. +tosh:openable + rdf:type rdf:Property ; + rdfs:comment "If set to true, then the corresponding form section shall be openable/closable (and show up closed)." ; + rdfs:domain sh:PropertyGroup ; + rdfs:label "openable" ; + rdfs:range xsd:boolean ; +. +tosh:searchWidget + rdfs:range swa:ObjectFacetClass ; +. +tosh:shaclExists + rdf:type sh:Function ; + rdfs:comment "Checks whether the current query graph has SHACL activated, i.e. imports the triples typically found in the SHACL namespace. This is currently relying on an approximation, only certain triples, and is natively implemented for TopBraid. Future versions may expose the actual logic as a SPARQL query." ; + 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." ; + rdfs:label "system namespace" ; + rdfs:range xsd:boolean ; +. +tosh:validatorForContext + rdf:type sh:SPARQLFunction ; + rdfs:comment "Gets a suitable validator for a given context, following the resolution rules from the spec." ; + rdfs:label "validator for context" ; + sh:parameter [ + sh:path tosh:component ; + sh:class sh:ConstraintComponent ; + sh:description "The constraint component." ; + sh:name "component" ; + ] ; + sh:parameter [ + sh:path tosh:context ; + sh:class rdfs:Class ; + sh:description "The context, e.g. sh:PropertyShape." ; + sh:name "context" ; + ] ; + sh:prefixes <http://topbraid.org/tosh> ; + sh:returnType sh:Validator ; + sh:select """ + SELECT ?validator + WHERE { + { + BIND (IF($context = sh:PropertyShape, sh:propertyValidator, sh:nodeValidator) AS ?predicate) . + } + OPTIONAL { + $component ?predicate ?specialized . + } + OPTIONAL { + $component sh:validator ?default . + } + BIND (COALESCE(?specialized, ?default) AS ?validator) . + }""" ; +. +tosh:valuesWithShapeCount + rdf:type sh:SPARQLFunction ; + rdfs:comment "Counts the number of values from a given subject (?arg1) / predicate (?arg2) combination that do not produce any error-level constraint violations for a given shape (?arg3) in a given shapes graph (?arg4). The function produces an error if one of the shapes validated to a fatal error." ; + rdfs:label "values with shape count" ; + sh:parameter [ + sh:path sh:arg1 ; + sh:class rdfs:Resource ; + sh:description "The subject to count the values of." ; + ] ; + sh:parameter [ + sh:path sh:arg2 ; + sh:class rdf:Property ; + sh:description "The property to count the values of." ; + ] ; + sh:parameter [ + sh:path sh:arg3 ; + sh:class sh:Shape ; + sh:description "The shape to validate." ; + ] ; + 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 { + { + FILTER NOT EXISTS { $arg1 $arg2 ?value } + BIND (0 AS ?s) + } + UNION { + FILTER EXISTS { $arg1 $arg2 ?value } + $arg1 $arg2 ?value . + BIND (tosh:hasShape(?value, $arg3, true) AS ?hasShape) . + BIND (IF(bound(?hasShape), IF(?hasShape, 1, 0), 'error') AS ?s) . + } + } + """ ; +. +tosh:viewWidget + rdfs:range swa:ObjectViewerClass ; +. +rdf: + tosh:systemNamespace "true"^^xsd:boolean ; +. +rdfs: + tosh:systemNamespace "true"^^xsd:boolean ; +. +xsd: + tosh:systemNamespace "true"^^xsd:boolean ; +. +owl: + tosh:systemNamespace "true"^^xsd:boolean ; +. +sh: + tosh:systemNamespace "true"^^xsd:boolean ; +. +sh:AndConstraintComponent + sh:nodeValidator [ + rdf:type sh:SPARQLSelectValidator ; + sh:prefixes <http://topbraid.org/tosh> ; + sh:select """ + SELECT $this ?failure ($this AS ?value) + WHERE { + BIND (tosh:countShapesWithMatchResult($this, $and, $shapesGraph, false) AS ?count) + BIND (!bound(?count) AS ?failure) . + FILTER IF(?failure, true, ?count > 0) . + } +""" ; + ] ; + sh:propertyValidator [ + rdf:type sh:SPARQLSelectValidator ; + sh:prefixes <http://topbraid.org/tosh> ; + sh:select """ + SELECT DISTINCT $this ?value ?failure + WHERE { + $this $PATH ?value . + BIND (tosh:countShapesWithMatchResult(?value, $and, $shapesGraph, false) AS ?count) + BIND (!bound(?count) AS ?failure) . + FILTER IF(?failure, true, ?count > 0) . + } +""" ; + ] ; +. +sh:AndConstraintComponent-and + tosh:editWidget swa:SourceCodeEditor ; + tosh:viewWidget swa:SourceCodeViewer ; + sh:group tosh:ComplexConstraintPropertyGroup ; + sh:order 11 ; +. +sh:ClassConstraintComponent + dash:propertySuggestionGenerator tosh:DeleteTripleSuggestionGenerator ; +. +sh:ClassConstraintComponent-class + sh:group tosh:ValueTypeConstraintPropertyGroup ; + sh:order 2 ; +. +sh:ClosedConstraintComponent-closed + sh:group tosh:OtherConstraintPropertyGroup ; + sh:order "0"^^xsd:decimal ; +. +sh:ClosedConstraintComponent-ignoredProperties + sh:group tosh:OtherConstraintPropertyGroup ; + sh:order "1"^^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 . +} +INSERT { + $focusNode $predicate ?newValue . +} +WHERE { + BIND (spif:invoke($datatype, str($value)) AS ?newValue) . + FILTER bound(?newValue) . +}""" ; + ] ; + dash:propertySuggestionGenerator [ + 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 +} +INSERT { + $subject $predicate ?newObject . +} +WHERE { + { + FILTER (datatype($object) = xsd:dateTime && $datatype = xsd:date) . + } + BIND (xsd:date(substr(str($object), 1, 10)) AS ?newObject) . + FILTER bound(?newObject) . +}""" ; + ] ; + sh:validator tosh:hasDatatype ; +. +sh:DatatypeConstraintComponent-datatype + tosh:editWidget <http://topbraid.org/tosh.ui#DatatypeEditor> ; + sh:class rdfs:Datatype ; + sh:group tosh:ValueTypeConstraintPropertyGroup ; + sh:maxCount 1 ; + sh:order 1 ; +. +sh:DisjointConstraintComponent-disjoint + sh:deactivated "true"^^xsd:boolean ; + sh:group tosh:PropertyPairConstraintPropertyGroup ; + sh:order 1 ; +. +sh:EqualsConstraintComponent-equals + sh:deactivated "true"^^xsd:boolean ; + sh:group tosh:PropertyPairConstraintPropertyGroup ; + sh:order 0 ; +. +sh:HasValueConstraintComponent + dash:propertySuggestionGenerator [ + rdf:type dash:SPARQLUpdateSuggestionGenerator ; + sh:message "Add {$hasValue} to the existing values" ; + sh:update """INSERT { + $focusNode $predicate $hasValue . +} +WHERE { +}""" ; + ] ; + sh:property [ + sh:path sh:hasValue ; + tosh:editWidget <http://topbraid.org/tosh.ui#UseDeclaredDatatypeEditor> ; + tosh:useDeclaredDatatype "true"^^xsd:boolean ; + ] ; +. +sh:HasValueConstraintComponent-hasValue + sh:group tosh:OtherConstraintPropertyGroup ; +. +sh:InConstraintComponent + dash:propertySuggestionGenerator tosh:DeleteTripleSuggestionGenerator ; + dash:propertySuggestionGenerator [ + rdf:type dash:SPARQLUpdateSuggestionGenerator ; + sh:message "Replace invalid value with {$newObject}" ; + sh:order 2 ; + sh:prefixes <http://topbraid.org/tosh> ; + sh:select """SELECT ?newObject +WHERE { + $in <http://jena.hpl.hp.com/ARQ/list#index> (?index ?newObject ) . +} +ORDER BY ?index""" ; + sh:update """DELETE { + $focusNode $predicate $value . +} +INSERT { + $focusNode $predicate $newObject . +} +WHERE { +}""" ; + ] ; +. +sh:InConstraintComponent-in + sh:group tosh:OtherConstraintPropertyGroup ; +. +sh:JSConstraint-js + sh:group tosh:ComplexConstraintPropertyGroup ; +. +sh:LanguageInConstraintComponent + dash:propertySuggestionGenerator tosh:DeleteTripleSuggestionGenerator ; +. +sh:LanguageInConstraintComponent-languageIn + sh:group tosh:StringBasedConstraintPropertyGroup ; + sh:order "9"^^xsd:decimal ; +. +sh:LessThanConstraintComponent-lessThan + sh:deactivated "true"^^xsd:boolean ; + sh:group tosh:PropertyPairConstraintPropertyGroup ; + sh:order 2 ; +. +sh:LessThanOrEqualsConstraintComponent-lessThanOrEquals + sh:deactivated "true"^^xsd:boolean ; + sh:group tosh:PropertyPairConstraintPropertyGroup ; + sh:order 3 ; +. +sh:MaxCountConstraintComponent-maxCount + sh:group tosh:CardinalityConstraintPropertyGroup ; + sh:order 1 ; +. +sh:MaxExclusiveConstraintComponent-maxExclusive + tosh:editWidget <http://topbraid.org/tosh.ui#UseDeclaredDatatypeEditor> ; + tosh:useDeclaredDatatype "true"^^xsd:boolean ; + sh:group tosh:ValueRangeConstraintPropertyGroup ; + sh:order 3 ; +. +sh:MaxInclusiveConstraintComponent + dash:propertySuggestionGenerator [ + rdf:type dash:SPARQLUpdateSuggestionGenerator ; + sh:message "Replace the invalid value with {$maxInclusive}" ; + sh:update """DELETE { + $subject $predicate $object . +} +INSERT { + $subject $predicate $maxInclusive . +} +WHERE { +}""" ; + ] ; +. +sh:MaxInclusiveConstraintComponent-maxInclusive + tosh:editWidget <http://topbraid.org/tosh.ui#UseDeclaredDatatypeEditor> ; + tosh:useDeclaredDatatype "true"^^xsd:boolean ; + sh:group tosh:ValueRangeConstraintPropertyGroup ; + sh:order 2 ; +. +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 . +} +INSERT { + $focusNode $predicate $newValue . +} +WHERE { + FILTER (isLiteral($value) && datatype($value) = xsd:string) . + BIND (SUBSTR($value, 1, $maxLength) AS ?newValue) . +}""" ; + ] ; +. +sh:MaxLengthConstraintComponent-maxLength + sh:group tosh:StringBasedConstraintPropertyGroup ; + sh:order 4 ; +. +sh:MinCountConstraintComponent-minCount + sh:group tosh:CardinalityConstraintPropertyGroup ; + sh:order 0 ; +. +sh:MinExclusiveConstraintComponent-minExclusive + tosh:editWidget <http://topbraid.org/tosh.ui#UseDeclaredDatatypeEditor> ; + tosh:useDeclaredDatatype "true"^^xsd:boolean ; + sh:group tosh:ValueRangeConstraintPropertyGroup ; + sh:order 0 ; +. +sh:MinInclusiveConstraintComponent + dash:propertySuggestionGenerator [ + rdf:type dash:SPARQLUpdateSuggestionGenerator ; + sh:message "Replace the invalid value with {$minInclusive}" ; + sh:update """DELETE { + $subject $predicate $object . +} +INSERT { + $subject $predicate $minInclusive . +} +WHERE { +}""" ; + ] ; +. +sh:MinInclusiveConstraintComponent-minInclusive + tosh:editWidget <http://topbraid.org/tosh.ui#UseDeclaredDatatypeEditor> ; + tosh:useDeclaredDatatype "true"^^xsd:boolean ; + sh:group tosh:ValueRangeConstraintPropertyGroup ; + sh:order 1 ; +. +sh:MinLengthConstraintComponent-minLength + sh:group tosh:StringBasedConstraintPropertyGroup ; + sh:order 3 ; +. +sh:NodeConstraintComponent + sh:nodeValidator [ + rdf:type sh:SPARQLSelectValidator ; + sh:prefixes <http://topbraid.org/tosh> ; + sh:select """ + SELECT $this ($this AS $value) ?failure + WHERE { + BIND (tosh:hasShape($this, $node) AS ?hasShape) . + BIND (!bound(?hasShape) AS ?failure) . + FILTER (?failure || !?hasShape) . + } + """ ; + ] ; + sh:propertyValidator [ + rdf:type sh:SPARQLSelectValidator ; + sh:prefixes <http://topbraid.org/tosh> ; + sh:select """ + SELECT DISTINCT $this ?value ?failure + WHERE { + $this $PATH ?value . + BIND (tosh:hasShape(?value, $node) AS ?hasShape) . + BIND (!bound(?hasShape) AS ?failure) . + FILTER (?failure || !?hasShape) . + } + """ ; + ] ; +. +sh:NodeConstraintComponent-node + tosh:editWidget swa:SourceCodeEditor ; + tosh:viewWidget swa:SourceCodeViewer ; + sh:group tosh:ComplexConstraintPropertyGroup ; + sh:order 0 ; +. +sh:NodeKindConstraintComponent-nodeKind + tosh:editWidget <http://topbraid.org/tosh.ui#NodeKindEditor> ; + sh:group tosh:ValueTypeConstraintPropertyGroup ; + sh:name "value kinds" ; + sh:order 0 ; +. +sh:NotConstraintComponent + sh:nodeValidator [ + rdf:type sh:SPARQLSelectValidator ; + sh:prefixes <http://topbraid.org/tosh> ; + sh:select """ + SELECT $this ($this AS ?value) ?failure + WHERE { + BIND (tosh:hasShape($this, $not) AS ?hasShape) . + BIND (!bound(?hasShape) AS ?failure) . + FILTER (?failure || ?hasShape) . + } + """ ; + ] ; + sh:propertyValidator [ + rdf:type sh:SPARQLSelectValidator ; + sh:prefixes <http://topbraid.org/tosh> ; + sh:select """ + SELECT DISTINCT $this ?value ?failure + WHERE { + $this $PATH ?value . + BIND (tosh:hasShape(?value, $not) AS ?hasShape) . + BIND (!bound(?hasShape) AS ?failure) . + FILTER (?failure || ?hasShape) . + } + """ ; + ] ; +. +sh:NotConstraintComponent-not + tosh:editWidget swa:SourceCodeEditor ; + tosh:viewWidget swa:SourceCodeViewer ; + sh:group tosh:ComplexConstraintPropertyGroup ; + sh:order 10 ; +. +sh:OrConstraintComponent + sh:nodeValidator [ + rdf:type sh:SPARQLSelectValidator ; + sh:message "Focus node has none of the shapes from the 'or' list" ; + sh:prefixes <http://topbraid.org/tosh> ; + sh:select """ + SELECT $this ?failure ($this AS ?value) + WHERE { + BIND (tosh:countShapesWithMatchResult($this, $or, $shapesGraph, true) AS ?count) + BIND (!bound(?count) AS ?failure) . + FILTER IF(?failure, true, ?count = 0) . + } +""" ; + ] ; + sh:propertyValidator [ + rdf:type sh:SPARQLSelectValidator ; + sh:message "Value has none of the shapes from the 'or' list" ; + sh:prefixes <http://topbraid.org/tosh> ; + sh:select """ + SELECT DISTINCT $this ?value ?failure + WHERE { + $this $PATH ?value . + BIND (tosh:countShapesWithMatchResult(?value, $or, $shapesGraph, true) AS ?count) + BIND (!bound(?count) AS ?failure) . + FILTER IF(?failure, true, ?count = 0) . + } +""" ; + ] ; +. +sh:OrConstraintComponent-or + tosh:editWidget swa:SourceCodeEditor ; + tosh:viewWidget swa:SourceCodeViewer ; + sh:group tosh:ComplexConstraintPropertyGroup ; + sh:order 12 ; +. +sh:PatternConstraintComponent-flags + tosh:editWidget <http://topbraid.org/tosh.ui#FlagsEditor> ; + sh:group tosh:StringBasedConstraintPropertyGroup ; + sh:maxCount 1 ; + sh:name "regex flags" ; +. +sh:PatternConstraintComponent-pattern + tosh:editWidget swa:PlainTextFieldEditor ; + sh:group tosh:StringBasedConstraintPropertyGroup ; + sh:maxCount 1 ; + sh:name "regex pattern" ; + sh:sparql [ + sh:prefixes <http://topbraid.org/tosh> ; + sh:select """SELECT $this ?value ?message +WHERE { + $this $PATH ?value . + BIND (spif:checkRegexSyntax(?value) AS ?error) . + FILTER bound(?error) . + BIND (CONCAT(\"Malformed pattern: \", ?error) AS ?message) . +}""" ; + ] ; +. +sh:QualifiedMaxCountConstraintComponent-qualifiedMaxCount + sh:group tosh:ComplexConstraintPropertyGroup ; + sh:maxCount 1 ; + sh:order 3 ; +. +sh:QualifiedMinCountConstraintComponent-qualifiedMinCount + sh:group tosh:ComplexConstraintPropertyGroup ; + sh:maxCount 1 ; + sh:order 2 ; +. +sh:QualifiedMinCountConstraintComponent-qualifiedValueShape + tosh:editWidget swa:SourceCodeEditor ; + tosh:viewWidget swa:SourceCodeViewer ; + sh:group tosh:ComplexConstraintPropertyGroup ; + sh:maxCount 1 ; + sh:order 1 ; +. +sh:UniqueLangConstraintComponent-uniqueLang + sh:group tosh:StringBasedConstraintPropertyGroup ; + sh:order 8 ; +. +sh:XoneConstraintComponent + sh:nodeValidator [ + rdf:type sh:SPARQLSelectValidator ; + sh:message "Focus node has {?count} of the shapes from the 'exactly one' list" ; + sh:prefixes <http://topbraid.org/tosh> ; + sh:select """ + SELECT $this ?failure ?count ($this AS ?value) + WHERE { + BIND (tosh:countShapesWithMatchResult($this, $xone, $shapesGraph, true) AS ?count) + BIND (!bound(?count) AS ?failure) . + FILTER IF(?failure, true, ?count != 1) . + } +""" ; + ] ; + sh:propertyValidator [ + rdf:type sh:SPARQLSelectValidator ; + sh:message "Value node has {?count} of the shapes from the 'exactly one' list" ; + sh:prefixes <http://topbraid.org/tosh> ; + sh:select """ + SELECT DISTINCT $this ?value ?failure ?count + WHERE { + $this $PATH ?value . + BIND (tosh:countShapesWithMatchResult(?value, $xone, $shapesGraph, true) AS ?count) + BIND (!bound(?count) AS ?failure) . + FILTER IF(?failure, true, ?count != 1) . + } +""" ; + ] ; +. +sh:XoneConstraintComponent-xone + tosh:editWidget swa:SourceCodeEditor ; + tosh:viewWidget swa:SourceCodeViewer ; + sh:group tosh:ComplexConstraintPropertyGroup ; + sh:order 13 ; +.
972
Adding test infrastructure
0
.ttl
ttl
apache-2.0
TopQuadrant/shacl
135
<NME> tosh.ttl <BEF> ADDFILE <MSG> Adding test infrastructure <DFF> @@ -0,0 +1,972 @@ +# baseURI: http://topbraid.org/tosh +# imports: http://datashapes.org/dash +# prefix: tosh + +@prefix dash: <http://datashapes.org/dash#> . +@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"^^xsd:boolean ; +. +dash:ClosedByTypesConstraintComponent-closedByTypes + sh:group tosh:OtherConstraintPropertyGroup ; +. +dash:NonRecursiveConstraintComponent + dash:propertySuggestionGenerator tosh:DeleteTripleSuggestionGenerator ; + sh:property [ + sh:path dash:nonRecursive ; + sh:group tosh:RelationshipPropertyGroup ; + ] ; +. +dash:RootClassConstraintComponent + dash:propertySuggestionGenerator tosh:DeleteTripleSuggestionGenerator ; +. +dash:StemConstraintComponent-stem + sh:group tosh:StringBasedConstraintPropertyGroup ; +. +<http://spinrdf.org/sp#> + tosh:systemNamespace "true"^^xsd:boolean ; +. +<http://spinrdf.org/spin#> + tosh:systemNamespace "true"^^xsd:boolean ; +. +<http://spinrdf.org/spl#> + tosh:systemNamespace "true"^^xsd:boolean ; +. +<http://topbraid.org/tosh> + rdf:type owl:Ontology ; + rdfs:comment """A collection of SHACL features that are used whenever SHACL graphs are used within TopBraid Suite products. This includes things like suggested PropertyGroups and Shapes that control the layout of forms. Some of these may be of general use outside of TopBraid too. + +This namespace also includes the function tosh:hasShape, which can be used to implement some advanced constraint components using SPARQL only.""" ; + rdfs:label "TopBraid Data Shapes Library" ; + owl:imports <http://datashapes.org/dash> ; + sh:declare [ + rdf:type sh:PrefixDeclaration ; + sh:namespace "http://jena.hpl.hp.com/ARQ/function#"^^xsd:anyURI ; + sh:prefix "afn" ; + ] ; + sh:declare [ + rdf:type sh:PrefixDeclaration ; + 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 ; + sh:prefix "tosh" ; + ] ; +. +tosh: + tosh:systemNamespace "true"^^xsd:boolean ; +. +tosh:AboutPropertyGroup + rdf:type sh:PropertyGroup ; + rdfs:label "This Shape" ; + sh:order 0 ; +. +tosh:CardinalityConstraintPropertyGroup + rdf:type sh:PropertyGroup ; + rdfs:label "Cardinality" ; + sh:order 2 ; +. +tosh:ComplexConstraintPropertyGroup + rdf:type sh:PropertyGroup ; + tosh:openable "true"^^xsd:boolean ; + rdfs:label "Complex Constraints" ; + sh:order 9 ; +. +tosh:ConstraintMetadataPropertyGroup + rdf:type sh:PropertyGroup ; + rdfs:label "Constraint Metadata" ; +. +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 + 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 + rdf:type 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 [ + rdf:type sh:SPARQLSelectValidator ; + sh:message "List member {?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 + rdf:type 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:OtherConstraintPropertyGroup + rdf:type sh:PropertyGroup ; + tosh:openable "true"^^xsd:boolean ; + rdfs:label "Other Constraints" ; + sh:order 10 ; +. +tosh:PropertyPairConstraintPropertyGroup + rdf:type sh:PropertyGroup ; + tosh:openable "true"^^xsd:boolean ; + rdfs:label "Property Pairs" ; + sh:order 6 ; +. +tosh:PropertyShapeShape + rdf:type sh:NodeShape ; + rdfs:label "Property shape shape" ; + sh:property [ + sh:path tosh:editWidget ; + tosh:editWidget <http://topbraid.org/swaeditor#WidgetDropDownEditor> ; + tosh:viewWidget swa:ResourceInUIGraphViewer ; + sh:description "The swa:ObjectEditorClass that shall be used to edit values of this predicate." ; + sh:group tosh:DisplayPropertyGroup ; + sh:maxCount 1 ; + sh:name "edit widget" ; + sh:nodeKind sh:IRI ; + sh:order 21 ; + ] ; + sh:property [ + sh:path tosh:searchWidget ; + tosh:editWidget <http://topbraid.org/swaeditor#WidgetDropDownEditor> ; + tosh:viewWidget swa:ResourceInUIGraphViewer ; + sh:description "The swa:ObjectFacetClass that shall be used to search for values of this predicate." ; + sh:group tosh:DisplayPropertyGroup ; + sh:maxCount 1 ; + sh:name "search widget" ; + sh:nodeKind sh:IRI ; + sh:order 22 ; + ] ; + sh:property [ + sh:path tosh:viewWidget ; + tosh:editWidget <http://topbraid.org/swaeditor#WidgetDropDownEditor> ; + tosh:viewWidget swa:ResourceInUIGraphViewer ; + sh:description "The swa:ObjectViewerClass that shall be used to view values of this predicate." ; + sh:group tosh:DisplayPropertyGroup ; + sh:maxCount 1 ; + sh:name "view widget" ; + sh:nodeKind sh:IRI ; + sh:order 20 ; + ] ; + sh:property [ + sh:path sh:defaultValue ; + tosh:editWidget <http://topbraid.org/tosh.ui#UseDeclaredDatatypeEditor> ; + tosh:useDeclaredDatatype "true"^^xsd:boolean ; + sh:description "The default value to be used for this property at new instances." ; + sh:group tosh:ValueTypeConstraintPropertyGroup ; + ] ; + sh:property [ + sh:path sh:description ; + tosh:editWidget swa:TextAreaEditor ; + sh:description "A human-readable description of the role of the property in the constraint." ; + sh:group tosh:DisplayPropertyGroup ; + sh:name "description" ; + sh:order 2 ; + ] ; + sh:property [ + sh:path sh:group ; + sh:description "The sh:PropertyGroup that the property belongs to." ; + sh:group tosh:DisplayPropertyGroup ; + sh:maxCount 1 ; + sh:name "group" ; + sh:order 10 ; + ] ; + sh:property [ + sh:path sh:name ; + tosh:editWidget swa:TextFieldEditorWithLang ; + sh:description "The display name of the property." ; + sh:group tosh:DisplayPropertyGroup ; + sh:name "name" ; + sh:order 1 ; + ] ; + sh:property [ + sh:path sh:order ; + sh:description "The relative position of the property among its peers, e.g. a property with order 5 shows up before one with order 6." ; + sh:group tosh:DisplayPropertyGroup ; + sh:maxCount 1 ; + sh:name "order" ; + sh:order 11 ; + ] ; + sh:property [ + sh:path sh:path ; + sh:group tosh:AboutPropertyGroup ; + sh:maxCount 1 ; + sh:name "on property" ; + sh:order 0 ; + ] ; + sh:targetClass sh:PropertyShape ; +. +tosh:RelationshipPropertyGroup + rdf:type sh:PropertyGroup ; + tosh:openable "true"^^xsd:boolean ; + rdfs:label "Relationship" ; + sh:order 8 ; +. +tosh:ShapeShape + rdf:type sh:NodeShape ; + rdfs:label "Shape of shapes" ; + sh:property tosh:ShapeShape-deactivated ; + sh:property tosh:ShapeShape-severity ; + sh:targetClass sh:Shape ; +. +tosh:ShapeShape-deactivated + rdf:type sh:PropertyShape ; + sh:path sh:deactivated ; + sh:description "Can be used to deactivate the whole constraint." ; + sh:group tosh:AboutPropertyGroup ; + sh:maxCount 1 ; + sh:name "deactivated" ; + sh:order "1"^^xsd:decimal ; +. +tosh:ShapeShape-severity + rdf:type sh:PropertyShape ; + sh:path sh:severity ; + tosh:editWidget swa:InstancesSelectEditor ; + sh:class sh:Severity ; + sh:description "The severity to be used for validation results produced by the associated constraint." ; + sh:group tosh:AboutPropertyGroup ; + sh:maxCount 1 ; + sh:name "severity" ; + sh:order "2"^^xsd:decimal ; +. +tosh:StringBasedConstraintPropertyGroup + rdf:type sh:PropertyGroup ; + tosh:openable "true"^^xsd:boolean ; + rdfs:label "String Constraints" ; + sh:order 7 ; +. +tosh:SystemNamespaceShape + rdf:type 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 [ + rdf:type 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:UseDeclaredDatatypeConstraintComponent + rdf:type sh:ConstraintComponent ; + 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 . +} +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 [ + 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 [ + rdf:type sh:SPARQLSelectValidator ; + sh:message "Datatype must match the declared datatype {?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:ValueRangeConstraintPropertyGroup + rdf:type sh:PropertyGroup ; + tosh:openable "true"^^xsd:boolean ; + rdfs:label "Value Range" ; + sh:order 5 ; +. +tosh:ValueTypeConstraintPropertyGroup + rdf:type sh:PropertyGroup ; + rdfs:comment "A property group for constraint parameters that restrict the value types of values." ; + rdfs:label "Value Type" ; + sh:order 3 ; +. +tosh:countShapesWithMatchResult + rdf:type 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 [ + sh:path sh:expectedValue ; + sh:datatype xsd:boolean ; + sh:description "The expected value of tosh:hasShape to count." ; + sh:order 3 ; + ] ; + sh:parameter [ + sh:path sh:focusNode ; + sh:class rdfs:Resource ; + sh:description "The focus node." ; + sh:order 0 ; + ] ; + sh:parameter [ + sh:path sh:shapes ; + sh:class rdf:List ; + sh:description "The list of shapes to walk through." ; + sh:order 1 ; + ] ; + sh:parameter [ + sh:path sh:shapesGraph ; + sh:class rdfs:Resource ; + sh:description "The shapes graph." ; + sh:order 2 ; + ] ; + 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:editWidget + 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." ; + rdfs:label "has datatype" ; + sh:ask """ + ASK { + FILTER (datatype($value) = $datatype && spif:isValidForDatatype($value, $datatype)) . + } + """ ; + sh:prefixes <http://topbraid.org/tosh> ; +. +tosh:hasShape + rdf:type sh:Function ; + 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 [ + sh:path tosh:node ; + sh:description "The node to validate." ; + ] ; + sh:parameter [ + sh:path tosh:shape ; + sh:description "The shape that the node is supposed to have." ; + ] ; + sh:returnType xsd:boolean ; +. +tosh:open + rdf:type rdf:Property ; + rdfs:comment "If set to true, then the corresponding form section will be open by default. This only has an effect if sh:openable is set to true as well." ; + rdfs:domain sh:PropertyGroup ; + rdfs:label "open" ; + rdfs:range xsd:boolean ; +. +tosh:openable + rdf:type rdf:Property ; + rdfs:comment "If set to true, then the corresponding form section shall be openable/closable (and show up closed)." ; + rdfs:domain sh:PropertyGroup ; + rdfs:label "openable" ; + rdfs:range xsd:boolean ; +. +tosh:searchWidget + rdfs:range swa:ObjectFacetClass ; +. +tosh:shaclExists + rdf:type sh:Function ; + rdfs:comment "Checks whether the current query graph has SHACL activated, i.e. imports the triples typically found in the SHACL namespace. This is currently relying on an approximation, only certain triples, and is natively implemented for TopBraid. Future versions may expose the actual logic as a SPARQL query." ; + 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." ; + rdfs:label "system namespace" ; + rdfs:range xsd:boolean ; +. +tosh:validatorForContext + rdf:type sh:SPARQLFunction ; + rdfs:comment "Gets a suitable validator for a given context, following the resolution rules from the spec." ; + rdfs:label "validator for context" ; + sh:parameter [ + sh:path tosh:component ; + sh:class sh:ConstraintComponent ; + sh:description "The constraint component." ; + sh:name "component" ; + ] ; + sh:parameter [ + sh:path tosh:context ; + sh:class rdfs:Class ; + sh:description "The context, e.g. sh:PropertyShape." ; + sh:name "context" ; + ] ; + sh:prefixes <http://topbraid.org/tosh> ; + sh:returnType sh:Validator ; + sh:select """ + SELECT ?validator + WHERE { + { + BIND (IF($context = sh:PropertyShape, sh:propertyValidator, sh:nodeValidator) AS ?predicate) . + } + OPTIONAL { + $component ?predicate ?specialized . + } + OPTIONAL { + $component sh:validator ?default . + } + BIND (COALESCE(?specialized, ?default) AS ?validator) . + }""" ; +. +tosh:valuesWithShapeCount + rdf:type sh:SPARQLFunction ; + rdfs:comment "Counts the number of values from a given subject (?arg1) / predicate (?arg2) combination that do not produce any error-level constraint violations for a given shape (?arg3) in a given shapes graph (?arg4). The function produces an error if one of the shapes validated to a fatal error." ; + rdfs:label "values with shape count" ; + sh:parameter [ + sh:path sh:arg1 ; + sh:class rdfs:Resource ; + sh:description "The subject to count the values of." ; + ] ; + sh:parameter [ + sh:path sh:arg2 ; + sh:class rdf:Property ; + sh:description "The property to count the values of." ; + ] ; + sh:parameter [ + sh:path sh:arg3 ; + sh:class sh:Shape ; + sh:description "The shape to validate." ; + ] ; + 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 { + { + FILTER NOT EXISTS { $arg1 $arg2 ?value } + BIND (0 AS ?s) + } + UNION { + FILTER EXISTS { $arg1 $arg2 ?value } + $arg1 $arg2 ?value . + BIND (tosh:hasShape(?value, $arg3, true) AS ?hasShape) . + BIND (IF(bound(?hasShape), IF(?hasShape, 1, 0), 'error') AS ?s) . + } + } + """ ; +. +tosh:viewWidget + rdfs:range swa:ObjectViewerClass ; +. +rdf: + tosh:systemNamespace "true"^^xsd:boolean ; +. +rdfs: + tosh:systemNamespace "true"^^xsd:boolean ; +. +xsd: + tosh:systemNamespace "true"^^xsd:boolean ; +. +owl: + tosh:systemNamespace "true"^^xsd:boolean ; +. +sh: + tosh:systemNamespace "true"^^xsd:boolean ; +. +sh:AndConstraintComponent + sh:nodeValidator [ + rdf:type sh:SPARQLSelectValidator ; + sh:prefixes <http://topbraid.org/tosh> ; + sh:select """ + SELECT $this ?failure ($this AS ?value) + WHERE { + BIND (tosh:countShapesWithMatchResult($this, $and, $shapesGraph, false) AS ?count) + BIND (!bound(?count) AS ?failure) . + FILTER IF(?failure, true, ?count > 0) . + } +""" ; + ] ; + sh:propertyValidator [ + rdf:type sh:SPARQLSelectValidator ; + sh:prefixes <http://topbraid.org/tosh> ; + sh:select """ + SELECT DISTINCT $this ?value ?failure + WHERE { + $this $PATH ?value . + BIND (tosh:countShapesWithMatchResult(?value, $and, $shapesGraph, false) AS ?count) + BIND (!bound(?count) AS ?failure) . + FILTER IF(?failure, true, ?count > 0) . + } +""" ; + ] ; +. +sh:AndConstraintComponent-and + tosh:editWidget swa:SourceCodeEditor ; + tosh:viewWidget swa:SourceCodeViewer ; + sh:group tosh:ComplexConstraintPropertyGroup ; + sh:order 11 ; +. +sh:ClassConstraintComponent + dash:propertySuggestionGenerator tosh:DeleteTripleSuggestionGenerator ; +. +sh:ClassConstraintComponent-class + sh:group tosh:ValueTypeConstraintPropertyGroup ; + sh:order 2 ; +. +sh:ClosedConstraintComponent-closed + sh:group tosh:OtherConstraintPropertyGroup ; + sh:order "0"^^xsd:decimal ; +. +sh:ClosedConstraintComponent-ignoredProperties + sh:group tosh:OtherConstraintPropertyGroup ; + sh:order "1"^^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 . +} +INSERT { + $focusNode $predicate ?newValue . +} +WHERE { + BIND (spif:invoke($datatype, str($value)) AS ?newValue) . + FILTER bound(?newValue) . +}""" ; + ] ; + dash:propertySuggestionGenerator [ + 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 +} +INSERT { + $subject $predicate ?newObject . +} +WHERE { + { + FILTER (datatype($object) = xsd:dateTime && $datatype = xsd:date) . + } + BIND (xsd:date(substr(str($object), 1, 10)) AS ?newObject) . + FILTER bound(?newObject) . +}""" ; + ] ; + sh:validator tosh:hasDatatype ; +. +sh:DatatypeConstraintComponent-datatype + tosh:editWidget <http://topbraid.org/tosh.ui#DatatypeEditor> ; + sh:class rdfs:Datatype ; + sh:group tosh:ValueTypeConstraintPropertyGroup ; + sh:maxCount 1 ; + sh:order 1 ; +. +sh:DisjointConstraintComponent-disjoint + sh:deactivated "true"^^xsd:boolean ; + sh:group tosh:PropertyPairConstraintPropertyGroup ; + sh:order 1 ; +. +sh:EqualsConstraintComponent-equals + sh:deactivated "true"^^xsd:boolean ; + sh:group tosh:PropertyPairConstraintPropertyGroup ; + sh:order 0 ; +. +sh:HasValueConstraintComponent + dash:propertySuggestionGenerator [ + rdf:type dash:SPARQLUpdateSuggestionGenerator ; + sh:message "Add {$hasValue} to the existing values" ; + sh:update """INSERT { + $focusNode $predicate $hasValue . +} +WHERE { +}""" ; + ] ; + sh:property [ + sh:path sh:hasValue ; + tosh:editWidget <http://topbraid.org/tosh.ui#UseDeclaredDatatypeEditor> ; + tosh:useDeclaredDatatype "true"^^xsd:boolean ; + ] ; +. +sh:HasValueConstraintComponent-hasValue + sh:group tosh:OtherConstraintPropertyGroup ; +. +sh:InConstraintComponent + dash:propertySuggestionGenerator tosh:DeleteTripleSuggestionGenerator ; + dash:propertySuggestionGenerator [ + rdf:type dash:SPARQLUpdateSuggestionGenerator ; + sh:message "Replace invalid value with {$newObject}" ; + sh:order 2 ; + sh:prefixes <http://topbraid.org/tosh> ; + sh:select """SELECT ?newObject +WHERE { + $in <http://jena.hpl.hp.com/ARQ/list#index> (?index ?newObject ) . +} +ORDER BY ?index""" ; + sh:update """DELETE { + $focusNode $predicate $value . +} +INSERT { + $focusNode $predicate $newObject . +} +WHERE { +}""" ; + ] ; +. +sh:InConstraintComponent-in + sh:group tosh:OtherConstraintPropertyGroup ; +. +sh:JSConstraint-js + sh:group tosh:ComplexConstraintPropertyGroup ; +. +sh:LanguageInConstraintComponent + dash:propertySuggestionGenerator tosh:DeleteTripleSuggestionGenerator ; +. +sh:LanguageInConstraintComponent-languageIn + sh:group tosh:StringBasedConstraintPropertyGroup ; + sh:order "9"^^xsd:decimal ; +. +sh:LessThanConstraintComponent-lessThan + sh:deactivated "true"^^xsd:boolean ; + sh:group tosh:PropertyPairConstraintPropertyGroup ; + sh:order 2 ; +. +sh:LessThanOrEqualsConstraintComponent-lessThanOrEquals + sh:deactivated "true"^^xsd:boolean ; + sh:group tosh:PropertyPairConstraintPropertyGroup ; + sh:order 3 ; +. +sh:MaxCountConstraintComponent-maxCount + sh:group tosh:CardinalityConstraintPropertyGroup ; + sh:order 1 ; +. +sh:MaxExclusiveConstraintComponent-maxExclusive + tosh:editWidget <http://topbraid.org/tosh.ui#UseDeclaredDatatypeEditor> ; + tosh:useDeclaredDatatype "true"^^xsd:boolean ; + sh:group tosh:ValueRangeConstraintPropertyGroup ; + sh:order 3 ; +. +sh:MaxInclusiveConstraintComponent + dash:propertySuggestionGenerator [ + rdf:type dash:SPARQLUpdateSuggestionGenerator ; + sh:message "Replace the invalid value with {$maxInclusive}" ; + sh:update """DELETE { + $subject $predicate $object . +} +INSERT { + $subject $predicate $maxInclusive . +} +WHERE { +}""" ; + ] ; +. +sh:MaxInclusiveConstraintComponent-maxInclusive + tosh:editWidget <http://topbraid.org/tosh.ui#UseDeclaredDatatypeEditor> ; + tosh:useDeclaredDatatype "true"^^xsd:boolean ; + sh:group tosh:ValueRangeConstraintPropertyGroup ; + sh:order 2 ; +. +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 . +} +INSERT { + $focusNode $predicate $newValue . +} +WHERE { + FILTER (isLiteral($value) && datatype($value) = xsd:string) . + BIND (SUBSTR($value, 1, $maxLength) AS ?newValue) . +}""" ; + ] ; +. +sh:MaxLengthConstraintComponent-maxLength + sh:group tosh:StringBasedConstraintPropertyGroup ; + sh:order 4 ; +. +sh:MinCountConstraintComponent-minCount + sh:group tosh:CardinalityConstraintPropertyGroup ; + sh:order 0 ; +. +sh:MinExclusiveConstraintComponent-minExclusive + tosh:editWidget <http://topbraid.org/tosh.ui#UseDeclaredDatatypeEditor> ; + tosh:useDeclaredDatatype "true"^^xsd:boolean ; + sh:group tosh:ValueRangeConstraintPropertyGroup ; + sh:order 0 ; +. +sh:MinInclusiveConstraintComponent + dash:propertySuggestionGenerator [ + rdf:type dash:SPARQLUpdateSuggestionGenerator ; + sh:message "Replace the invalid value with {$minInclusive}" ; + sh:update """DELETE { + $subject $predicate $object . +} +INSERT { + $subject $predicate $minInclusive . +} +WHERE { +}""" ; + ] ; +. +sh:MinInclusiveConstraintComponent-minInclusive + tosh:editWidget <http://topbraid.org/tosh.ui#UseDeclaredDatatypeEditor> ; + tosh:useDeclaredDatatype "true"^^xsd:boolean ; + sh:group tosh:ValueRangeConstraintPropertyGroup ; + sh:order 1 ; +. +sh:MinLengthConstraintComponent-minLength + sh:group tosh:StringBasedConstraintPropertyGroup ; + sh:order 3 ; +. +sh:NodeConstraintComponent + sh:nodeValidator [ + rdf:type sh:SPARQLSelectValidator ; + sh:prefixes <http://topbraid.org/tosh> ; + sh:select """ + SELECT $this ($this AS $value) ?failure + WHERE { + BIND (tosh:hasShape($this, $node) AS ?hasShape) . + BIND (!bound(?hasShape) AS ?failure) . + FILTER (?failure || !?hasShape) . + } + """ ; + ] ; + sh:propertyValidator [ + rdf:type sh:SPARQLSelectValidator ; + sh:prefixes <http://topbraid.org/tosh> ; + sh:select """ + SELECT DISTINCT $this ?value ?failure + WHERE { + $this $PATH ?value . + BIND (tosh:hasShape(?value, $node) AS ?hasShape) . + BIND (!bound(?hasShape) AS ?failure) . + FILTER (?failure || !?hasShape) . + } + """ ; + ] ; +. +sh:NodeConstraintComponent-node + tosh:editWidget swa:SourceCodeEditor ; + tosh:viewWidget swa:SourceCodeViewer ; + sh:group tosh:ComplexConstraintPropertyGroup ; + sh:order 0 ; +. +sh:NodeKindConstraintComponent-nodeKind + tosh:editWidget <http://topbraid.org/tosh.ui#NodeKindEditor> ; + sh:group tosh:ValueTypeConstraintPropertyGroup ; + sh:name "value kinds" ; + sh:order 0 ; +. +sh:NotConstraintComponent + sh:nodeValidator [ + rdf:type sh:SPARQLSelectValidator ; + sh:prefixes <http://topbraid.org/tosh> ; + sh:select """ + SELECT $this ($this AS ?value) ?failure + WHERE { + BIND (tosh:hasShape($this, $not) AS ?hasShape) . + BIND (!bound(?hasShape) AS ?failure) . + FILTER (?failure || ?hasShape) . + } + """ ; + ] ; + sh:propertyValidator [ + rdf:type sh:SPARQLSelectValidator ; + sh:prefixes <http://topbraid.org/tosh> ; + sh:select """ + SELECT DISTINCT $this ?value ?failure + WHERE { + $this $PATH ?value . + BIND (tosh:hasShape(?value, $not) AS ?hasShape) . + BIND (!bound(?hasShape) AS ?failure) . + FILTER (?failure || ?hasShape) . + } + """ ; + ] ; +. +sh:NotConstraintComponent-not + tosh:editWidget swa:SourceCodeEditor ; + tosh:viewWidget swa:SourceCodeViewer ; + sh:group tosh:ComplexConstraintPropertyGroup ; + sh:order 10 ; +. +sh:OrConstraintComponent + sh:nodeValidator [ + rdf:type sh:SPARQLSelectValidator ; + sh:message "Focus node has none of the shapes from the 'or' list" ; + sh:prefixes <http://topbraid.org/tosh> ; + sh:select """ + SELECT $this ?failure ($this AS ?value) + WHERE { + BIND (tosh:countShapesWithMatchResult($this, $or, $shapesGraph, true) AS ?count) + BIND (!bound(?count) AS ?failure) . + FILTER IF(?failure, true, ?count = 0) . + } +""" ; + ] ; + sh:propertyValidator [ + rdf:type sh:SPARQLSelectValidator ; + sh:message "Value has none of the shapes from the 'or' list" ; + sh:prefixes <http://topbraid.org/tosh> ; + sh:select """ + SELECT DISTINCT $this ?value ?failure + WHERE { + $this $PATH ?value . + BIND (tosh:countShapesWithMatchResult(?value, $or, $shapesGraph, true) AS ?count) + BIND (!bound(?count) AS ?failure) . + FILTER IF(?failure, true, ?count = 0) . + } +""" ; + ] ; +. +sh:OrConstraintComponent-or + tosh:editWidget swa:SourceCodeEditor ; + tosh:viewWidget swa:SourceCodeViewer ; + sh:group tosh:ComplexConstraintPropertyGroup ; + sh:order 12 ; +. +sh:PatternConstraintComponent-flags + tosh:editWidget <http://topbraid.org/tosh.ui#FlagsEditor> ; + sh:group tosh:StringBasedConstraintPropertyGroup ; + sh:maxCount 1 ; + sh:name "regex flags" ; +. +sh:PatternConstraintComponent-pattern + tosh:editWidget swa:PlainTextFieldEditor ; + sh:group tosh:StringBasedConstraintPropertyGroup ; + sh:maxCount 1 ; + sh:name "regex pattern" ; + sh:sparql [ + sh:prefixes <http://topbraid.org/tosh> ; + sh:select """SELECT $this ?value ?message +WHERE { + $this $PATH ?value . + BIND (spif:checkRegexSyntax(?value) AS ?error) . + FILTER bound(?error) . + BIND (CONCAT(\"Malformed pattern: \", ?error) AS ?message) . +}""" ; + ] ; +. +sh:QualifiedMaxCountConstraintComponent-qualifiedMaxCount + sh:group tosh:ComplexConstraintPropertyGroup ; + sh:maxCount 1 ; + sh:order 3 ; +. +sh:QualifiedMinCountConstraintComponent-qualifiedMinCount + sh:group tosh:ComplexConstraintPropertyGroup ; + sh:maxCount 1 ; + sh:order 2 ; +. +sh:QualifiedMinCountConstraintComponent-qualifiedValueShape + tosh:editWidget swa:SourceCodeEditor ; + tosh:viewWidget swa:SourceCodeViewer ; + sh:group tosh:ComplexConstraintPropertyGroup ; + sh:maxCount 1 ; + sh:order 1 ; +. +sh:UniqueLangConstraintComponent-uniqueLang + sh:group tosh:StringBasedConstraintPropertyGroup ; + sh:order 8 ; +. +sh:XoneConstraintComponent + sh:nodeValidator [ + rdf:type sh:SPARQLSelectValidator ; + sh:message "Focus node has {?count} of the shapes from the 'exactly one' list" ; + sh:prefixes <http://topbraid.org/tosh> ; + sh:select """ + SELECT $this ?failure ?count ($this AS ?value) + WHERE { + BIND (tosh:countShapesWithMatchResult($this, $xone, $shapesGraph, true) AS ?count) + BIND (!bound(?count) AS ?failure) . + FILTER IF(?failure, true, ?count != 1) . + } +""" ; + ] ; + sh:propertyValidator [ + rdf:type sh:SPARQLSelectValidator ; + sh:message "Value node has {?count} of the shapes from the 'exactly one' list" ; + sh:prefixes <http://topbraid.org/tosh> ; + sh:select """ + SELECT DISTINCT $this ?value ?failure ?count + WHERE { + $this $PATH ?value . + BIND (tosh:countShapesWithMatchResult(?value, $xone, $shapesGraph, true) AS ?count) + BIND (!bound(?count) AS ?failure) . + FILTER IF(?failure, true, ?count != 1) . + } +""" ; + ] ; +. +sh:XoneConstraintComponent-xone + tosh:editWidget swa:SourceCodeEditor ; + tosh:viewWidget swa:SourceCodeViewer ; + sh:group tosh:ComplexConstraintPropertyGroup ; + sh:order 13 ; +.
972
Adding test infrastructure
0
.ttl
ttl
apache-2.0
TopQuadrant/shacl
136
<NME> sparql-001.test.ttl <BEF> # baseURI: http://datashapes.org/sh/tests/sparql/constraint/sparql-001.test # imports: http://datashapes.org/dash # prefix: ex @prefix dash: <http://datashapes.org/dash#> . @prefix ex: <http://datashapes.org/sh/tests/sparql/constraint/sparql-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/sparql/constraint/sparql-001.test> rdf:type owl:Ontology ; rdfs:label "Test of sparql-001" ; owl:imports <http://datashapes.org/dash> ; owl:versionInfo "Created with TopBraid Composer" ; . 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:InvalidResource1 ; sh:resultPath rdfs:label ; sh:resultSeverity sh:Violation ; sh:sourceConstraint ex:TestShape-sparql ; sh:sourceConstraintComponent sh:SPARQLConstraintComponent ; sh:sourceShape ex:TestShape ; sh:value "Invalid resource 1" ; ] ; sh:result [ rdf:type sh:ValidationResult ; sh:focusNode ex:InvalidResource2 ; sh:resultPath rdfs:label ; sh:resultSeverity sh:Violation ; sh:sourceConstraint ex:TestShape-sparql ; sh:sourceConstraintComponent sh:SPARQLConstraintComponent ; sh:sourceShape ex:TestShape ; sh:value "Invalid label 1" ; ] ; sh:result [ rdf:type sh:ValidationResult ; sh:focusNode ex:InvalidResource2 ; sh:resultPath rdfs:label ; sh:resultSeverity sh:Violation ; sh:sourceConstraint ex:TestShape-sparql ; sh:sourceConstraintComponent sh:SPARQLConstraintComponent ; sh:sourceShape ex:TestShape ; sh:value "Invalid label 2" ; ] ; rdfs:label "Invalid label 2" ; . ex:TestShape rdf:type sh:Shape ; rdfs:label "Test shape" ; sh:sparql [ sh:message "Cannot have a label" ; sh:prefixes <http://datashapes.org/sh/tests/sparql/constraint/sparql-001.test> ; sh:select """SELECT $this ?path ?value WHERE { $this ?path ?value . FILTER (?path = rdfs:label) . }""" ; ] ; sh:targetNode ex:InvalidResource1 ; sh:targetNode ex:InvalidResource2 ; sh:targetNode ex:ValidResource1 ; . ex:TestShape-sparql sh:message "Cannot have a label" ; sh:prefixes <http://datashapes.org/sh/tests/sparql/node/sparql-001.test> ; sh:select """ SELECT $this ?path ?value WHERE { $this ?path ?value . FILTER (?path = rdfs:label) . }""" ; . ex:ValidResource1 rdf:type rdfs:Resource ; . <MSG> Updated to latest SHACL TR (2017-02-02), started experimental support for SHACL-JS, upgraded to Jena 3.1.1 <DFF> @@ -1,20 +1,19 @@ -# baseURI: http://datashapes.org/sh/tests/sparql/constraint/sparql-001.test +# baseURI: http://datashapes.org/sh/tests/sparql/node/sparql-001.test # imports: http://datashapes.org/dash # prefix: ex @prefix dash: <http://datashapes.org/dash#> . -@prefix ex: <http://datashapes.org/sh/tests/sparql/constraint/sparql-001.test#> . +@prefix ex: <http://datashapes.org/sh/tests/sparql/node/sparql-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/sparql/constraint/sparql-001.test> +<http://datashapes.org/sh/tests/sparql/node/sparql-001.test> rdf:type owl:Ontology ; - rdfs:label "Test of sparql-001" ; + rdfs:label "Test of sh:sparql in node shape 001" ; owl:imports <http://datashapes.org/dash> ; - owl:versionInfo "Created with TopBraid Composer" ; . ex:GraphValidationTestCase rdf:type dash:GraphValidationTestCase ; @@ -54,16 +53,17 @@ ex:InvalidResource2 rdfs:label "Invalid label 2" ; . ex:TestShape - rdf:type sh:Shape ; + rdf:type sh:NodeShape ; rdfs:label "Test shape" ; sh:sparql [ sh:message "Cannot have a label" ; - sh:prefixes <http://datashapes.org/sh/tests/sparql/constraint/sparql-001.test> ; - sh:select """SELECT $this ?path ?value -WHERE { - $this ?path ?value . - FILTER (?path = rdfs:label) . -}""" ; + sh:prefixes <http://datashapes.org/sh/tests/sparql/node/sparql-001.test> ; + sh:select """ + SELECT $this ?path ?value + WHERE { + $this ?path ?value . + FILTER (?path = rdfs:label) . + }""" ; ] ; sh:targetNode ex:InvalidResource1 ; sh:targetNode ex:InvalidResource2 ;
12
Updated to latest SHACL TR (2017-02-02), started experimental support for SHACL-JS, upgraded to Jena 3.1.1
12
.ttl
test
apache-2.0
TopQuadrant/shacl
137
<NME> sparql-001.test.ttl <BEF> # baseURI: http://datashapes.org/sh/tests/sparql/constraint/sparql-001.test # imports: http://datashapes.org/dash # prefix: ex @prefix dash: <http://datashapes.org/dash#> . @prefix ex: <http://datashapes.org/sh/tests/sparql/constraint/sparql-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/sparql/constraint/sparql-001.test> rdf:type owl:Ontology ; rdfs:label "Test of sparql-001" ; owl:imports <http://datashapes.org/dash> ; owl:versionInfo "Created with TopBraid Composer" ; . 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:InvalidResource1 ; sh:resultPath rdfs:label ; sh:resultSeverity sh:Violation ; sh:sourceConstraint ex:TestShape-sparql ; sh:sourceConstraintComponent sh:SPARQLConstraintComponent ; sh:sourceShape ex:TestShape ; sh:value "Invalid resource 1" ; ] ; sh:result [ rdf:type sh:ValidationResult ; sh:focusNode ex:InvalidResource2 ; sh:resultPath rdfs:label ; sh:resultSeverity sh:Violation ; sh:sourceConstraint ex:TestShape-sparql ; sh:sourceConstraintComponent sh:SPARQLConstraintComponent ; sh:sourceShape ex:TestShape ; sh:value "Invalid label 1" ; ] ; sh:result [ rdf:type sh:ValidationResult ; sh:focusNode ex:InvalidResource2 ; sh:resultPath rdfs:label ; sh:resultSeverity sh:Violation ; sh:sourceConstraint ex:TestShape-sparql ; sh:sourceConstraintComponent sh:SPARQLConstraintComponent ; sh:sourceShape ex:TestShape ; sh:value "Invalid label 2" ; ] ; rdfs:label "Invalid label 2" ; . ex:TestShape rdf:type sh:Shape ; rdfs:label "Test shape" ; sh:sparql [ sh:message "Cannot have a label" ; sh:prefixes <http://datashapes.org/sh/tests/sparql/constraint/sparql-001.test> ; sh:select """SELECT $this ?path ?value WHERE { $this ?path ?value . FILTER (?path = rdfs:label) . }""" ; ] ; sh:targetNode ex:InvalidResource1 ; sh:targetNode ex:InvalidResource2 ; sh:targetNode ex:ValidResource1 ; . ex:TestShape-sparql sh:message "Cannot have a label" ; sh:prefixes <http://datashapes.org/sh/tests/sparql/node/sparql-001.test> ; sh:select """ SELECT $this ?path ?value WHERE { $this ?path ?value . FILTER (?path = rdfs:label) . }""" ; . ex:ValidResource1 rdf:type rdfs:Resource ; . <MSG> Updated to latest SHACL TR (2017-02-02), started experimental support for SHACL-JS, upgraded to Jena 3.1.1 <DFF> @@ -1,20 +1,19 @@ -# baseURI: http://datashapes.org/sh/tests/sparql/constraint/sparql-001.test +# baseURI: http://datashapes.org/sh/tests/sparql/node/sparql-001.test # imports: http://datashapes.org/dash # prefix: ex @prefix dash: <http://datashapes.org/dash#> . -@prefix ex: <http://datashapes.org/sh/tests/sparql/constraint/sparql-001.test#> . +@prefix ex: <http://datashapes.org/sh/tests/sparql/node/sparql-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/sparql/constraint/sparql-001.test> +<http://datashapes.org/sh/tests/sparql/node/sparql-001.test> rdf:type owl:Ontology ; - rdfs:label "Test of sparql-001" ; + rdfs:label "Test of sh:sparql in node shape 001" ; owl:imports <http://datashapes.org/dash> ; - owl:versionInfo "Created with TopBraid Composer" ; . ex:GraphValidationTestCase rdf:type dash:GraphValidationTestCase ; @@ -54,16 +53,17 @@ ex:InvalidResource2 rdfs:label "Invalid label 2" ; . ex:TestShape - rdf:type sh:Shape ; + rdf:type sh:NodeShape ; rdfs:label "Test shape" ; sh:sparql [ sh:message "Cannot have a label" ; - sh:prefixes <http://datashapes.org/sh/tests/sparql/constraint/sparql-001.test> ; - sh:select """SELECT $this ?path ?value -WHERE { - $this ?path ?value . - FILTER (?path = rdfs:label) . -}""" ; + sh:prefixes <http://datashapes.org/sh/tests/sparql/node/sparql-001.test> ; + sh:select """ + SELECT $this ?path ?value + WHERE { + $this ?path ?value . + FILTER (?path = rdfs:label) . + }""" ; ] ; sh:targetNode ex:InvalidResource1 ; sh:targetNode ex:InvalidResource2 ;
12
Updated to latest SHACL TR (2017-02-02), started experimental support for SHACL-JS, upgraded to Jena 3.1.1
12
.ttl
test
apache-2.0
TopQuadrant/shacl
138
<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 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 sourceShape = ResourceFactory.createProperty(NS + "sourceShape"); public final static Property sparql = ResourceFactory.createProperty(NS + "sparql"); public final static Property subject = ResourceFactory.createProperty(NS + "subject"); 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> Added sh:sourceTemplate <DFF> @@ -182,6 +182,8 @@ public class SH { public final static Property sourceShape = ResourceFactory.createProperty(NS + "sourceShape"); + public final static Property sourceTemplate = ResourceFactory.createProperty(NS + "sourceTemplate"); + public final static Property sparql = ResourceFactory.createProperty(NS + "sparql"); public final static Property subject = ResourceFactory.createProperty(NS + "subject");
2
Added sh:sourceTemplate
0
.java
java
apache-2.0
TopQuadrant/shacl
139
<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 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 sourceShape = ResourceFactory.createProperty(NS + "sourceShape"); public final static Property sparql = ResourceFactory.createProperty(NS + "sparql"); public final static Property subject = ResourceFactory.createProperty(NS + "subject"); 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> Added sh:sourceTemplate <DFF> @@ -182,6 +182,8 @@ public class SH { public final static Property sourceShape = ResourceFactory.createProperty(NS + "sourceShape"); + public final static Property sourceTemplate = ResourceFactory.createProperty(NS + "sourceTemplate"); + public final static Property sparql = ResourceFactory.createProperty(NS + "sparql"); public final static Property subject = ResourceFactory.createProperty(NS + "subject");
2
Added sh:sourceTemplate
0
.java
java
apache-2.0
TopQuadrant/shacl
140
<NME> SHResultImpl.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.model.impl; import org.apache.jena.enhanced.EnhGraph; import org.apache.jena.graph.Node; import org.apache.jena.rdf.model.RDFNode; import org.apache.jena.rdf.model.Resource; import org.topbraid.jenax.util.JenaUtil; import org.topbraid.shacl.model.SHResult; import org.topbraid.shacl.vocabulary.SH; public class SHResultImpl extends SHResourceImpl implements SHResult { public SHResultImpl(Node node, EnhGraph graph) { super(node, graph); } @Override public RDFNode getFocusNode() { return JenaUtil.getProperty(this, SH.focusNode); } @Override public String getMessage() { return JenaUtil.getStringProperty(this, SH.resultMessage); } @Override public Resource getPath() { return getPropertyResourceValue(SH.resultPath); } @Override public RDFNode getValue() { return JenaUtil.getProperty(this, SH.value); } @Override public Resource getSourceConstraint() { return JenaUtil.getResourceProperty(this, SH.sourceConstraint); } @Override public Resource getSourceConstraintComponent() { return JenaUtil.getResourceProperty(this, SH.sourceConstraintComponent); } @Override public Resource getSourceShape() { return JenaUtil.getResourceProperty(this, SH.sourceShape); } @Override public Resource getResultSeverity() { return JenaUtil.getResourceProperty(this, SH.resultSeverity); } } <MSG> Minor API clean up <DFF> @@ -50,30 +50,31 @@ public class SHResultImpl extends SHResourceImpl implements SHResult { @Override - public RDFNode getValue() { - return JenaUtil.getProperty(this, SH.value); + public Resource getSeverity() { + return getPropertyResourceValue(SH.resultSeverity); } @Override public Resource getSourceConstraint() { - return JenaUtil.getResourceProperty(this, SH.sourceConstraint); + return getPropertyResourceValue(SH.sourceConstraint); } @Override public Resource getSourceConstraintComponent() { - return JenaUtil.getResourceProperty(this, SH.sourceConstraintComponent); + return getPropertyResourceValue(SH.sourceConstraintComponent); } @Override public Resource getSourceShape() { - return JenaUtil.getResourceProperty(this, SH.sourceShape); + return getPropertyResourceValue(SH.sourceShape); } + @Override - public Resource getResultSeverity() { - return JenaUtil.getResourceProperty(this, SH.resultSeverity); + public RDFNode getValue() { + return JenaUtil.getProperty(this, SH.value); } -} \ No newline at end of file +}
9
Minor API clean up
8
.java
java
apache-2.0
TopQuadrant/shacl
141
<NME> SHResultImpl.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.model.impl; import org.apache.jena.enhanced.EnhGraph; import org.apache.jena.graph.Node; import org.apache.jena.rdf.model.RDFNode; import org.apache.jena.rdf.model.Resource; import org.topbraid.jenax.util.JenaUtil; import org.topbraid.shacl.model.SHResult; import org.topbraid.shacl.vocabulary.SH; public class SHResultImpl extends SHResourceImpl implements SHResult { public SHResultImpl(Node node, EnhGraph graph) { super(node, graph); } @Override public RDFNode getFocusNode() { return JenaUtil.getProperty(this, SH.focusNode); } @Override public String getMessage() { return JenaUtil.getStringProperty(this, SH.resultMessage); } @Override public Resource getPath() { return getPropertyResourceValue(SH.resultPath); } @Override public RDFNode getValue() { return JenaUtil.getProperty(this, SH.value); } @Override public Resource getSourceConstraint() { return JenaUtil.getResourceProperty(this, SH.sourceConstraint); } @Override public Resource getSourceConstraintComponent() { return JenaUtil.getResourceProperty(this, SH.sourceConstraintComponent); } @Override public Resource getSourceShape() { return JenaUtil.getResourceProperty(this, SH.sourceShape); } @Override public Resource getResultSeverity() { return JenaUtil.getResourceProperty(this, SH.resultSeverity); } } <MSG> Minor API clean up <DFF> @@ -50,30 +50,31 @@ public class SHResultImpl extends SHResourceImpl implements SHResult { @Override - public RDFNode getValue() { - return JenaUtil.getProperty(this, SH.value); + public Resource getSeverity() { + return getPropertyResourceValue(SH.resultSeverity); } @Override public Resource getSourceConstraint() { - return JenaUtil.getResourceProperty(this, SH.sourceConstraint); + return getPropertyResourceValue(SH.sourceConstraint); } @Override public Resource getSourceConstraintComponent() { - return JenaUtil.getResourceProperty(this, SH.sourceConstraintComponent); + return getPropertyResourceValue(SH.sourceConstraintComponent); } @Override public Resource getSourceShape() { - return JenaUtil.getResourceProperty(this, SH.sourceShape); + return getPropertyResourceValue(SH.sourceShape); } + @Override - public Resource getResultSeverity() { - return JenaUtil.getResourceProperty(this, SH.resultSeverity); + public RDFNode getValue() { + return JenaUtil.getProperty(this, SH.value); } -} \ No newline at end of file +}
9
Minor API clean up
8
.java
java
apache-2.0
TopQuadrant/shacl
142
<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 (holger@topquadrant.com) 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/) 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). 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> References to additional services using TopBraid <DFF> @@ -13,7 +13,8 @@ Coverage: * [SHACL JavaScript Extensions](https://www.w3.org/TR/shacl-js/) * [SHACL Compact Syntax](https://w3c.github.io/shacl/shacl-compact-syntax/) -This [Online SHACL Shape Validator](https://www.itb.ec.europa.eu/shacl/shacl/upload) uses the TopBraid SHACL API internally. +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 6.3 release).
2
References to additional services using TopBraid
1
.md
md
apache-2.0
TopQuadrant/shacl
143
<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 (holger@topquadrant.com) 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/) 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). 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> References to additional services using TopBraid <DFF> @@ -13,7 +13,8 @@ Coverage: * [SHACL JavaScript Extensions](https://www.w3.org/TR/shacl-js/) * [SHACL Compact Syntax](https://w3c.github.io/shacl/shacl-compact-syntax/) -This [Online SHACL Shape Validator](https://www.itb.ec.europa.eu/shacl/shacl/upload) uses the TopBraid SHACL API internally. +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 6.3 release).
2
References to additional services using TopBraid
1
.md
md
apache-2.0
TopQuadrant/shacl
144
<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 (holger@topquadrant.com) This can serve as a reference implementation developed in parallel to the SHACL spec. 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. Feedback and questions should go to TopBraid Users mailing list: https://groups.google.com/forum/#!forum/topbraid-users 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> Minor updates to README. <DFF> @@ -5,10 +5,12 @@ An open source implementation of the evolving W3C Shapes Constraint Language (SH Contact: Holger Knublauch (holger@topquadrant.com) This can serve as a reference implementation developed in parallel to the SHACL spec. +Can be used to perform SHACL constraint checking in any Jena-based Java application. + 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. +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. Feedback and questions should go to TopBraid Users mailing list: https://groups.google.com/forum/#!forum/topbraid-users
4
Minor updates to README.
2
.md
md
apache-2.0
TopQuadrant/shacl
145
<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 (holger@topquadrant.com) This can serve as a reference implementation developed in parallel to the SHACL spec. 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. Feedback and questions should go to TopBraid Users mailing list: https://groups.google.com/forum/#!forum/topbraid-users 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> Minor updates to README. <DFF> @@ -5,10 +5,12 @@ An open source implementation of the evolving W3C Shapes Constraint Language (SH Contact: Holger Knublauch (holger@topquadrant.com) This can serve as a reference implementation developed in parallel to the SHACL spec. +Can be used to perform SHACL constraint checking in any Jena-based Java application. + 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. +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. Feedback and questions should go to TopBraid Users mailing list: https://groups.google.com/forum/#!forum/topbraid-users
4
Minor updates to README.
2
.md
md
apache-2.0
TopQuadrant/shacl
146
<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:group tosh:RelationshipPropertyGroup ; ] ; . dash:RootClassConstraintComponent dash:propertySuggestionGenerator tosh:DeleteTripleSuggestionGenerator ; . . 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 ; . 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 ; rdfs:label "Display Settings" ; sh:order 1 ; . tosh:MemberShapeConstraintComponent rdf:type 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." ; 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." ; rdfs:label "Other Constraints" ; sh:order 10 ; . tosh:PropertyGroupShape rdf:type sh:NodeShape ; rdfs:label "Property group shape" ; 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 ; . tosh:PropertyShapeShape rdf:type sh:NodeShape ; rdfs:label "Property shape shape" ; sh:property [ sh:path tosh:editWidget ; tosh:editWidget <http://topbraid.org/swaeditor#WidgetDropDownEditor> ; 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" ; 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: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 ; . 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:ComplexConstraintPropertyGroup ; sh:order 13 ; . . 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 a
116
Support for new sh:values rules
0
.ttl
ttl
apache-2.0
TopQuadrant/shacl
147
<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:group tosh:RelationshipPropertyGroup ; ] ; . dash:RootClassConstraintComponent dash:propertySuggestionGenerator tosh:DeleteTripleSuggestionGenerator ; . . 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 ; . 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 ; rdfs:label "Display Settings" ; sh:order 1 ; . tosh:MemberShapeConstraintComponent rdf:type 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." ; 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." ; rdfs:label "Other Constraints" ; sh:order 10 ; . tosh:PropertyGroupShape rdf:type sh:NodeShape ; rdfs:label "Property group shape" ; 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 ; . tosh:PropertyShapeShape rdf:type sh:NodeShape ; rdfs:label "Property shape shape" ; sh:property [ sh:path tosh:editWidget ; tosh:editWidget <http://topbraid.org/swaeditor#WidgetDropDownEditor> ; 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" ; 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: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 ; . 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:ComplexConstraintPropertyGroup ; sh:order 13 ; . . 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 a
116
Support for new sh:values rules
0
.ttl
ttl
apache-2.0
TopQuadrant/shacl
148
<NME> RulesEntailment.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 org.apache.jena.graph.Graph; import org.apache.jena.graph.compose.MultiUnion; import org.apache.jena.query.Dataset; import org.apache.jena.rdf.model.Model; import org.apache.jena.rdf.model.ModelFactory; import org.topbraid.jenax.progress.ProgressMonitor; import org.topbraid.jenax.util.JenaUtil; import org.topbraid.shacl.engine.ShapesGraph; import org.topbraid.shacl.entailment.SHACLEntailment; public class RulesEntailment implements SHACLEntailment.Engine { @Override public Model createModelWithEntailment(Dataset dataset, URI shapesGraphURI, ShapesGraph shapesGraph, ProgressMonitor monitor) throws InterruptedException { Model dataModel = dataset.getDefaultModel(); Model inferencesModel = JenaUtil.createDefaultModel(); MultiUnion unionGraph = new MultiUnion(new Graph[] { dataModel.getGraph(), inferencesModel.getGraph() }); Model unionDataModel = ModelFactory.createModelForGraph(unionGraph); RuleEngine engine = new RuleEngine(dataset, shapesGraphURI, shapesGraph, inferencesModel); engine.setProgressMonitor(monitor); engine.executeAll(); engine.executeAllDefaultValues(); engine.executeAllDefaultValues(); if(inferencesModel.isEmpty()) { return dataModel; } else { return unionDataModel; } } } <MSG> #111 applied RulesEntailment fix <DFF> @@ -24,6 +24,7 @@ import org.apache.jena.query.Dataset; import org.apache.jena.rdf.model.Model; import org.apache.jena.rdf.model.ModelFactory; import org.topbraid.jenax.progress.ProgressMonitor; +import org.topbraid.jenax.util.DatasetWithDifferentDefaultModel; import org.topbraid.jenax.util.JenaUtil; import org.topbraid.shacl.engine.ShapesGraph; import org.topbraid.shacl.entailment.SHACLEntailment; @@ -39,7 +40,8 @@ public class RulesEntailment implements SHACLEntailment.Engine { inferencesModel.getGraph() }); Model unionDataModel = ModelFactory.createModelForGraph(unionGraph); - RuleEngine engine = new RuleEngine(dataset, shapesGraphURI, shapesGraph, inferencesModel); + Dataset newDataset = new DatasetWithDifferentDefaultModel(unionDataModel, dataset); + RuleEngine engine = new RuleEngine(newDataset, shapesGraphURI, shapesGraph, inferencesModel); engine.setProgressMonitor(monitor); engine.executeAll(); engine.executeAllDefaultValues();
3
#111 applied RulesEntailment fix
1
.java
java
apache-2.0
TopQuadrant/shacl
149
<NME> RulesEntailment.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 org.apache.jena.graph.Graph; import org.apache.jena.graph.compose.MultiUnion; import org.apache.jena.query.Dataset; import org.apache.jena.rdf.model.Model; import org.apache.jena.rdf.model.ModelFactory; import org.topbraid.jenax.progress.ProgressMonitor; import org.topbraid.jenax.util.JenaUtil; import org.topbraid.shacl.engine.ShapesGraph; import org.topbraid.shacl.entailment.SHACLEntailment; public class RulesEntailment implements SHACLEntailment.Engine { @Override public Model createModelWithEntailment(Dataset dataset, URI shapesGraphURI, ShapesGraph shapesGraph, ProgressMonitor monitor) throws InterruptedException { Model dataModel = dataset.getDefaultModel(); Model inferencesModel = JenaUtil.createDefaultModel(); MultiUnion unionGraph = new MultiUnion(new Graph[] { dataModel.getGraph(), inferencesModel.getGraph() }); Model unionDataModel = ModelFactory.createModelForGraph(unionGraph); RuleEngine engine = new RuleEngine(dataset, shapesGraphURI, shapesGraph, inferencesModel); engine.setProgressMonitor(monitor); engine.executeAll(); engine.executeAllDefaultValues(); engine.executeAllDefaultValues(); if(inferencesModel.isEmpty()) { return dataModel; } else { return unionDataModel; } } } <MSG> #111 applied RulesEntailment fix <DFF> @@ -24,6 +24,7 @@ import org.apache.jena.query.Dataset; import org.apache.jena.rdf.model.Model; import org.apache.jena.rdf.model.ModelFactory; import org.topbraid.jenax.progress.ProgressMonitor; +import org.topbraid.jenax.util.DatasetWithDifferentDefaultModel; import org.topbraid.jenax.util.JenaUtil; import org.topbraid.shacl.engine.ShapesGraph; import org.topbraid.shacl.entailment.SHACLEntailment; @@ -39,7 +40,8 @@ public class RulesEntailment implements SHACLEntailment.Engine { inferencesModel.getGraph() }); Model unionDataModel = ModelFactory.createModelForGraph(unionGraph); - RuleEngine engine = new RuleEngine(dataset, shapesGraphURI, shapesGraph, inferencesModel); + Dataset newDataset = new DatasetWithDifferentDefaultModel(unionDataModel, dataset); + RuleEngine engine = new RuleEngine(newDataset, shapesGraphURI, shapesGraph, inferencesModel); engine.setProgressMonitor(monitor); engine.executeAll(); engine.executeAllDefaultValues();
3
#111 applied RulesEntailment fix
1
.java
java
apache-2.0
TopQuadrant/shacl
150
<NME> recursive-003.ttl <BEF> ADDFILE <MSG> Updated to latest TopBraid code, made test cases work <DFF> @@ -0,0 +1,84 @@ +# baseURI: http://www.w3.org/ns/shacl/test/features/core/recursive-003 + +@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> ; + rdfs:comment "Based on an example suggested by Simon in https://lists.w3.org/Archives/Public/public-data-shapes-wg/2015Jun/0083.html" ; +. + +# Shapes ---------------------------------------------------------------------- + +ex:recursionShapeExample + a sh:Shape ; + sh:property [ + sh:predicate ex:someProperty ; + sh:valueShape ex:hasAShape ; + ] . + +ex:hasAShape + a sh:Shape ; + sh:constraint [ + a sh:AndConstraint ; + sh:shapes (ex:ValueTypeAShape ex:notBShape) + ] . + +ex:hasBShape + a sh:Shape ; + sh:constraint [ + a sh:AndConstraint ; + sh:shapes (ex:ValueTypeBShape ex:notAShape) + ] . + +ex:notAShape + a sh:Shape ; + sh:constraint [ + a sh:NotConstraint ; + sh:shape ex:hasAShape ; + ] . + +ex:notBShape + a sh:Shape ; + sh:constraint [ + a sh:NotConstraint ; + sh:shape ex:hasBShape; + ] . + +ex:ValueTypeAShape + a sh:Shape ; + sh:property [ + sh:predicate ex:property ; + sh:valueType ex:ClassA ; + ] . + +ex:ValueTypeBShape + a sh:Shape ; + sh:property [ + sh:predicate ex:property ; + sh:valueType ex:ClassB ; + ] . + + +# Instances ------------------------------------------------------------------- + +ex:InstanceOfA + a ex:ClassA ; +. + +ex:InstanceOfB + a ex:ClassB ; +. + +ex:Instance1 + sh:nodeShape ex:recursionShapeExample ; + ex:someProperty ex:Instance2 ; +. + +ex:Instance2 + ex:property ex:InstanceOfA ; +.
84
Updated to latest TopBraid code, made test cases work
0
.ttl
ttl
apache-2.0
TopQuadrant/shacl
151
<NME> recursive-003.ttl <BEF> ADDFILE <MSG> Updated to latest TopBraid code, made test cases work <DFF> @@ -0,0 +1,84 @@ +# baseURI: http://www.w3.org/ns/shacl/test/features/core/recursive-003 + +@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> ; + rdfs:comment "Based on an example suggested by Simon in https://lists.w3.org/Archives/Public/public-data-shapes-wg/2015Jun/0083.html" ; +. + +# Shapes ---------------------------------------------------------------------- + +ex:recursionShapeExample + a sh:Shape ; + sh:property [ + sh:predicate ex:someProperty ; + sh:valueShape ex:hasAShape ; + ] . + +ex:hasAShape + a sh:Shape ; + sh:constraint [ + a sh:AndConstraint ; + sh:shapes (ex:ValueTypeAShape ex:notBShape) + ] . + +ex:hasBShape + a sh:Shape ; + sh:constraint [ + a sh:AndConstraint ; + sh:shapes (ex:ValueTypeBShape ex:notAShape) + ] . + +ex:notAShape + a sh:Shape ; + sh:constraint [ + a sh:NotConstraint ; + sh:shape ex:hasAShape ; + ] . + +ex:notBShape + a sh:Shape ; + sh:constraint [ + a sh:NotConstraint ; + sh:shape ex:hasBShape; + ] . + +ex:ValueTypeAShape + a sh:Shape ; + sh:property [ + sh:predicate ex:property ; + sh:valueType ex:ClassA ; + ] . + +ex:ValueTypeBShape + a sh:Shape ; + sh:property [ + sh:predicate ex:property ; + sh:valueType ex:ClassB ; + ] . + + +# Instances ------------------------------------------------------------------- + +ex:InstanceOfA + a ex:ClassA ; +. + +ex:InstanceOfB + a ex:ClassB ; +. + +ex:Instance1 + sh:nodeShape ex:recursionShapeExample ; + ex:someProperty ex:Instance2 ; +. + +ex:Instance2 + ex:property ex:InstanceOfA ; +.
84
Updated to latest TopBraid code, made test cases work
0
.ttl
ttl
apache-2.0
TopQuadrant/shacl
152
<NME> log4j.properties <BEF> ADDFILE <MSG> Merge pull request #68 from TopQuadrant/antlr Make work as a maven dependenecy without needing local libraries. <DFF> @@ -0,0 +1,11 @@ +log4j.rootLogger=INFO, stdlog + +log4j.appender.stdlog=org.apache.log4j.ConsoleAppender +## log4j.appender.stdlog.target=System.err +log4j.appender.stdlog.layout=org.apache.log4j.PatternLayout +log4j.appender.stdlog.layout.ConversionPattern=%d{HH:mm:ss} %-5p %-25c{1} :: %m%n + +log4j.logger.org.apache.jena=WARN +# For TQ-SHACL +log4j.logger.org.apache.jena.riot=ERROR +log4j.logger.org.apache.jena.sparql.expr.NodeValue=ERROR
11
Merge pull request #68 from TopQuadrant/antlr
0
.properties
properties
apache-2.0
TopQuadrant/shacl
153
<NME> log4j.properties <BEF> ADDFILE <MSG> Merge pull request #68 from TopQuadrant/antlr Make work as a maven dependenecy without needing local libraries. <DFF> @@ -0,0 +1,11 @@ +log4j.rootLogger=INFO, stdlog + +log4j.appender.stdlog=org.apache.log4j.ConsoleAppender +## log4j.appender.stdlog.target=System.err +log4j.appender.stdlog.layout=org.apache.log4j.PatternLayout +log4j.appender.stdlog.layout.ConversionPattern=%d{HH:mm:ss} %-5p %-25c{1} :: %m%n + +log4j.logger.org.apache.jena=WARN +# For TQ-SHACL +log4j.logger.org.apache.jena.riot=ERROR +log4j.logger.org.apache.jena.sparql.expr.NodeValue=ERROR
11
Merge pull request #68 from TopQuadrant/antlr
0
.properties
properties
apache-2.0
TopQuadrant/shacl
154
<NME> anon-shape-002.test.ttl <BEF> # baseURI: http://datashapes.org/sh/tests/shapedefs/anon-shape-002.test # imports: http://datashapes.org/dash # prefix: ex @prefix dash: <http://datashapes.org/dash#> . @prefix ex: <http://datashapes.org/sh/tests/shapedefs/anon-shape-002.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/shapedefs/anon-shape-002.test> rdf:type owl:Ontology ; rdfs:label "Test of anon-shape-002" ; owl:imports <http://datashapes.org/dash> ; owl:versionInfo "Created with TopBraid Composer"^^xsd:string ; . ex:GraphValidationTestCase rdf:type dash:GraphValidationTestCase ; dash:expectedResult [ rdf:type sh:ValidationResult ; sh:focusNode ex:InvalidNode1 ; sh:predicate ex:property ; sh:severity sh:Violation ; sh:subject ex:InvalidNode1 ; ] ; . ex:InvalidNode1 ] ; ] ; dash:validateShapes "true"^^xsd:boolean ; . . [ rdf:type sh:Shape ; rdfs:label "Anon shape"^^xsd:string ; sh:property [ sh:datatype xsd:integer ; sh:maxCount 1 ; sh:minCount 1 ; sh:name "property"^^xsd:string ; sh:predicate ex:property ; ] ; sh:scopeNode ex:InvalidNode1 ; sh:scopeNode ex:ValidNode1 ; sh:minCount 1 ; sh:name "property" ; ] ; sh:targetNode ex:InvalidNode1 ; sh:targetNode ex:ValidNode1 ; ]. <MSG> Large update related to ISSUE-41 (support for property paths) <DFF> @@ -14,16 +14,16 @@ rdf:type owl:Ontology ; rdfs:label "Test of anon-shape-002" ; owl:imports <http://datashapes.org/dash> ; - owl:versionInfo "Created with TopBraid Composer"^^xsd:string ; + owl:versionInfo "Created with TopBraid Composer" ; . ex:GraphValidationTestCase rdf:type dash:GraphValidationTestCase ; dash:expectedResult [ rdf:type sh:ValidationResult ; sh:focusNode ex:InvalidNode1 ; - sh:predicate ex:property ; + sh:path ex:property ; sh:severity sh:Violation ; - sh:subject ex:InvalidNode1 ; + sh:sourceConstraintComponent sh:MinCountConstraintComponent ; ] ; . ex:InvalidNode1 @@ -34,13 +34,13 @@ ex:ValidNode1 . [ rdf:type sh:Shape ; - rdfs:label "Anon shape"^^xsd:string ; + rdfs:label "Anon shape" ; sh:property [ + sh:predicate ex:property ; sh:datatype xsd:integer ; sh:maxCount 1 ; sh:minCount 1 ; - sh:name "property"^^xsd:string ; - sh:predicate ex:property ; + sh:name "property" ; ] ; sh:scopeNode ex:InvalidNode1 ; sh:scopeNode ex:ValidNode1 ;
6
Large update related to ISSUE-41 (support for property paths)
6
.ttl
test
apache-2.0
TopQuadrant/shacl
155
<NME> anon-shape-002.test.ttl <BEF> # baseURI: http://datashapes.org/sh/tests/shapedefs/anon-shape-002.test # imports: http://datashapes.org/dash # prefix: ex @prefix dash: <http://datashapes.org/dash#> . @prefix ex: <http://datashapes.org/sh/tests/shapedefs/anon-shape-002.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/shapedefs/anon-shape-002.test> rdf:type owl:Ontology ; rdfs:label "Test of anon-shape-002" ; owl:imports <http://datashapes.org/dash> ; owl:versionInfo "Created with TopBraid Composer"^^xsd:string ; . ex:GraphValidationTestCase rdf:type dash:GraphValidationTestCase ; dash:expectedResult [ rdf:type sh:ValidationResult ; sh:focusNode ex:InvalidNode1 ; sh:predicate ex:property ; sh:severity sh:Violation ; sh:subject ex:InvalidNode1 ; ] ; . ex:InvalidNode1 ] ; ] ; dash:validateShapes "true"^^xsd:boolean ; . . [ rdf:type sh:Shape ; rdfs:label "Anon shape"^^xsd:string ; sh:property [ sh:datatype xsd:integer ; sh:maxCount 1 ; sh:minCount 1 ; sh:name "property"^^xsd:string ; sh:predicate ex:property ; ] ; sh:scopeNode ex:InvalidNode1 ; sh:scopeNode ex:ValidNode1 ; sh:minCount 1 ; sh:name "property" ; ] ; sh:targetNode ex:InvalidNode1 ; sh:targetNode ex:ValidNode1 ; ]. <MSG> Large update related to ISSUE-41 (support for property paths) <DFF> @@ -14,16 +14,16 @@ rdf:type owl:Ontology ; rdfs:label "Test of anon-shape-002" ; owl:imports <http://datashapes.org/dash> ; - owl:versionInfo "Created with TopBraid Composer"^^xsd:string ; + owl:versionInfo "Created with TopBraid Composer" ; . ex:GraphValidationTestCase rdf:type dash:GraphValidationTestCase ; dash:expectedResult [ rdf:type sh:ValidationResult ; sh:focusNode ex:InvalidNode1 ; - sh:predicate ex:property ; + sh:path ex:property ; sh:severity sh:Violation ; - sh:subject ex:InvalidNode1 ; + sh:sourceConstraintComponent sh:MinCountConstraintComponent ; ] ; . ex:InvalidNode1 @@ -34,13 +34,13 @@ ex:ValidNode1 . [ rdf:type sh:Shape ; - rdfs:label "Anon shape"^^xsd:string ; + rdfs:label "Anon shape" ; sh:property [ + sh:predicate ex:property ; sh:datatype xsd:integer ; sh:maxCount 1 ; sh:minCount 1 ; - sh:name "property"^^xsd:string ; - sh:predicate ex:property ; + sh:name "property" ; ] ; sh:scopeNode ex:InvalidNode1 ; sh:scopeNode ex:ValidNode1 ;
6
Large update related to ISSUE-41 (support for property paths)
6
.ttl
test
apache-2.0
TopQuadrant/shacl
156
<NME> .gitignore <BEF> ## Compiled source *.com *.dll *.exe *.o *.so ## Java ecosystem *.class #*.jar *.war *.ear ## Other *.pyc ## Packages *.7z *.dmg *.gz *.iso *.rar *.zip ## Backup files *~ *.bak *.backup .*.swp \#*# ## Logs and databases *.log *.sql *.sqlite #### Development and IDE Files ## Maven files target/ maven-eclipse.xml build.properties site-content # Release plugin intermediate files. pom.xml.next pom.xml.releaseBackup pom.xml.tag release.properties ## Gradle .gradle /build/ gradle-app.setting # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) !gradle-wrapper.jar # Cache of project .gradletasknamecache # Work around https://youtrack.jetbrains.com/issue/IDEA-116898 # gradle/wrapper/gradle-wrapper.properties ## Eclipse files .classpath .project .settings .recommenders ## IntelliJ IDEA files .idea .iws *.iml *.ipr ## OS generated files .DS_Store .DS_Store? ._* /bin/ /bin/ <MSG> No need to ignore /bin/ <DFF> @@ -76,4 +76,3 @@ gradle-app.setting .DS_Store .DS_Store? ._* -/bin/
0
No need to ignore /bin/
1
gitignore
apache-2.0
TopQuadrant/shacl
157
<NME> .gitignore <BEF> ## Compiled source *.com *.dll *.exe *.o *.so ## Java ecosystem *.class #*.jar *.war *.ear ## Other *.pyc ## Packages *.7z *.dmg *.gz *.iso *.rar *.zip ## Backup files *~ *.bak *.backup .*.swp \#*# ## Logs and databases *.log *.sql *.sqlite #### Development and IDE Files ## Maven files target/ maven-eclipse.xml build.properties site-content # Release plugin intermediate files. pom.xml.next pom.xml.releaseBackup pom.xml.tag release.properties ## Gradle .gradle /build/ gradle-app.setting # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) !gradle-wrapper.jar # Cache of project .gradletasknamecache # Work around https://youtrack.jetbrains.com/issue/IDEA-116898 # gradle/wrapper/gradle-wrapper.properties ## Eclipse files .classpath .project .settings .recommenders ## IntelliJ IDEA files .idea .iws *.iml *.ipr ## OS generated files .DS_Store .DS_Store? ._* /bin/ /bin/ <MSG> No need to ignore /bin/ <DFF> @@ -76,4 +76,3 @@ gradle-app.setting .DS_Store .DS_Store? ._* -/bin/
0
No need to ignore /bin/
1
gitignore
apache-2.0
TopQuadrant/shacl
158
<NME> template-001.ttl <BEF> ADDFILE <MSG> Latest version with improved handling of recursion <DFF> @@ -0,0 +1,68 @@ +# baseURI: http://www.w3.org/ns/shacl/test/features/sparql/template-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:UniqueLanguagePropertyConstraint + a sh:ConstraintTemplate ; + rdfs:subClassOf sh:PropertyConstraint ; + rdfs:comment "Reports an error for any pair of values of the predicate that have the same language tag." ; + sh:message "Duplicate language found: {?lang}" ; + sh:sparql """ + SELECT ?this (lang(?object) AS ?lang) (?this AS ?subject) ?predicate ?object + WHERE { + ?this ?predicate ?object . + ?this ?predicate ?otherObject . + FILTER (lang(?object) = lang(?otherObject) && ?object != ?otherObject) . + }""" ; +. + +ex:UniqueLanguageShape + a sh:Shape ; + sh:property [ + a ex:UniqueLanguagePropertyConstraint ; + sh:predicate rdfs:label ; + ] ; +. + +# Data ------------------------------------------------------------------------ + +ex:ValidInstance1 + sh:nodeShape ex:UniqueLanguageShape ; +. + +ex:ValidInstance2 + sh:nodeShape ex:UniqueLanguageShape ; + rdfs:label "English"@en ; +. + +ex:ValidInstance3 + sh:nodeShape ex:UniqueLanguageShape ; + rdfs:label "English"@en ; + rdfs:label "French"@fr ; +. + +ex:InvalidInstance1 + sh:nodeShape ex:UniqueLanguageShape ; + rdfs:label "English"@en ; + rdfs:label "British"@en ; +. + +ex:InvalidInstance2 + sh:nodeShape ex:UniqueLanguageShape ; + rdfs:label "French"@fr ; + rdfs:label "English"@en ; + rdfs:label "None" ; + rdfs:label "British"@en ; +.
68
Latest version with improved handling of recursion
0
.ttl
ttl
apache-2.0
TopQuadrant/shacl
159
<NME> template-001.ttl <BEF> ADDFILE <MSG> Latest version with improved handling of recursion <DFF> @@ -0,0 +1,68 @@ +# baseURI: http://www.w3.org/ns/shacl/test/features/sparql/template-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:UniqueLanguagePropertyConstraint + a sh:ConstraintTemplate ; + rdfs:subClassOf sh:PropertyConstraint ; + rdfs:comment "Reports an error for any pair of values of the predicate that have the same language tag." ; + sh:message "Duplicate language found: {?lang}" ; + sh:sparql """ + SELECT ?this (lang(?object) AS ?lang) (?this AS ?subject) ?predicate ?object + WHERE { + ?this ?predicate ?object . + ?this ?predicate ?otherObject . + FILTER (lang(?object) = lang(?otherObject) && ?object != ?otherObject) . + }""" ; +. + +ex:UniqueLanguageShape + a sh:Shape ; + sh:property [ + a ex:UniqueLanguagePropertyConstraint ; + sh:predicate rdfs:label ; + ] ; +. + +# Data ------------------------------------------------------------------------ + +ex:ValidInstance1 + sh:nodeShape ex:UniqueLanguageShape ; +. + +ex:ValidInstance2 + sh:nodeShape ex:UniqueLanguageShape ; + rdfs:label "English"@en ; +. + +ex:ValidInstance3 + sh:nodeShape ex:UniqueLanguageShape ; + rdfs:label "English"@en ; + rdfs:label "French"@fr ; +. + +ex:InvalidInstance1 + sh:nodeShape ex:UniqueLanguageShape ; + rdfs:label "English"@en ; + rdfs:label "British"@en ; +. + +ex:InvalidInstance2 + sh:nodeShape ex:UniqueLanguageShape ; + rdfs:label "French"@fr ; + rdfs:label "English"@en ; + rdfs:label "None" ; + rdfs:label "British"@en ; +.
68
Latest version with improved handling of recursion
0
.ttl
ttl
apache-2.0
TopQuadrant/shacl
160
<NME> SPARQLSubstitutions.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.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.function.Function; import org.apache.jena.graph.Node; import org.apache.jena.query.Dataset; import org.topbraid.shacl.arq.functions.TargetContainsPFunction; import org.topbraid.shacl.validation.SHACLException; import org.topbraid.shacl.vocabulary.SH; import org.topbraid.spin.arq.ARQFactory; import org.topbraid.spin.system.SPINLabels; import org.topbraid.spin.util.JenaUtil; import org.apache.jena.rdf.model.ResourceFactory; import org.apache.jena.shared.PrefixMapping; import org.apache.jena.shared.impl.PrefixMappingImpl; import org.apache.jena.sparql.core.Var; import org.apache.jena.vocabulary.OWL; import org.apache.jena.vocabulary.RDFS; import org.topbraid.jenax.util.ARQFactory; import org.topbraid.jenax.util.JenaUtil; import org.topbraid.jenax.util.RDFLabels; import org.topbraid.shacl.validation.SHACLException; import org.topbraid.shacl.vocabulary.SH; import org.topbraid.shacl.vocabulary.TOSH; /** * Collects various helper algorithms currently used by the SPARQL execution language. * * @author Holger Knublauch */ public class SPARQLSubstitutions { // Flag to bypass sh:prefixes and instead use all prefixes in the Jena object of the shapes graph. public static boolean useGraphPrefixes = false; // Currently switched to old setInitialBinding solution private static boolean USE_TRANSFORM = false; public static void addMessageVarNames(String labelTemplate, Set<String> results) { for(int i = 0; i < labelTemplate.length(); i++) { if(i < labelTemplate.length() - 3 && labelTemplate.charAt(i) == '{' && labelTemplate.charAt(i + 1) == '?') { int varEnd = i + 2; while(varEnd < labelTemplate.length()) { if(labelTemplate.charAt(varEnd) == '}') { String varName = labelTemplate.substring(i + 2, varEnd); results.add(varName); break; } else { varEnd++; } } i = varEnd; } } } public static QueryExecution createQueryExecution(Query query, Dataset dataset, QuerySolution bindings) { if(USE_TRANSFORM && bindings != null) { Map<Var,Node> substitutions = new HashMap<Var,Node>(); Iterator<String> varNames = bindings.varNames(); while(varNames.hasNext()) { String varName = varNames.next(); substitutions.put(Var.alloc(varName), bindings.get(varName).asNode()); } Query newQuery = JenaUtil.queryWithSubstitutions(query, substitutions); return ARQFactory.get().createQueryExecution(newQuery, dataset); } else { return ARQFactory.get().createQueryExecution(query, dataset, bindings); } } public static Query substitutePaths(Query query, String pathString, Model model) { // TODO: This is a bad algorithm - should be operating on syntax tree, not string String str = query.toString().replaceAll(" \\?" + SH.PATHVar.getVarName() + " ", pathString); return ARQFactory.get().createQuery(model, str); } public static Literal withSubstitutions(Literal template, QuerySolution bindings, Function<RDFNode,String> labelFunction) { StringBuffer buffer = new StringBuffer(); String labelTemplate = template.getLexicalForm(); for(int i = 0; i < labelTemplate.length(); i++) { if(i < labelTemplate.length() - 3 && labelTemplate.charAt(i) == '{' && (labelTemplate.charAt(i + 1) == '?' || labelTemplate.charAt(i + 1) == '$')) { int varEnd = i + 2; while(varEnd < labelTemplate.length()) { if(labelTemplate.charAt(varEnd) == '}') { String varName = labelTemplate.substring(i + 2, varEnd); RDFNode varValue = bindings.get(varName); if(varValue != null) { if(labelFunction != null) { buffer.append(labelFunction.apply(varValue)); } else if(varValue instanceof Resource) { buffer.append(RDFLabels.get().getLabel((Resource)varValue)); } else if(varValue instanceof Literal) { buffer.append(varValue.asNode().getLiteralLexicalForm()); } } break; } else { varEnd++; } } i = varEnd; } else { buffer.append(labelTemplate.charAt(i)); } } if(template.getLanguage().isEmpty()) { return ResourceFactory.createTypedLiteral(buffer.toString()); } else { return ResourceFactory.createLangLiteral(buffer.toString(), template.getLanguage()); } } static void appendTargets(StringBuffer sb, Resource shape, Dataset dataset) { List<String> targets = new LinkedList<String>(); if(shape.getModel().contains(shape, SH.targetNode, (RDFNode)null)) { targets.add(" GRAPH " + SH.JS_SHAPES_VAR + " { $" + SH.currentShapeVar.getName() + " <" + SH.targetNode + "> ?this } .\n"); } if(JenaUtil.hasIndirectType(shape, RDFS.Class)) { String varName = "?CLASS_VAR"; targets.add(" " + varName + " <" + RDFS.subClassOf + ">* $" + SH.currentShapeVar.getName() + " .\n ?this a " + varName + " .\n"); } for(Resource cls : JenaUtil.getResourceProperties(shape, SH.targetClass)) { String varName = "?SHAPE_CLASS_VAR"; targets.add(" " + varName + " <" + RDFS.subClassOf + ">* <" + cls + "> .\n ?this a " + varName + " .\n"); } int index = 0; for(Resource property : JenaUtil.getResourceProperties(shape, SH.targetSubjectsOf)) { targets.add(" ?this <" + property + "> ?ANY_VALUE_" + index++ + " .\n"); } for(Resource property : JenaUtil.getResourceProperties(shape, SH.targetObjectsOf)) { targets.add(" ?ANY_VALUE_" + index++ + " <" + property + "> ?this .\n"); } if(shape.hasProperty(SH.target)) { targets.add(createTargets(shape)); } if(targets.isEmpty()) { List<String> targets = new LinkedList<String>(); if(shape.getModel().contains(shape, SH.targetNode, (RDFNode)null)) { targets.add(" GRAPH $shapesGraph { $" + SH.currentShapeVar.getName() + " <" + SH.targetNode + "> ?this } .\n"); } if(JenaUtil.hasIndirectType(shape, RDFS.Class)) { sb.append(" {"); sb.append(targets.get(i)); sb.append(" }"); if(i < targets.size() - 1) { sb.append(" UNION\n"); } } } } private static String createTargets(Resource shape) { String targetVar = "?trgt_" + (int)(Math.random() * 10000); return " GRAPH $" + SH.shapesGraphVar.getName() + " { $" + SH.currentShapeVar.getName() + " <" + SH.target + "> " + targetVar + "} .\n" + " (" + targetVar + " $" + SH.shapesGraphVar.getName() + ") <" + TOSH.targetContains + "> ?this .\n"; } /** * Gets a parsable SPARQL string based on a fragment and prefix declarations. * Depending on the setting of the flag useGraphPrefixes, this either uses the * prefixes from the Jena graph of the given executable, or strictly uses sh:prefixes. * @param str the query fragment (e.g. starting with SELECT) * @param executable the sh:SPARQLExecutable potentially holding the sh:prefixes * @return the parsable SPARQL string */ public static String withPrefixes(String str, Resource executable) { if(useGraphPrefixes) { return ARQFactory.get().createPrefixDeclarations(executable.getModel()) + str; } else { StringBuffer sb = new StringBuffer(); PrefixMapping pm = new PrefixMappingImpl(); Set<Resource> reached = new HashSet<Resource>(); for(Resource ontology : JenaUtil.getResourceProperties(executable, SH.prefixes)) { String duplicate = collectPrefixes(ontology, pm, reached); if(duplicate != null) { throw new SHACLException("Duplicate prefix declaration for prefix " + duplicate); } } for(String prefix : pm.getNsPrefixMap().keySet()) { sb.append("PREFIX "); sb.append(prefix); sb.append(": <"); sb.append(pm.getNsPrefixURI(prefix)); sb.append(">\n"); } sb.append(str); return sb.toString(); } } // Returns the duplicate prefix, if any private static String collectPrefixes(Resource ontology, PrefixMapping pm, Set<Resource> reached) { reached.add(ontology); for(Resource decl : JenaUtil.getResourceProperties(ontology, SH.declare)) { String prefix = JenaUtil.getStringProperty(decl, SH.prefix); String ns = JenaUtil.getStringProperty(decl, SH.namespace); if(prefix != null && ns != null) { String oldNS = pm.getNsPrefixURI(prefix); if(oldNS != null && !oldNS.equals(ns)) { return prefix; } pm.setNsPrefix(prefix, ns); } } for(Resource imp : JenaUtil.getResourceProperties(ontology, OWL.imports)) { if(!reached.contains(imp)) { String duplicate = collectPrefixes(imp, pm, reached); if(duplicate != null) { return duplicate; } } } return null; } } <MSG> Regular update from TopBraid code base <DFF> @@ -30,6 +30,7 @@ import org.apache.jena.vocabulary.RDFS; import org.topbraid.shacl.arq.functions.TargetContainsPFunction; import org.topbraid.shacl.validation.SHACLException; import org.topbraid.shacl.vocabulary.SH; +import org.topbraid.shacl.vocabulary.SHJS; import org.topbraid.spin.arq.ARQFactory; import org.topbraid.spin.system.SPINLabels; import org.topbraid.spin.util.JenaUtil; @@ -180,7 +181,7 @@ public class SPARQLSubstitutions { List<String> targets = new LinkedList<String>(); if(shape.getModel().contains(shape, SH.targetNode, (RDFNode)null)) { - targets.add(" GRAPH $shapesGraph { $" + SH.currentShapeVar.getName() + " <" + SH.targetNode + "> ?this } .\n"); + targets.add(" GRAPH " + SHJS.SHAPES_VAR + " { $" + SH.currentShapeVar.getName() + " <" + SH.targetNode + "> ?this } .\n"); } if(JenaUtil.hasIndirectType(shape, RDFS.Class)) {
2
Regular update from TopBraid code base
1
.java
java
apache-2.0
TopQuadrant/shacl
161
<NME> SPARQLSubstitutions.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.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.function.Function; import org.apache.jena.graph.Node; import org.apache.jena.query.Dataset; import org.topbraid.shacl.arq.functions.TargetContainsPFunction; import org.topbraid.shacl.validation.SHACLException; import org.topbraid.shacl.vocabulary.SH; import org.topbraid.spin.arq.ARQFactory; import org.topbraid.spin.system.SPINLabels; import org.topbraid.spin.util.JenaUtil; import org.apache.jena.rdf.model.ResourceFactory; import org.apache.jena.shared.PrefixMapping; import org.apache.jena.shared.impl.PrefixMappingImpl; import org.apache.jena.sparql.core.Var; import org.apache.jena.vocabulary.OWL; import org.apache.jena.vocabulary.RDFS; import org.topbraid.jenax.util.ARQFactory; import org.topbraid.jenax.util.JenaUtil; import org.topbraid.jenax.util.RDFLabels; import org.topbraid.shacl.validation.SHACLException; import org.topbraid.shacl.vocabulary.SH; import org.topbraid.shacl.vocabulary.TOSH; /** * Collects various helper algorithms currently used by the SPARQL execution language. * * @author Holger Knublauch */ public class SPARQLSubstitutions { // Flag to bypass sh:prefixes and instead use all prefixes in the Jena object of the shapes graph. public static boolean useGraphPrefixes = false; // Currently switched to old setInitialBinding solution private static boolean USE_TRANSFORM = false; public static void addMessageVarNames(String labelTemplate, Set<String> results) { for(int i = 0; i < labelTemplate.length(); i++) { if(i < labelTemplate.length() - 3 && labelTemplate.charAt(i) == '{' && labelTemplate.charAt(i + 1) == '?') { int varEnd = i + 2; while(varEnd < labelTemplate.length()) { if(labelTemplate.charAt(varEnd) == '}') { String varName = labelTemplate.substring(i + 2, varEnd); results.add(varName); break; } else { varEnd++; } } i = varEnd; } } } public static QueryExecution createQueryExecution(Query query, Dataset dataset, QuerySolution bindings) { if(USE_TRANSFORM && bindings != null) { Map<Var,Node> substitutions = new HashMap<Var,Node>(); Iterator<String> varNames = bindings.varNames(); while(varNames.hasNext()) { String varName = varNames.next(); substitutions.put(Var.alloc(varName), bindings.get(varName).asNode()); } Query newQuery = JenaUtil.queryWithSubstitutions(query, substitutions); return ARQFactory.get().createQueryExecution(newQuery, dataset); } else { return ARQFactory.get().createQueryExecution(query, dataset, bindings); } } public static Query substitutePaths(Query query, String pathString, Model model) { // TODO: This is a bad algorithm - should be operating on syntax tree, not string String str = query.toString().replaceAll(" \\?" + SH.PATHVar.getVarName() + " ", pathString); return ARQFactory.get().createQuery(model, str); } public static Literal withSubstitutions(Literal template, QuerySolution bindings, Function<RDFNode,String> labelFunction) { StringBuffer buffer = new StringBuffer(); String labelTemplate = template.getLexicalForm(); for(int i = 0; i < labelTemplate.length(); i++) { if(i < labelTemplate.length() - 3 && labelTemplate.charAt(i) == '{' && (labelTemplate.charAt(i + 1) == '?' || labelTemplate.charAt(i + 1) == '$')) { int varEnd = i + 2; while(varEnd < labelTemplate.length()) { if(labelTemplate.charAt(varEnd) == '}') { String varName = labelTemplate.substring(i + 2, varEnd); RDFNode varValue = bindings.get(varName); if(varValue != null) { if(labelFunction != null) { buffer.append(labelFunction.apply(varValue)); } else if(varValue instanceof Resource) { buffer.append(RDFLabels.get().getLabel((Resource)varValue)); } else if(varValue instanceof Literal) { buffer.append(varValue.asNode().getLiteralLexicalForm()); } } break; } else { varEnd++; } } i = varEnd; } else { buffer.append(labelTemplate.charAt(i)); } } if(template.getLanguage().isEmpty()) { return ResourceFactory.createTypedLiteral(buffer.toString()); } else { return ResourceFactory.createLangLiteral(buffer.toString(), template.getLanguage()); } } static void appendTargets(StringBuffer sb, Resource shape, Dataset dataset) { List<String> targets = new LinkedList<String>(); if(shape.getModel().contains(shape, SH.targetNode, (RDFNode)null)) { targets.add(" GRAPH " + SH.JS_SHAPES_VAR + " { $" + SH.currentShapeVar.getName() + " <" + SH.targetNode + "> ?this } .\n"); } if(JenaUtil.hasIndirectType(shape, RDFS.Class)) { String varName = "?CLASS_VAR"; targets.add(" " + varName + " <" + RDFS.subClassOf + ">* $" + SH.currentShapeVar.getName() + " .\n ?this a " + varName + " .\n"); } for(Resource cls : JenaUtil.getResourceProperties(shape, SH.targetClass)) { String varName = "?SHAPE_CLASS_VAR"; targets.add(" " + varName + " <" + RDFS.subClassOf + ">* <" + cls + "> .\n ?this a " + varName + " .\n"); } int index = 0; for(Resource property : JenaUtil.getResourceProperties(shape, SH.targetSubjectsOf)) { targets.add(" ?this <" + property + "> ?ANY_VALUE_" + index++ + " .\n"); } for(Resource property : JenaUtil.getResourceProperties(shape, SH.targetObjectsOf)) { targets.add(" ?ANY_VALUE_" + index++ + " <" + property + "> ?this .\n"); } if(shape.hasProperty(SH.target)) { targets.add(createTargets(shape)); } if(targets.isEmpty()) { List<String> targets = new LinkedList<String>(); if(shape.getModel().contains(shape, SH.targetNode, (RDFNode)null)) { targets.add(" GRAPH $shapesGraph { $" + SH.currentShapeVar.getName() + " <" + SH.targetNode + "> ?this } .\n"); } if(JenaUtil.hasIndirectType(shape, RDFS.Class)) { sb.append(" {"); sb.append(targets.get(i)); sb.append(" }"); if(i < targets.size() - 1) { sb.append(" UNION\n"); } } } } private static String createTargets(Resource shape) { String targetVar = "?trgt_" + (int)(Math.random() * 10000); return " GRAPH $" + SH.shapesGraphVar.getName() + " { $" + SH.currentShapeVar.getName() + " <" + SH.target + "> " + targetVar + "} .\n" + " (" + targetVar + " $" + SH.shapesGraphVar.getName() + ") <" + TOSH.targetContains + "> ?this .\n"; } /** * Gets a parsable SPARQL string based on a fragment and prefix declarations. * Depending on the setting of the flag useGraphPrefixes, this either uses the * prefixes from the Jena graph of the given executable, or strictly uses sh:prefixes. * @param str the query fragment (e.g. starting with SELECT) * @param executable the sh:SPARQLExecutable potentially holding the sh:prefixes * @return the parsable SPARQL string */ public static String withPrefixes(String str, Resource executable) { if(useGraphPrefixes) { return ARQFactory.get().createPrefixDeclarations(executable.getModel()) + str; } else { StringBuffer sb = new StringBuffer(); PrefixMapping pm = new PrefixMappingImpl(); Set<Resource> reached = new HashSet<Resource>(); for(Resource ontology : JenaUtil.getResourceProperties(executable, SH.prefixes)) { String duplicate = collectPrefixes(ontology, pm, reached); if(duplicate != null) { throw new SHACLException("Duplicate prefix declaration for prefix " + duplicate); } } for(String prefix : pm.getNsPrefixMap().keySet()) { sb.append("PREFIX "); sb.append(prefix); sb.append(": <"); sb.append(pm.getNsPrefixURI(prefix)); sb.append(">\n"); } sb.append(str); return sb.toString(); } } // Returns the duplicate prefix, if any private static String collectPrefixes(Resource ontology, PrefixMapping pm, Set<Resource> reached) { reached.add(ontology); for(Resource decl : JenaUtil.getResourceProperties(ontology, SH.declare)) { String prefix = JenaUtil.getStringProperty(decl, SH.prefix); String ns = JenaUtil.getStringProperty(decl, SH.namespace); if(prefix != null && ns != null) { String oldNS = pm.getNsPrefixURI(prefix); if(oldNS != null && !oldNS.equals(ns)) { return prefix; } pm.setNsPrefix(prefix, ns); } } for(Resource imp : JenaUtil.getResourceProperties(ontology, OWL.imports)) { if(!reached.contains(imp)) { String duplicate = collectPrefixes(imp, pm, reached); if(duplicate != null) { return duplicate; } } } return null; } } <MSG> Regular update from TopBraid code base <DFF> @@ -30,6 +30,7 @@ import org.apache.jena.vocabulary.RDFS; import org.topbraid.shacl.arq.functions.TargetContainsPFunction; import org.topbraid.shacl.validation.SHACLException; import org.topbraid.shacl.vocabulary.SH; +import org.topbraid.shacl.vocabulary.SHJS; import org.topbraid.spin.arq.ARQFactory; import org.topbraid.spin.system.SPINLabels; import org.topbraid.spin.util.JenaUtil; @@ -180,7 +181,7 @@ public class SPARQLSubstitutions { List<String> targets = new LinkedList<String>(); if(shape.getModel().contains(shape, SH.targetNode, (RDFNode)null)) { - targets.add(" GRAPH $shapesGraph { $" + SH.currentShapeVar.getName() + " <" + SH.targetNode + "> ?this } .\n"); + targets.add(" GRAPH " + SHJS.SHAPES_VAR + " { $" + SH.currentShapeVar.getName() + " <" + SH.targetNode + "> ?this } .\n"); } if(JenaUtil.hasIndirectType(shape, RDFS.Class)) {
2
Regular update from TopBraid code base
1
.java
java
apache-2.0
TopQuadrant/shacl
162
<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 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 checkign completes. * If all is good, click "release" at the top. Note from 1.0.1: this happened automatically. The rules ran as part of `release:perform`. 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 OSS stage. <DFF> @@ -138,11 +138,9 @@ 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 checkign completes. +* Refresh the webpage until rule checking completes. * If all is good, click "release" at the top. -Note from 1.0.1: this happened automatically. The rules ran as part of `release:perform`. - The release artifacts end up in "Repositories -> Releases -> org.topbraid". ### Github
1
Update OSS stage.
3
.md
md
apache-2.0
TopQuadrant/shacl
163
<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 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 checkign completes. * If all is good, click "release" at the top. Note from 1.0.1: this happened automatically. The rules ran as part of `release:perform`. 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 OSS stage. <DFF> @@ -138,11 +138,9 @@ 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 checkign completes. +* Refresh the webpage until rule checking completes. * If all is good, click "release" at the top. -Note from 1.0.1: this happened automatically. The rules ran as part of `release:perform`. - The release artifacts end up in "Repositories -> Releases -> org.topbraid". ### Github
1
Update OSS stage.
3
.md
md
apache-2.0
TopQuadrant/shacl
164
<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 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 Property minInclusive = ResourceFactory.createProperty(NS + "minInclusive"); public final static Property nodeShape = ResourceFactory.createProperty(NS + "nodeShape"); public final static Property nodeKind = ResourceFactory.createProperty(NS + "nodeKind"); public final static Property object = ResourceFactory.createProperty(NS + "object"); 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 scope = ResourceFactory.createProperty(NS + "scope"); public final static Property scopeClass = ResourceFactory.createProperty(NS + "scopeClass"); public final static Property severity = ResourceFactory.createProperty(NS + "severity"); 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> Updates in response to ISSUE-61 (sh:nodeShape -> sh:scopeNode) <DFF> @@ -160,8 +160,6 @@ public class SH { public final static Property minInclusive = ResourceFactory.createProperty(NS + "minInclusive"); - public final static Property nodeShape = ResourceFactory.createProperty(NS + "nodeShape"); - public final static Property nodeKind = ResourceFactory.createProperty(NS + "nodeKind"); public final static Property object = ResourceFactory.createProperty(NS + "object"); @@ -181,6 +179,8 @@ public class SH { public final static Property scope = ResourceFactory.createProperty(NS + "scope"); public final static Property scopeClass = ResourceFactory.createProperty(NS + "scopeClass"); + + public final static Property scopeNode = ResourceFactory.createProperty(NS + "scopeNode"); public final static Property severity = ResourceFactory.createProperty(NS + "severity");
2
Updates in response to ISSUE-61 (sh:nodeShape -> sh:scopeNode)
2
.java
java
apache-2.0
TopQuadrant/shacl
165
<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 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 Property minInclusive = ResourceFactory.createProperty(NS + "minInclusive"); public final static Property nodeShape = ResourceFactory.createProperty(NS + "nodeShape"); public final static Property nodeKind = ResourceFactory.createProperty(NS + "nodeKind"); public final static Property object = ResourceFactory.createProperty(NS + "object"); 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 scope = ResourceFactory.createProperty(NS + "scope"); public final static Property scopeClass = ResourceFactory.createProperty(NS + "scopeClass"); public final static Property severity = ResourceFactory.createProperty(NS + "severity"); 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> Updates in response to ISSUE-61 (sh:nodeShape -> sh:scopeNode) <DFF> @@ -160,8 +160,6 @@ public class SH { public final static Property minInclusive = ResourceFactory.createProperty(NS + "minInclusive"); - public final static Property nodeShape = ResourceFactory.createProperty(NS + "nodeShape"); - public final static Property nodeKind = ResourceFactory.createProperty(NS + "nodeKind"); public final static Property object = ResourceFactory.createProperty(NS + "object"); @@ -181,6 +179,8 @@ public class SH { public final static Property scope = ResourceFactory.createProperty(NS + "scope"); public final static Property scopeClass = ResourceFactory.createProperty(NS + "scopeClass"); + + public final static Property scopeNode = ResourceFactory.createProperty(NS + "scopeNode"); public final static Property severity = ResourceFactory.createProperty(NS + "severity");
2
Updates in response to ISSUE-61 (sh:nodeShape -> sh:scopeNode)
2
.java
java
apache-2.0
TopQuadrant/shacl
166
<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 (holger@topquadrant.com) 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/) 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). 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 pull request #99 from ISAITB/master References to additional services using TopBraid <DFF> @@ -13,7 +13,8 @@ Coverage: * [SHACL JavaScript Extensions](https://www.w3.org/TR/shacl-js/) * [SHACL Compact Syntax](https://w3c.github.io/shacl/shacl-compact-syntax/) -This [Online SHACL Shape Validator](https://www.itb.ec.europa.eu/shacl/shacl/upload) uses the TopBraid SHACL API internally. +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 6.3 release).
2
Merge pull request #99 from ISAITB/master
1
.md
md
apache-2.0
TopQuadrant/shacl
167
<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 (holger@topquadrant.com) 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/) 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). 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 pull request #99 from ISAITB/master References to additional services using TopBraid <DFF> @@ -13,7 +13,8 @@ Coverage: * [SHACL JavaScript Extensions](https://www.w3.org/TR/shacl-js/) * [SHACL Compact Syntax](https://w3c.github.io/shacl/shacl-compact-syntax/) -This [Online SHACL Shape Validator](https://www.itb.ec.europa.eu/shacl/shacl/upload) uses the TopBraid SHACL API internally. +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 6.3 release).
2
Merge pull request #99 from ISAITB/master
1
.md
md
apache-2.0
TopQuadrant/shacl
168
<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 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. Note from 1.0.1: this happened automatically. The rules ran as part of `release:perform`. ### Clearup Check where any intermediate files are left over. 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> @@ -143,6 +143,8 @@ To push them up to central.maven, go to https://oss.sonatype.org/ Note from 1.0.1: this happened automatically. The rules ran as part of `release:perform`. +The release artifacts end up in "Repositories -> Releases -> org.topbraid". + ### Clearup Check where any intermediate files are left over.
2
Update process.md
0
.md
md
apache-2.0
TopQuadrant/shacl
169
<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 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. Note from 1.0.1: this happened automatically. The rules ran as part of `release:perform`. ### Clearup Check where any intermediate files are left over. 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> @@ -143,6 +143,8 @@ To push them up to central.maven, go to https://oss.sonatype.org/ Note from 1.0.1: this happened automatically. The rules ran as part of `release:perform`. +The release artifacts end up in "Repositories -> Releases -> org.topbraid". + ### Clearup Check where any intermediate files are left over.
2
Update process.md
0
.md
md
apache-2.0
TopQuadrant/shacl
170
<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; public final static String PREFIX = "sh"; public final static Resource AbstractPropertyConstraint = ResourceFactory.createResource(NS + "AbstractPropertyConstraint"); public final static Resource AbstractResult = ResourceFactory.createResource(NS + "AbstractResult"); 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 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 Property defaultValueType = ResourceFactory.createProperty(NS + "defaultValueType"); public final static Property directValueType = ResourceFactory.createProperty(NS + "directValueType"); public final static Property entailment = ResourceFactory.createProperty(NS + "entailment"); 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> Added experimental support for derived properties <DFF> @@ -21,6 +21,10 @@ public class SH { public final static String PREFIX = "sh"; + public final static Resource AbstractDerivedInversePropertyConstraint = ResourceFactory.createResource(NS + "AbstractDerivedInversePropertyConstraint"); + + public final static Resource AbstractDerivedPropertyConstraint = ResourceFactory.createResource(NS + "AbstractDerivedPropertyConstraint"); + public final static Resource AbstractPropertyConstraint = ResourceFactory.createResource(NS + "AbstractPropertyConstraint"); public final static Resource AbstractResult = ResourceFactory.createResource(NS + "AbstractResult"); @@ -106,6 +110,8 @@ public class SH { public final static Property defaultValueType = ResourceFactory.createProperty(NS + "defaultValueType"); + public final static Property derivedValues = ResourceFactory.createProperty(NS + "derivedValues"); + public final static Property directValueType = ResourceFactory.createProperty(NS + "directValueType"); public final static Property entailment = ResourceFactory.createProperty(NS + "entailment");
6
Added experimental support for derived properties
0
.java
java
apache-2.0
TopQuadrant/shacl
171
<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; public final static String PREFIX = "sh"; public final static Resource AbstractPropertyConstraint = ResourceFactory.createResource(NS + "AbstractPropertyConstraint"); public final static Resource AbstractResult = ResourceFactory.createResource(NS + "AbstractResult"); 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 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 Property defaultValueType = ResourceFactory.createProperty(NS + "defaultValueType"); public final static Property directValueType = ResourceFactory.createProperty(NS + "directValueType"); public final static Property entailment = ResourceFactory.createProperty(NS + "entailment"); 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> Added experimental support for derived properties <DFF> @@ -21,6 +21,10 @@ public class SH { public final static String PREFIX = "sh"; + public final static Resource AbstractDerivedInversePropertyConstraint = ResourceFactory.createResource(NS + "AbstractDerivedInversePropertyConstraint"); + + public final static Resource AbstractDerivedPropertyConstraint = ResourceFactory.createResource(NS + "AbstractDerivedPropertyConstraint"); + public final static Resource AbstractPropertyConstraint = ResourceFactory.createResource(NS + "AbstractPropertyConstraint"); public final static Resource AbstractResult = ResourceFactory.createResource(NS + "AbstractResult"); @@ -106,6 +110,8 @@ public class SH { public final static Property defaultValueType = ResourceFactory.createProperty(NS + "defaultValueType"); + public final static Property derivedValues = ResourceFactory.createProperty(NS + "derivedValues"); + public final static Property directValueType = ResourceFactory.createProperty(NS + "directValueType"); public final static Property entailment = ResourceFactory.createProperty(NS + "entailment");
6
Added experimental support for derived properties
0
.java
java
apache-2.0
TopQuadrant/shacl
172
<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 (holger@topquadrant.com) 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> Merge branch 'master' of https://github.com/TopQuadrant/shacl <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
Merge branch 'master' of https://github.com/TopQuadrant/shacl
3
.md
md
apache-2.0
TopQuadrant/shacl
173
<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 (holger@topquadrant.com) 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> Merge branch 'master' of https://github.com/TopQuadrant/shacl <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
Merge branch 'master' of https://github.com/TopQuadrant/shacl
3
.md
md
apache-2.0
TopQuadrant/shacl
174
<NME> dash.ttl <BEF> # baseURI: http://datashapes.org/dash # imports: http://topbraid.org/tosh # imports: http://www.w3.org/ns/shacl# # prefix: dash @prefix dash: <http://datashapes.org/dash#> . @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 tosh: <http://topbraid.org/tosh#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . <http://datashapes.org/dash> a owl:Ontology ; rdfs:comment "DASH is a SHACL library for frequently needed features and design patterns. The constraint components in this library are 100% standards compliant and will work on any engine that fully supports SHACL." ; rdfs:label "DASH Data Shapes Vocabulary" ; owl:imports <http://topbraid.org/tosh> ; owl:imports sh: ; sh:declare [ sh:namespace "http://datashapes.org/dash#"^^xsd:anyURI ; sh:prefix "dash" ; ] ; sh:declare [ sh:namespace "http://purl.org/dc/terms/"^^xsd:anyURI ; sh:prefix "dcterms" ; ] ; sh:declare [ sh:namespace "http://www.w3.org/1999/02/22-rdf-syntax-ns#"^^xsd:anyURI ; sh:prefix "rdf" ; ] ; sh:declare [ sh:namespace "http://www.w3.org/2000/01/rdf-schema#"^^xsd:anyURI ; sh:prefix "rdfs" ; ] ; sh:declare [ sh:namespace "http://www.w3.org/2001/XMLSchema#"^^xsd:anyURI ; sh:prefix "xsd" ; ] ; sh:declare [ sh:namespace "http://www.w3.org/2002/07/owl#"^^xsd:anyURI ; sh:prefix "owl" ; ] ; sh:declare [ sh:namespace "http://www.w3.org/2004/02/skos/core#"^^xsd:anyURI ; sh:prefix "skos" ; ] ; . dash:APIStatus a rdfs:Class ; a sh:NodeShape ; rdfs:comment "The class of possible values for dash:apiStatus." ; rdfs:label "API Status" ; rdfs:subClassOf rdfs:Resource ; . dash:Action a dash:ShapeClass ; dash:abstract true ; rdfs:comment "An executable command triggered by an agent, backed by a Script implementation. Actions may get deactivated using sh:deactivated." ; rdfs:label "Action" ; rdfs:subClassOf dash:Script ; rdfs:subClassOf sh:Parameterizable ; . dash:ActionGroup a dash:ShapeClass ; rdfs:comment "A group of ResourceActions, used to arrange items in menus etc. Similar to sh:PropertyGroups, they may have a sh:order and should have labels (in multiple languages if applicable)." ; rdfs:label "Action group" ; rdfs:subClassOf rdfs:Resource ; . dash:ActionTestCase a dash:ShapeClass ; rdfs:comment """A test case that evaluates a dash:Action using provided input parameters. Requires exactly one value for dash:action and will operate on the test case's graph (with imports) as both data and shapes graph. Currently only supports read-only actions, allowing the comparison of actual results with the expected results.""" ; rdfs:label "Action test case" ; rdfs:subClassOf dash:TestCase ; . dash:AllObjects a dash:AllObjectsTarget ; rdfs:comment "A reusable instance of dash:AllObjectsTarget." ; rdfs:label "All objects" ; . dash:AllObjectsTarget a sh:JSTargetType ; a sh:SPARQLTargetType ; rdfs:comment "A target containing all objects in the data graph as focus nodes." ; rdfs:label "All objects target" ; rdfs:subClassOf sh:Target ; sh:jsFunctionName "dash_allObjects" ; sh:jsLibrary dash:DASHJSLibrary ; sh:labelTemplate "All objects" ; sh:prefixes <http://datashapes.org/dash> ; sh:select """SELECT DISTINCT ?this WHERE { ?anyS ?anyP ?this . }""" ; . dash:AllSubjects a dash:AllSubjectsTarget ; rdfs:comment "A reusable instance of dash:AllSubjectsTarget." ; rdfs:label "All subjects" ; . dash:AllSubjectsTarget a sh:JSTargetType ; a sh:SPARQLTargetType ; rdfs:comment "A target containing all subjects in the data graph as focus nodes." ; rdfs:label "All subjects target" ; rdfs:subClassOf sh:Target ; sh:jsFunctionName "dash_allSubjects" ; sh:jsLibrary dash:DASHJSLibrary ; sh:labelTemplate "All subjects" ; sh:prefixes <http://datashapes.org/dash> ; sh:select """SELECT DISTINCT ?this WHERE { ?this ?anyP ?anyO . }""" ; . dash:AutoCompleteEditor a dash:SingleEditor ; rdfs:comment "An auto-complete field to enter the label of instances of a class. This is the fallback editor for any URI resource if no other editors are more suitable." ; rdfs:label "Auto-complete editor" ; . dash:BlankNodeViewer a dash:SingleViewer ; rdfs:comment "A Viewer for blank nodes, rendering as the label of the blank node." ; rdfs:label "Blank node viewer" ; . dash:BooleanSelectEditor a dash:SingleEditor ; rdfs:comment """An editor for boolean literals, rendering as a select box with values true and false. Also displays the current value (such as \"1\"^^xsd:boolean), but only allows to switch to true or false.""" ; rdfs:label "Boolean select editor" ; . dash:ChangeScript a dash:ShapeClass ; rdfs:comment """Class of ADS scripts that are executed after edits to the data graph were made. These scripts may access the current changes from the graphs with names dataset.addedGraphURI and dataset.deletedGraphURI to learn about which resource values have been added or deleted. For example query them using graph.withDataGraph(dataset.addedGraphURI, ...) or via SPARQL's GRAPH keyword. Change scripts may then perform further changes which would again become visible to other change scripts. Change scripts are executed by their relative sh:order, with a default value of 0. Use lower values to execute before other rules.""" ; rdfs:label "Change script" ; rdfs:subClassOf dash:Script ; . dash:ClosedByTypesConstraintComponent a sh:ConstraintComponent ; rdfs:comment "A constraint component that can be used to declare that focus nodes are \"closed\" based on their rdf:types, meaning that focus nodes may only have values for the properties that are explicitly enumerated via sh:property/sh:path in property constraints at their rdf:types and the superclasses of those. This assumes that the type classes are also shapes." ; rdfs:label "Closed by types constraint component" ; sh:nodeValidator [ a sh:JSValidator ; sh:jsFunctionName "validateClosedByTypesNode" ; sh:jsLibrary dash:DASHJSLibrary ; sh:message "Property is not among those permitted for any of the types" ; ] ; sh:nodeValidator [ a sh:SPARQLSelectValidator ; sh:message "Property {?path} is not among those permitted for any of the types" ; sh:prefixes <http://datashapes.org/dash> ; sh:select """SELECT $this (?predicate AS ?path) ?value WHERE { FILTER ($closedByTypes) . $this ?predicate ?value . FILTER (?predicate != rdf:type) . FILTER NOT EXISTS { $this rdf:type ?type . ?type rdfs:subClassOf* ?class . GRAPH $shapesGraph { ?class sh:property/sh:path ?predicate . } } }""" ; ] ; sh:parameter dash:ClosedByTypesConstraintComponent-closedByTypes ; . dash:ClosedByTypesConstraintComponent-closedByTypes a sh:Parameter ; sh:path dash:closedByTypes ; dash:reifiableBy dash:ConstraintReificationShape ; sh:datatype xsd:boolean ; sh:description "True to indicate that the focus nodes are closed by their types. A constraint violation is reported for each property value of the focus node where the property is not among those that are explicitly declared via sh:property/sh:path in any of the rdf:types of the focus node (and their superclasses). The property rdf:type is always permitted." ; sh:maxCount 1 ; . dash:CoExistsWithConstraintComponent a sh:ConstraintComponent ; dash:localConstraint true ; rdfs:comment "A constraint component that can be used to express a constraint on property shapes so that if the property path has any value then the given property must also have a value, and vice versa." ; rdfs:label "Co-exists-with constraint component" ; sh:message "Values must co-exist with values of {$coExistsWith}" ; sh:parameter dash:CoExistsWithConstraintComponent-coExistsWith ; sh:propertyValidator [ a sh:JSValidator ; sh:jsFunctionName "validateCoExistsWith" ; sh:jsLibrary dash:DASHJSLibrary ; ] ; sh:propertyValidator [ a sh:SPARQLSelectValidator ; sh:prefixes <http://datashapes.org/dash> ; sh:select """SELECT $this WHERE { { FILTER (EXISTS { $this $PATH ?any } && NOT EXISTS { $this $coExistsWith ?any }) } UNION { FILTER (NOT EXISTS { $this $PATH ?any } && EXISTS { $this $coExistsWith ?any }) } }""" ; ] ; . dash:CoExistsWithConstraintComponent-coExistsWith a sh:Parameter ; sh:path dash:coExistsWith ; dash:editor dash:PropertyAutoCompleteEditor ; dash:reifiableBy dash:ConstraintReificationShape ; dash:viewer dash:PropertyLabelViewer ; sh:description "The properties that must co-exist with the surrounding property (path). If the surrounding property path has any value then the given property must also have a value, and vice versa." ; sh:name "co-exists with" ; sh:nodeKind sh:IRI ; . dash:ConstraintReificationShape a sh:NodeShape ; rdfs:comment "Can be used to attach sh:severity and sh:messages to individual constraints using reification." ; rdfs:label "Constraint reification shape" ; sh:property dash:ConstraintReificationShape-message ; sh:property dash:ConstraintReificationShape-severity ; . dash:ConstraintReificationShape-message a sh:PropertyShape ; sh:path sh:message ; dash:singleLine true ; sh:name "messages" ; sh:nodeKind sh:Literal ; sh:or dash:StringOrLangString ; . dash:ConstraintReificationShape-severity a sh:PropertyShape ; sh:path sh:severity ; sh:class sh:Severity ; sh:maxCount 1 ; sh:name "severity" ; sh:nodeKind sh:IRI ; . dash:Constructor a dash:ShapeClass ; rdfs:comment """A script that is executed when a new instance of the class associated via dash:constructor is created, e.g. from a New button. Such scripts typically declare one or more parameters that are collected from the user when the script starts. The values of these parameters can be used as named variables in the script for arbitrary purposes such as setting the URI or initializing some property values of the new instance. The variable focusNode will hold the named node of the selected type, for example when a constructor is associated with a superclass but the user has pressed New for a subclass. The last expression of the script will be used as result of the constructor, so that the surrounding tool knows which resource shall be navigated to next.""" ; rdfs:label "Constructor" ; rdfs:subClassOf dash:Script ; rdfs:subClassOf sh:Parameterizable ; . dash:DASHJSLibrary a sh:JSLibrary ; rdfs:label "DASH JavaScript library" ; sh:jsLibrary dash:RDFQueryJSLibrary ; sh:jsLibraryURL "http://datashapes.org/js/dash.js"^^xsd:anyURI ; . dash:DateOrDateTime a rdf:List ; rdf:first [ sh:datatype xsd:date ; ] ; rdf:rest ( [ sh:datatype xsd:dateTime ; ] ) ; rdfs:comment "An rdf:List that can be used in property constraints as value for sh:or to indicate that all values of a property must be either xsd:date or xsd:dateTime." ; rdfs:label "Date or date time" ; . dash:DatePickerEditor a dash:SingleEditor ; rdfs:comment "An editor for xsd:date literals, offering a calendar-like date picker." ; rdfs:label "Date picker editor" ; . dash:DateTimePickerEditor a dash:SingleEditor ; rdfs:comment "An editor for xsd:dateTime literals, offering a calendar-like date picker and a time selector." ; rdfs:label "Date time picker editor" ; . dash:DepictionRole a dash:PropertyRole ; rdfs:comment "Depiction properties provide images representing the focus nodes. Typical examples may be a photo of an animal or the map of a country." ; rdfs:label "Depiction" ; . dash:Deprecated a dash:APIStatus ; rdfs:comment "Features that have been marked deprecated will remain in the API but should no longer be used by new code and may get deleted in the foreseeable future (e.g., with the next major release)." ; rdfs:label "deprecated" ; . dash:DescriptionRole a dash:PropertyRole ; rdfs:comment "Description properties should produce text literals that may be used as an introduction/summary of what a focus node does." ; rdfs:label "Description" ; . dash:DetailsEditor a dash:SingleEditor ; rdfs:comment "An editor for non-literal values, typically displaying a nested form where the values of the linked resource can be edited directly on the \"parent\" form. Implementations that do not support this (yet) could fall back to an auto-complete widget." ; rdfs:label "Details editor" ; . dash:DetailsViewer a dash:SingleViewer ; rdfs:comment "A Viewer for resources that shows the details of the value using its default view shape as a nested form-like display." ; rdfs:label "Details viewer" ; . dash:Editor a dash:ShapeClass ; dash:abstract true ; rdfs:comment "The class of widgets for editing value nodes." ; rdfs:label "Editor" ; rdfs:subClassOf dash:Widget ; . dash:EnumSelectEditor a dash:SingleEditor ; rdfs:comment "A drop-down editor for enumerated values (typically based on sh:in lists)." ; rdfs:label "Enum select editor" ; . dash:ExecutionPlatform a rdfs:Class ; rdfs:comment "An platform (such as TopBraid) that may have features needed to execute, for example, SPARQL queries." ; rdfs:label "Execution platform" ; rdfs:subClassOf rdfs:Resource ; . dash:Experimental a dash:APIStatus ; rdfs:comment "Features that are marked experimental can be used by early adopters but there is no guarantee that they will reach stable state." ; rdfs:label "experimental" ; . dash:ExploreAction a dash:ShapeClass ; rdfs:comment "An action typically showing up in an Explore section of a selected resource. Cannot make changes to the data." ; rdfs:label "Explore action" ; rdfs:subClassOf dash:ResourceAction ; . dash:FailureResult a rdfs:Class ; rdfs:comment "A result representing a validation failure such as an unsupported recursion." ; rdfs:label "Failure result" ; rdfs:subClassOf sh:AbstractResult ; . dash:FailureTestCaseResult a rdfs:Class ; rdfs:comment "Represents a failure of a test case." ; rdfs:label "Failure test case result" ; rdfs:subClassOf dash:TestCaseResult ; . dash:FunctionTestCase a dash:ShapeClass ; rdfs:comment "A test case that verifies that a given SPARQL expression produces a given, expected result." ; rdfs:label "Function test case" ; rdfs:subClassOf dash:TestCase ; . dash:GraphService a dash:ShapeClass ; rdfs:comment "A service that does not apply to a specific resource (as ResourceService does) but operates on the whole graph. The focusNode variable will be the URI of the current base graph (e.g. <urn:x-evn-master:geo> as a NamedNode." ; rdfs:label "Graph service" ; rdfs:subClassOf dash:Service ; . dash:GraphStoreTestCase a dash:ShapeClass ; rdfs:comment "A test case that can be used to verify that an RDF file could be loaded (from a file) and that the resulting RDF graph is equivalent to a given TTL file." ; rdfs:label "Graph store test case" ; rdfs:subClassOf dash:TestCase ; . dash:GraphUpdate a rdfs:Class ; rdfs:comment "A suggestion consisting of added and/or deleted triples, represented as rdf:Statements via dash:addedTriple and dash:deletedTriple." ; rdfs:label "Graph update" ; rdfs:subClassOf dash:Suggestion ; . dash:GraphValidationTestCase a dash:ShapeClass ; rdfs:comment "A test case that performs SHACL constraint validation on the whole graph and compares the results with the expected validation results stored with the test case. By default this excludes meta-validation (i.e. the validation of the shape definitions themselves). If that's desired, set dash:validateShapes to true." ; rdfs:label "Graph validation test case" ; rdfs:subClassOf dash:ValidationTestCase ; . dash:HTMLOrStringOrLangString a rdf:List ; rdf:first [ sh:datatype rdf:HTML ; ] ; rdf:rest ( [ sh:datatype xsd:string ; ] [ sh:datatype rdf:langString ; ] ) ; rdfs:comment "An rdf:List that can be used in property constraints as value for sh:or to indicate that all values of a property must be either rdf:HTML, xsd:string or rdf:langString (in that order of preference)." ; rdfs:label "HTML or string or langString" ; . dash:HTMLViewer a dash:SingleViewer ; rdfs:comment "A Viewer for HTML encoded text from rdf:HTML literals, rendering as parsed HTML DOM elements. Also displays the language if the HTML has a lang attribute on its root DOM element." ; rdfs:label "HTML viewer" ; . dash:HasValueInConstraintComponent a sh:ConstraintComponent ; rdfs:comment "A constraint component that can be used to express a constraint on property shapes so that one of the values of the property path must be a member of a given list of nodes." ; rdfs:label "Has value in constraint component" ; sh:message "At least one of the values must be in {$hasValueIn}" ; sh:parameter dash:HasValueInConstraintComponent-hasValueIn ; sh:propertyValidator [ a sh:SPARQLSelectValidator ; sh:prefixes <http://datashapes.org/dash> ; sh:select """SELECT $this WHERE { FILTER NOT EXISTS { $this $PATH ?value . GRAPH $shapesGraph { $hasValueIn rdf:rest*/rdf:first ?value . } } }""" ; ] ; . dash:HasValueInConstraintComponent-hasValueIn a sh:Parameter ; sh:path dash:hasValueIn ; dash:reifiableBy dash:ConstraintReificationShape ; sh:description "At least one of the value nodes must be a member of the given list." ; sh:name "has value in" ; sh:node dash:ListShape ; . dash:HasValueTarget a sh:SPARQLTargetType ; rdfs:comment "A target type for all subjects where a given predicate has a certain object value." ; rdfs:label "Has Value target" ; rdfs:subClassOf sh:Target ; sh:labelTemplate "All subjects where {$predicate} has value {$object}" ; sh:parameter [ a sh:Parameter ; sh:path dash:object ; sh:description "The value that is expected to be present." ; sh:name "object" ; ] ; sh:parameter [ a sh:Parameter ; sh:path dash:predicate ; sh:description "The predicate property." ; sh:name "predicate" ; sh:nodeKind sh:IRI ; ] ; sh:prefixes <http://datashapes.org/dash> ; sh:select """SELECT DISTINCT ?this WHERE { ?this $predicate $object . }""" ; . dash:HasValueWithClassConstraintComponent a sh:ConstraintComponent ; rdfs:comment "A constraint component that can be used to express a constraint on property shapes so that one of the values of the property path must be an instance of a given class." ; rdfs:label "Has value with class constraint component" ; sh:message "At least one of the values must be an instance of class {$hasValueWithClass}" ; sh:parameter dash:HasValueWithClassConstraintComponent-hasValueWithClass ; sh:propertyValidator [ a sh:JSValidator ; sh:jsFunctionName "validateHasValueWithClass" ; sh:jsLibrary dash:DASHJSLibrary ; ] ; sh:propertyValidator [ a sh:SPARQLSelectValidator ; sh:prefixes <http://datashapes.org/dash> ; sh:select """SELECT $this WHERE { FILTER NOT EXISTS { $this $PATH ?value . ?value a ?type . ?type rdfs:subClassOf* $hasValueWithClass . } }""" ; ] ; . dash:HasValueWithClassConstraintComponent-hasValueWithClass a sh:Parameter ; sh:path dash:hasValueWithClass ; dash:reifiableBy dash:ConstraintReificationShape ; sh:class rdfs:Class ; sh:description "One of the values of the property path must be an instance of the given class." ; sh:name "has value with class" ; sh:nodeKind sh:IRI ; . dash:HyperlinkViewer a dash:SingleViewer ; rdfs:comment """A Viewer for literals, rendering as a hyperlink to a URL. For literals it assumes the lexical form is the URL. This is often used as default viewer for xsd:anyURI literals. Unsupported for blank nodes.""" ; rdfs:label "Hyperlink viewer" ; . dash:IDRole a dash:PropertyRole ; rdfs:comment "ID properties are short strings or other literals that identify the focus node among siblings. Examples may include social security numbers." ; rdfs:label "ID" ; . dash:IconRole a dash:PropertyRole ; rdfs:comment """Icon properties produce images that are typically small and almost square-shaped, and that may be displayed in the upper left corner of a focus node's display. Values should be xsd:string or xsd:anyURI literals or IRI nodes pointing at URLs. Those URLs should ideally be vector graphics such as .svg files. Instances of the same class often have the same icon, and this icon may be computed using a sh:values rule or as sh:defaultValue. If the value is a relative URL then those should be resolved against the server that delivered the surrounding page.""" ; rdfs:label "Icon" ; . dash:ImageViewer a dash:SingleViewer ; rdfs:comment "A Viewer for URI values that are recognized as images by a browser, rendering as an image." ; rdfs:label "Image viewer" ; . dash:IncludedScript a dash:ShapeClass ; rdfs:comment """The code associated with instances of this class will get injected into the generated APIs, as global code snippets. Typically used to declare libraries of utility functions or constants that are (compared to shape scripts) not necessarily associated with specific classes or shapes. Note that the JavaScript code stored in dash:js cannot use the export keyword because the code must also work in external scripts (such as on Node.js). Instead, you need to enumerate the exported symbols via dash:exports.""" ; rdfs:label "Included script" ; rdfs:subClassOf dash:Script ; sh:property tosh:IncludedScript-exports ; . dash:IndexedConstraintComponent a sh:ConstraintComponent ; rdfs:comment "A constraint component that can be used to mark property shapes to be indexed, meaning that each of its value nodes must carry a dash:index from 0 to N." ; rdfs:label "Indexed constraint component" ; sh:parameter dash:IndexedConstraintComponent-indexed ; . dash:IndexedConstraintComponent-indexed a sh:Parameter ; sh:path dash:indexed ; dash:reifiableBy dash:ConstraintReificationShape ; sh:datatype xsd:boolean ; sh:description "True to activate indexing for this property." ; sh:maxCount 1 ; sh:name "indexed" ; . dash:InferencingTestCase a dash:ShapeClass ; rdfs:comment "A test case to verify whether an inferencing engine is producing identical results to those stored as expected results." ; rdfs:label "Inferencing test case" ; rdfs:subClassOf dash:TestCase ; . dash:InlineViewer a dash:MultiViewer ; rdfs:comment "A multi-viewer that renders all values horizontally, in a more compact form that just a single value per row." ; rdfs:label "Inline viewer" ; . dash:InstancesSelectEditor a dash:SingleEditor ; rdfs:comment "A drop-down editor for all instances of the target class (based on sh:class of the property)." ; rdfs:label "Instances select editor" ; . dash:JSONTableViewer a dash:SingleViewer ; rdfs:comment """A tabular viewer for rdf:JSON literals with a lexical form in the following format: { vars: [ 'col1', 'col2' ], // These are the column keys headerLabels: [ 'Column 1', 'Column 2' ], // Optional, for the column headers bindings: [ // These become the rows { col1: { lex: 'Value2', datatype: '...#string', }, col2: { uri: 'http://.../Instance', label: 'Example Instance', }, }, ... ], } The resulting table will use the headerLabels (if they exist) as column headers, otherwise derive the headers from the variable names. The vars must match the fields in the bindings. The table will contain one row for each binding. Using Active Data Shapes, you can construct such literals dynamically using a sh:values rule, e.g. ex:MyClass-myProperty a sh:PropertyShape ; sh:path ex:myProperty ; sh:values [ dash:js \"\"\" DataViewers.createTableViewerJSON(focusNode.select(` SELECT ?col1 ?col2 WHERE { $this ex:prop1 ?col1 . $this ex:prop2 ?col2 . } `))\"\"\" ] . You may also produce the JSON literal programmatically in JavaScript, or assert the triples by other means.""" ; rdfs:label "JSON table viewer" ; . dash:JSTestCase a dash:ShapeClass ; rdfs:comment "A test case that calls a given SHACL-JS JavaScript function like a sh:JSFunction and compares its result with the dash:expectedResult." ; rdfs:label "SHACL-JS test case" ; rdfs:subClassOf dash:TestCase ; rdfs:subClassOf sh:JSFunction ; . dash:KeyInfoRole a dash:PropertyRole ; rdfs:comment "The Key info role may be assigned to properties that are likely of special interest to a reader, so that they should appear whenever a summary of a focus node is shown." ; rdfs:label "Key info" ; . dash:LabelRole a dash:PropertyRole ; rdfs:comment "Properties with this role produce strings that may serve as display label for the focus nodes. Labels should be either plain string literals or strings with a language tag. The values should also be single-line." ; rdfs:label "Label" ; . dash:LabelViewer a dash:SingleViewer ; rdfs:comment "A Viewer for URI resources, rendering as a hyperlink to that URI based on the display label of the resource. Also includes other ways of interacting with the URI such as opening a nested summary display." ; rdfs:label "Label viewer" ; . dash:LangStringViewer a dash:SingleViewer ; rdfs:comment "A Viewer for literals with a language tag, rendering as the text plus a language indicator." ; rdfs:label "LangString viewer" ; . dash:ListNodeShape a sh:NodeShape ; rdfs:comment "Defines constraints on what it means for a node to be a node within a well-formed RDF list. Note that this does not check whether the rdf:rest items are also well-formed lists as this would lead to unsupported recursion." ; rdfs:label "List node shape" ; sh:or ( [ sh:hasValue () ; sh:property [ a sh:PropertyShape ; sh:path rdf:first ; sh:maxCount 0 ; ] ; sh:property [ a sh:PropertyShape ; sh:path rdf:rest ; sh:maxCount 0 ; ] ; ] [ sh:not [ sh:hasValue () ; ] ; sh:property [ a sh:PropertyShape ; sh:path rdf:first ; sh:maxCount 1 ; sh:minCount 1 ; ] ; sh:property [ a sh:PropertyShape ; sh:path rdf:rest ; sh:maxCount 1 ; sh:minCount 1 ; ] ; ] ) ; . dash:ListShape a sh:NodeShape ; rdfs:comment """Defines constraints on what it means for a node to be a well-formed RDF list. The focus node must either be rdf:nil or not recursive. Furthermore, this shape uses dash:ListNodeShape as a \"helper\" to walk through all members of the whole list (including itself).""" ; rdfs:label "List shape" ; sh:or ( [ sh:hasValue () ; ] [ sh:not [ sh:hasValue () ; ] ; sh:property [ a sh:PropertyShape ; sh:path [ sh:oneOrMorePath rdf:rest ; ] ; dash:nonRecursive true ; ] ; ] ) ; sh:property [ a sh:PropertyShape ; sh:path [ sh:zeroOrMorePath rdf:rest ; ] ; rdfs:comment "Each list member (including this node) must be have the shape dash:ListNodeShape." ; sh:node dash:ListNodeShape ; ] ; . dash:LiteralViewer a dash:SingleViewer ; rdfs:comment "A simple viewer for literals, rendering the lexical form of the value." ; rdfs:label "Literal viewer" ; . dash:ModifyAction a dash:ShapeClass ; rdfs:comment "An action typically showing up in a Modify section of a selected resource. May make changes to the data." ; rdfs:label "Modify action" ; rdfs:subClassOf dash:ResourceAction ; . dash:MultiEditor a dash:ShapeClass ; rdfs:comment "An editor for multiple/all value nodes at once." ; rdfs:label "Multi editor" ; rdfs:subClassOf dash:Editor ; . dash:MultiFunction a rdfs:Class ; a sh:NodeShape ; rdfs:comment """A multi-function is a function that can return zero or more result objects consisting of one or more result variables. While normal (SPARQL/SHACL) functions can only return a single result node, multi-functions may not only return multiple nodes but even multiple individual variables per solution. A common way of defining multi-functions is by wrapping a SPARQL SELECT query, using dash:SPARQLMultiFunction. However, some MultiFunctions (in TopBraid) may also be implemented natively.""" ; rdfs:label "Multi-function" ; rdfs:subClassOf sh:Parameterizable ; sh:nodeKind sh:IRI ; . dash:MultiViewer a dash:ShapeClass ; rdfs:comment "A viewer for multiple/all values at once." ; rdfs:label "Multi viewer" ; rdfs:subClassOf dash:Viewer ; . dash:NoSuitableEditor a dash:SingleEditor ; rdfs:comment "An \"editor\" that simply informs the user that the values cannot be edited here, but for example through source code editing." ; rdfs:label "No suitable editor" ; . dash:NodeExpressionViewer a dash:SingleViewer ; rdfs:comment "A viewer for SHACL Node Expressions."^^rdf:HTML ; rdfs:label "Node expression viewer" ; . dash:NonRecursiveConstraintComponent a sh:ConstraintComponent ; rdfs:comment "Used to state that a property or path must not point back to itself." ; rdfs:label "Non-recursive constraint component" ; sh:message "Points back at itself (recursively)" ; sh:parameter dash:NonRecursiveConstraintComponent-nonRecursive ; sh:propertyValidator [ a sh:JSValidator ; sh:jsFunctionName "validateNonRecursiveProperty" ; sh:jsLibrary dash:DASHJSLibrary ; ] ; sh:propertyValidator [ a sh:SPARQLSelectValidator ; sh:prefixes <http://datashapes.org/dash> ; sh:select """SELECT DISTINCT $this ($this AS ?value) WHERE { { FILTER (?nonRecursive) } $this $PATH $this . }""" ; ] ; . dash:NonRecursiveConstraintComponent-nonRecursive a sh:Parameter ; sh:path dash:nonRecursive ; dash:reifiableBy dash:ConstraintReificationShape ; sh:datatype xsd:boolean ; sh:description """Used to state that a property or path must not point back to itself. For example, \"a person cannot have itself as parent\" can be expressed by setting dash:nonRecursive=true for a given sh:path. To express that a person cannot have itself among any of its (recursive) parents, use a sh:path with the + operator such as ex:parent+.""" ; sh:maxCount 1 ; sh:name "non-recursive" ; . dash:None a sh:NodeShape ; rdfs:comment "A Shape that is no node can conform to." ; rdfs:label "None" ; sh:in () ; . dash:ParameterConstraintComponent a sh:ConstraintComponent ; rdfs:comment "A constraint component that can be used to verify that all value nodes conform to the given Parameter."@en ; rdfs:label "Parameter constraint component"@en ; sh:parameter dash:ParameterConstraintComponent-parameter ; . dash:ParameterConstraintComponent-parameter a sh:Parameter ; sh:path sh:parameter ; . dash:PrimaryKeyConstraintComponent a sh:ConstraintComponent ; dash:localConstraint true ; rdfs:comment "Enforces a constraint that the given property (sh:path) serves as primary key for all resources in the target of the shape. If a property has been declared to be the primary key then each resource must have exactly one value for that property. Furthermore, the URIs of those resources must start with a given string (dash:uriStart), followed by the URL-encoded primary key value. For example if dash:uriStart is \"http://example.org/country-\" and the primary key for an instance is \"de\" then the URI must be \"http://example.org/country-de\". Finally, as a result of the URI policy, there can not be any other resource with the same value under the same primary key policy." ; rdfs:label "Primary key constraint component" ; sh:labelTemplate "The property {?predicate} is the primary key and URIs start with {?uriStart}" ; sh:message "Violation of primary key constraint" ; sh:parameter dash:PrimaryKeyConstraintComponent-uriStart ; sh:propertyValidator [ a sh:JSValidator ; sh:jsFunctionName "validatePrimaryKeyProperty" ; sh:jsLibrary dash:DASHJSLibrary ; ] ; sh:propertyValidator [ a sh:SPARQLSelectValidator ; sh:prefixes <http://datashapes.org/dash> ; sh:select """SELECT DISTINCT $this WHERE { FILTER ( # Must have a value for the primary key NOT EXISTS { ?this $PATH ?any } || # Must have no more than one value for the primary key EXISTS { ?this $PATH ?value1 . ?this $PATH ?value2 . FILTER (?value1 != ?value2) . } || # The value of the primary key must align with the derived URI EXISTS { { ?this $PATH ?value . FILTER NOT EXISTS { ?this $PATH ?value2 . FILTER (?value != ?value2) } } BIND (CONCAT($uriStart, ENCODE_FOR_URI(str(?value))) AS ?uri) . FILTER (str(?this) != ?uri) . } ) }""" ; ] ; . dash:PrimaryKeyConstraintComponent-uriStart a sh:Parameter ; sh:path dash:uriStart ; dash:reifiableBy dash:ConstraintReificationShape ; sh:datatype xsd:string ; sh:description "The start of the URIs of well-formed resources. If specified then the associated property/path serves as \"primary key\" for all target nodes (instances). All such target nodes need to have a URI that starts with the given string, followed by the URI-encoded value of the primary key property." ; sh:maxCount 1 ; sh:name "URI start" ; . dash:PropertyAutoCompleteEditor a dash:SingleEditor ; rdfs:comment "An editor for properties that are either defined as instances of rdf:Property or used as IRI values of sh:path. The component uses auto-complete to find these properties by their rdfs:labels or sh:names." ; rdfs:label "Property auto-complete editor" ; . dash:PropertyLabelViewer a dash:SingleViewer ; rdfs:comment "A viewer for properties that renders a hyperlink using the display label or sh:name, allowing users to either navigate to the rdf:Property resource or the property shape definition. Should be used in conjunction with PropertyAutoCompleteEditor." ; rdfs:label "Property label viewer" ; . dash:PropertyRole a rdfs:Class ; a sh:NodeShape ; rdfs:comment "The class of roles that a property (shape) may take for its focus nodes." ; rdfs:label "Property role" ; rdfs:subClassOf rdfs:Resource ; . dash:QueryTestCase a dash:ShapeClass ; rdfs:comment "A test case running a given SPARQL SELECT query and comparing its results with those stored as JSON Result Set in the expected result property." ; rdfs:label "Query test case" ; rdfs:subClassOf dash:TestCase ; rdfs:subClassOf sh:SPARQLSelectExecutable ; . dash:RDFQueryJSLibrary a sh:JSLibrary ; rdfs:label "rdfQuery JavaScript Library" ; sh:jsLibraryURL "http://datashapes.org/js/rdfquery.js"^^xsd:anyURI ; . dash:ReifiableByConstraintComponent a sh:ConstraintComponent ; rdfs:label "Reifiable-by constraint component" ; sh:labelTemplate "Reifiable by {$reifiableBy}" ; sh:parameter dash:ReifiableByConstraintComponent-reifiableBy ; . dash:ReifiableByConstraintComponent-reifiableBy a sh:Parameter ; sh:path dash:reifiableBy ; sh:class sh:NodeShape ; sh:description "Can be used to specify the node shape that may be applied to reified statements produced by a property shape. The property shape must have a URI resource as its sh:path. The values of this property must be node shapes. User interfaces can use this information to determine which properties to present to users when reified statements are explored or edited. Also, SHACL validators can use it to determine how to validate reified triples. Use dash:None to indicate that no reification should be permitted." ; sh:maxCount 1 ; sh:name "reifiable by" ; sh:nodeKind sh:IRI ; . dash:ResourceAction a dash:ShapeClass ; dash:abstract true ; rdfs:comment "An Action that can be executed for a selected resource. Such Actions show up in context menus once they have been assigned a sh:group." ; rdfs:label "Resource action" ; rdfs:subClassOf dash:Action ; . dash:ResourceService a dash:ShapeClass ; rdfs:comment "A Service that can (and must) be applied to a given resource as focus node. Use dash:resourceService to link a class to the services that apply to its instances." ; rdfs:label "Resource service" ; rdfs:subClassOf dash:Service ; . dash:RichTextEditor a dash:SingleEditor ; rdfs:comment "A rich text editor to enter the lexical value of a literal and a drop down to select language. The selected language is stored in the HTML lang attribute of the root node in the HTML DOM tree." ; rdfs:label "Rich text editor" ; . dash:RootClassConstraintComponent a sh:ConstraintComponent ; rdfs:comment "A constraint component defining the parameter dash:rootClass, which restricts the values to be either the root class itself or one of its subclasses. This is typically used in conjunction with properties that have rdfs:Class as their type." ; rdfs:label "Root class constraint component" ; sh:labelTemplate "Root class {$rootClass}" ; sh:message "Value must be subclass of {$rootClass}" ; sh:parameter dash:RootClassConstraintComponent-rootClass ; sh:validator dash:hasRootClass ; sh:validator [ a sh:JSValidator ; sh:jsFunctionName "validateRootClass" ; sh:jsLibrary dash:DASHJSLibrary ; ] ; . dash:RootClassConstraintComponent-rootClass a sh:Parameter ; sh:path dash:rootClass ; dash:reifiableBy dash:ConstraintReificationShape ; sh:class rdfs:Class ; sh:description "The root class." ; sh:name "root class" ; sh:nodeKind sh:IRI ; . dash:SPARQLConstructTemplate a rdfs:Class ; rdfs:comment "Encapsulates one or more SPARQL CONSTRUCT queries that can be parameterized. Parameters will become pre-bound variables in the queries." ; rdfs:label "SPARQL CONSTRUCT template" ; rdfs:subClassOf sh:Parameterizable ; rdfs:subClassOf sh:SPARQLConstructExecutable ; . dash:SPARQLMultiFunction a rdfs:Class ; a sh:NodeShape ; rdfs:comment "A multi-function based on a SPARQL SELECT query. The query gets executed with the arguments pre-bound to the variables declared as parameters. The results of the multi-function are all result bindings from the SPARQL result set." ; rdfs:label "SPARQL multi-function" ; rdfs:subClassOf dash:MultiFunction ; rdfs:subClassOf sh:SPARQLSelectExecutable ; . dash:SPARQLSelectTemplate a rdfs:Class ; rdfs:comment "Encapsulates a SPARQL SELECT query that can be parameterized. Parameters will become pre-bound variables in the query." ; rdfs:label "SPARQL SELECT template" ; rdfs:subClassOf sh:Parameterizable ; rdfs:subClassOf sh:SPARQLSelectExecutable ; . dash:SPARQLUpdateSuggestionGenerator a rdfs:Class ; rdfs:comment """A SuggestionGenerator based on a SPARQL UPDATE query (sh:update), producing an instance of dash:GraphUpdate. The INSERTs become dash:addedTriple and the DELETEs become dash:deletedTriple. The WHERE clause operates on the data graph with the pre-bound variables $focusNode, $predicate and $value, as well as the other pre-bound variables for the parameters of the constraint. In many cases, there may be multiple possible suggestions to fix a problem. For example, with sh:maxLength there are many ways to slice a string. In those cases, the system will first iterate through the result variables from a SELECT query (sh:select) and apply these results as pre-bound variables into the UPDATE query.""" ; rdfs:label "SPARQL UPDATE suggestion generator" ; rdfs:subClassOf dash:SuggestionGenerator ; rdfs:subClassOf sh:SPARQLSelectExecutable ; rdfs:subClassOf sh:SPARQLUpdateExecutable ; . dash:Script a dash:ShapeClass ; rdfs:comment "An executable unit implemented in one or more languages such as JavaScript." ; rdfs:label "Script" ; rdfs:subClassOf rdfs:Resource ; . rdf:type rdf:Property ; rdfs:label "root class" ; . dash:staticConstraint rdf:type rdf:Property ; rdfs:comment """Can be set to true for those constraint components where the validation does not require to visit any other triples than the parameters. Examples of this include sh:datatype or sh:nodeKind, where no further triples need to be queried to determine the result. . dash:ScriptAPIShape-generateClass a sh:PropertyShape ; sh:path dash:generateClass ; sh:class sh:NodeShape ; sh:description "The API generator will produce classes for each value of this property and all its subclasses and superclasses." ; sh:group dash:ScriptAPIGenerationRules ; sh:name "generate class" ; sh:nodeKind sh:IRI ; sh:order "0"^^xsd:decimal ; . dash:ScriptAPIShape-generatePrefixClasses a sh:PropertyShape ; sh:path dash:generatePrefixClasses ; sh:datatype xsd:string ; sh:description "If a prefix (such as \"edg\") is listed here then the API generator will produce classes for all RDFS classes or node shapes from the associated namespace." ; sh:group dash:ScriptAPIGenerationRules ; sh:name "generate prefix classes" ; sh:order "15"^^xsd:decimal ; . dash:ScriptAPIShape-generatePrefixConstants a sh:PropertyShape ; sh:path dash:generatePrefixConstants ; sh:datatype xsd:string ; sh:description "If a prefix (such as \"edg\") is listed here then the API generator will produce constants for class, datatype, shape and property names." ; sh:group dash:ScriptAPIGenerationRules ; sh:name "generate prefix constants" ; sh:order "10"^^xsd:decimal ; . dash:ScriptConstraint a dash:ShapeClass ; rdfs:comment """The class of constraints that are based on Scripts. Depending on whether dash:onAllValues is set to true, these scripts can access the following pre-assigned variables: - focusNode: the focus node of the constraint (a NamedNode) - if dash:onAllValues is not true: value: the current value node (e.g. a JavaScript string for xsd:string literals, a number for numeric literals or true or false for xsd:boolean literals. All other literals become LiteralNodes, and non-literals become instances of NamedNode) - if dash:onAllValues is true: values: an array of current value nodes, as above. If the expression returns an array then each array member will be mapped to one validation result, following the mapping rules below. For string results, a validation result will use the string as sh:resultMessage. For boolean results, a validation result will be produced if the result is false (true means no violation). For object results, a validation result will be produced using the value of the field \"message\" of the object as result message. If the field \"value\" has a value then this will become the sh:value in the violation. Unless another sh:message has been directly returned, the sh:message of the dash:ScriptConstraint will be used, similar to sh:message at SPARQL Constraints. These sh:messages can access the values {$focusNode}, {$value} etc as template variables.""" ; rdfs:label "Script constraint" ; rdfs:subClassOf dash:Script ; . dash:ScriptConstraintComponent a sh:ConstraintComponent ; rdfs:label "Script constraint component" ; sh:parameter dash:ScriptConstraintComponent-scriptConstraint ; . dash:ScriptConstraintComponent-scriptConstraint a sh:Parameter ; sh:path dash:scriptConstraint ; sh:class dash:ScriptConstraint ; sh:description "The Script constraint(s) to apply." ; sh:name "script constraint" ; . dash:ScriptFunction a rdfs:Class ; a sh:NodeShape ; rdfs:comment """Script functions can be used from SPARQL queries and will be injected into the generated prefix object (in JavaScript, for ADS scripts). The dash:js will be inserted into a generated JavaScript function and therefore needs to use the return keyword to produce results. These JS snippets can access the parameter values based on the local name of the sh:Parameter's path. For example ex:value can be accessed using value. SPARQL use note: Since these functions may be used from any data graph and any shapes graph, they must not rely on any API apart from what's available in the shapes graph that holds the rdf:type triple of the function itself. In other words, at execution time from SPARQL, the ADS shapes graph will be the home graph of the function's declaration.""" ; rdfs:label "Script function" ; rdfs:subClassOf dash:Script ; rdfs:subClassOf sh:Function ; . dash:ScriptSuggestionGenerator a dash:ShapeClass ; rdfs:comment """A Suggestion Generator that is backed by an Active Data Shapes script. The script needs to return a JSON object or an array of JSON objects if it shall generate multiple suggestions. It may also return null to indicate that nothing was suggested. Note that the whole script is evaluated as a (JavaScript) expression, and those will use the last value as result. So simply putting an object at the end of your script should do. Alternatively, define the bulk of the operation as a function and simply call that function in the script. Each response object can have the following fields: { message: \"The human readable message\", // Defaults to the rdfs:label(s) of the suggestion generator add: [ // An array of triples to add, each triple as an array with three nodes [ subject, predicate, object ], [ ... ] ], delete: [ ... like add, for the triples to delete ] } Suggestions with neither added nor deleted triples will be discarded. At execution time, the script operates on the data graph as the active graph, with the following pre-bound variables: - focusNode: the NamedNode that is the sh:focusNode of the validation result - predicate: the NamedNode representing the predicate of the validation result, assuming sh:resultPath is a URI - value: the value node from the validation result's sh:value, cast into the most suitable JS object - the other pre-bound variables for the parameters of the constraint, e.g. in a sh:maxCount constraint it would be maxCount The script will be executed in read-only mode, i.e. it cannot modify the graph. Example with dash:js: ({ message: `Copy labels into ${graph.localName(predicate)}`, add: focusNode.values(rdfs.label).map(label => [ focusNode, predicate, label ] ) })""" ; rdfs:label "Script suggestion generator" ; rdfs:subClassOf dash:Script ; rdfs:subClassOf dash:SuggestionGenerator ; . dash:ScriptTestCase a dash:ShapeClass ; rdfs:comment """A test case that evaluates a script. Requires exactly one value for dash:js and will operate on the test case's graph (with imports) as both data and shapes graph. Supports read-only scripts only at this stage.""" ; rdfs:label "Script test case" ; rdfs:subClassOf dash:Script ; rdfs:subClassOf dash:TestCase ; . dash:ScriptValidator a dash:ShapeClass ; rdfs:comment """A SHACL validator based on an Active Data Shapes script. See the comment at dash:ScriptConstraint for the basic evaluation approach. Note that in addition to focusNode and value/values, the script can access pre-bound variables for each declared argument of the constraint component.""" ; rdfs:label "Script validator" ; rdfs:subClassOf dash:Script ; rdfs:subClassOf sh:Validator ; . dash:Service a dash:ShapeClass ; dash:abstract true ; rdfs:comment "A script that gets exposed as a web service, e.g. /tbl/service/ex/MyService" ; rdfs:label "Service" ; rdfs:subClassOf dash:Script ; rdfs:subClassOf sh:Parameterizable ; . dash:ShapeClass a dash:ShapeClass ; dash:hidden true ; rdfs:comment "A class that is also a node shape. This class can be used as rdf:type instead of the combination of rdfs:Class and sh:NodeShape." ; rdfs:label "Shape class" ; rdfs:subClassOf rdfs:Class ; rdfs:subClassOf sh:NodeShape ; . dash:ShapeScript a rdfs:Class ; rdfs:comment "A shape script contains extra code that gets injected into the API for the associated node shape. In particular you can use this to define additional functions that operate on the current focus node (the this variable in JavaScript)." ; rdfs:label "Shape script" ; rdfs:subClassOf dash:Script ; . dash:SingleEditor a dash:ShapeClass ; rdfs:comment "An editor for individual value nodes." ; rdfs:label "Single editor" ; rdfs:subClassOf dash:Editor ; . dash:SingleLineConstraintComponent a sh:ConstraintComponent ; rdfs:comment """A constraint component that can be used to declare that all values that are literals must have a lexical form that contains no line breaks ('\\n' or '\\r'). User interfaces may use the dash:singleLine flag to prefer a text field over a (multi-line) text area.""" ; rdfs:label "Single line constraint component" ; sh:message "Must not contain line breaks." ; sh:parameter dash:SingleLineConstraintComponent-singleLine ; sh:validator [ a sh:JSValidator ; sh:jsFunctionName "validateSingleLine" ; sh:jsLibrary dash:DASHJSLibrary ; ] ; sh:validator [ a sh:SPARQLAskValidator ; sh:ask """ASK { FILTER (!$singleLine || !isLiteral($value) || (!contains(str($value), '\\n') && !contains(str($value), '\\r'))) }""" ; sh:prefixes <http://datashapes.org/dash> ; ] ; . dash:SingleLineConstraintComponent-singleLine a sh:Parameter ; sh:path dash:singleLine ; dash:reifiableBy dash:ConstraintReificationShape ; sh:datatype xsd:boolean ; sh:description "True to state that the lexical form of literal value nodes must not contain any line breaks. False to state that line breaks are explicitly permitted." ; sh:group tosh:StringConstraintsPropertyGroup ; sh:maxCount 1 ; sh:name "single line" ; sh:order "30"^^xsd:decimal ; . dash:SingleViewer a dash:ShapeClass ; rdfs:comment "A viewer for a single value." ; rdfs:label "Single viewer" ; rdfs:subClassOf dash:Viewer ; . dash:Stable a dash:APIStatus ; rdfs:comment "Features that have been marked stable are deemed of good quality and can be used until marked deprecated." ; rdfs:label "stable" ; . dash:StemConstraintComponent a sh:ConstraintComponent ; dash:staticConstraint true ; rdfs:comment "A constraint component that can be used to verify that every value node is an IRI and the IRI starts with a given string value."@en ; rdfs:label "Stem constraint component"@en ; sh:labelTemplate "Value needs to have stem {$stem}" ; sh:message "Value does not have stem {$stem}" ; sh:parameter dash:StemConstraintComponent-stem ; sh:validator dash:hasStem ; sh:validator [ a sh:JSValidator ; sh:jsFunctionName "validateStem" ; sh:jsLibrary dash:DASHJSLibrary ; ] ; . dash:StemConstraintComponent-stem a sh:Parameter ; sh:path dash:stem ; dash:reifiableBy dash:ConstraintReificationShape ; sh:datatype xsd:string ; sh:description "If specified then every value node must be an IRI and the IRI must start with the given string value." ; sh:maxCount 1 ; sh:name "stem" ; . dash:StringOrLangString a rdf:List ; rdf:first [ sh:datatype xsd:string ; ] ; rdf:rest ( [ sh:datatype rdf:langString ; ] ) ; rdfs:comment "An rdf:List that can be used in property constraints as value for sh:or to indicate that all values of a property must be either xsd:string or rdf:langString." ; rdfs:label "String or langString" ; . dash:StringOrLangStringOrHTML a rdf:List ; rdf:first [ sh:datatype xsd:string ; ] ; rdf:rest ( [ sh:datatype rdf:langString ; ] [ sh:datatype rdf:HTML ; ] ) ; rdfs:comment "An rdf:List that can be used in property constraints as value for sh:or to indicate that all values of a property must be either xsd:string, rdf:langString or rdf:HTML (in that order of preference)." ; rdfs:label "string or langString or HTML" ; . dash:SubClassEditor a dash:SingleEditor ; rdfs:comment "An editor for properties that declare a dash:rootClass. The editor allows selecting either the class itself or one of its subclasses." ; rdfs:label "Sub-Class editor" ; . dash:SubSetOfConstraintComponent a sh:ConstraintComponent ; dash:localConstraint true ; rdfs:comment "A constraint component that can be used to state that the set of value nodes must be a subset of the value of a given property." ; rdfs:label "Sub set of constraint component" ; sh:message "Must be one of the values of {$subSetOf}" ; sh:parameter dash:SubSetOfConstraintComponent-subSetOf ; sh:propertyValidator [ a sh:SPARQLAskValidator ; sh:ask """ASK { $this $subSetOf $value . }""" ; sh:prefixes <http://datashapes.org/dash> ; ] ; sh:validator [ a sh:JSValidator ; sh:jsFunctionName "validateSubSetOf" ; sh:jsLibrary dash:DASHJSLibrary ; ] ; . dash:SubSetOfConstraintComponent-subSetOf sh:targetClass sh:Shape ; . sh:Function dash:abstract "true"^^xsd:boolean ; sh:property [ sh:path dash:cachable ; sh:datatype xsd:boolean ; sh:name "sub-set of" ; sh:nodeKind sh:IRI ; . dash:SuccessResult a rdfs:Class ; rdfs:comment "A result representing a successfully validated constraint." ; rdfs:label "Success result" ; rdfs:subClassOf sh:AbstractResult ; . dash:SuccessTestCaseResult a rdfs:Class ; rdfs:comment "Represents a successful run of a test case." ; rdfs:label "Success test case result" ; rdfs:subClassOf dash:TestCaseResult ; . dash:Suggestion a rdfs:Class ; dash:abstract true ; rdfs:comment "Base class of suggestions that modify a graph to \"fix\" the source of a validation result." ; rdfs:label "Suggestion" ; rdfs:subClassOf rdfs:Resource ; . dash:SuggestionGenerator a rdfs:Class ; dash:abstract true ; rdfs:comment "Base class of objects that can generate suggestions (added or deleted triples) for a validation result of a given constraint component." ; rdfs:label "Suggestion generator" ; rdfs:subClassOf rdfs:Resource ; . dash:SuggestionResult a rdfs:Class ; rdfs:comment "Class of results that have been produced as suggestions, not through SHACL validation. How the actual results are produced is up to implementers. Each instance of this class should have values for sh:focusNode, sh:resultMessage, sh:resultSeverity (suggested default: sh:Info), and dash:suggestion to point at one or more suggestions." ; rdfs:label "Suggestion result" ; rdfs:subClassOf sh:AbstractResult ; . dash:SymmetricConstraintComponent a sh:ConstraintComponent ; rdfs:comment "A contraint component for property shapes to validate that a property is symmetric. For symmetric properties, if A relates to B then B must relate to A." ; rdfs:label "Symmetric constraint component" ; sh:message "Symmetric value expected" ; sh:parameter dash:SymmetricConstraintComponent-symmetric ; sh:propertyValidator [ a sh:JSValidator ; sh:jsFunctionName "validateSymmetric" ; sh:jsLibrary dash:DASHJSLibrary ; ] ; sh:propertyValidator [ a sh:SPARQLSelectValidator ; sh:prefixes <http://datashapes.org/dash> ; sh:select """SELECT $this ?value { FILTER ($symmetric) . $this $PATH ?value . FILTER NOT EXISTS { ?value $PATH $this . } }""" ; ] ; . dash:SymmetricConstraintComponent-symmetric a sh:Parameter ; sh:path dash:symmetric ; dash:reifiableBy dash:ConstraintReificationShape ; sh:datatype xsd:boolean ; sh:description "If set to true then if A relates to B then B must relate to A." ; sh:maxCount 1 ; sh:name "symmetric" ; . dash:TestCase a dash:ShapeClass ; dash:abstract true ; rdfs:comment "A test case to verify that a (SHACL-based) feature works as expected." ; rdfs:label "Test case" ; rdfs:subClassOf rdfs:Resource ; . dash:TestCaseResult a rdfs:Class ; dash:abstract true ; rdfs:comment "Base class for results produced by running test cases." ; rdfs:label "Test case result" ; rdfs:subClassOf sh:AbstractResult ; . dash:TestEnvironment a rdfs:Class ; dash:abstract true ; rdfs:comment "Abstract base class for test environments, holding information on how to set up a test case." ; rdfs:label "Test environment" ; rdfs:subClassOf rdfs:Resource ; . dash:TextAreaEditor a dash:SingleEditor ; rdfs:comment "A multi-line text area to enter the value of a literal." ; rdfs:label "Text area editor" ; . dash:TextAreaWithLangEditor a dash:SingleEditor ; rdfs:comment "A multi-line text area to enter the value of a literal and a drop down to select a language." ; rdfs:label "Text area with lang editor" ; . dash:TextFieldEditor a dash:SingleEditor ; rdfs:comment """A simple input field to enter the value of a literal, without the ability to change language or datatype. This is the fallback editor for any literal if no other editors are more suitable.""" ; rdfs:label "Text field editor" ; . dash:TextFieldWithLangEditor a dash:SingleEditor ; rdfs:comment "A single-line input field to enter the value of a literal and a drop down to select language, which is mandatory unless xsd:string is among the permissible datatypes." ; rdfs:label "Text field with lang editor" ; . dash:URIEditor a dash:SingleEditor ; rdfs:comment "An input field to enter the URI of a resource, e.g. rdfs:seeAlso links or images." ; rdfs:label "URI editor" ; . dash:URIViewer a dash:SingleViewer ; rdfs:comment "A Viewer for URI resources, rendering as a hyperlink to that URI. Also includes other ways of interacting with the URI such as opening a nested summary display." ; rdfs:label "URI viewer" ; . dash:UniqueValueForClassConstraintComponent a sh:ConstraintComponent ; dash:propertySuggestionGenerator tosh:DeleteTripleSuggestionGenerator ; rdfs:comment "A constraint component that can be used to state that the values of a property must be unique for all instances of a given class (and its subclasses)." ; rdfs:label "Unique value for class constraint component" ; sh:labelTemplate "Values must be unique among all instances of {?uniqueValueForClass}" ; sh:parameter dash:UniqueValueForClassConstraintComponent-uniqueValueForClass ; sh:propertyValidator [ a sh:JSValidator ; sh:jsFunctionName "validateUniqueValueForClass" ; sh:jsLibrary dash:DASHJSLibrary ; sh:message "Value {?value} must be unique but is also used by {?other}" ; ] ; sh:propertyValidator [ a sh:SPARQLSelectValidator ; sh:message "Value {?value} must be unique but is also used by {?other}" ; sh:prefixes <http://datashapes.org/dash> ; sh:select """SELECT DISTINCT $this ?value ?other WHERE { { $this $PATH ?value . ?other $PATH ?value . FILTER (?other != $this) . } ?other a ?type . ?type rdfs:subClassOf* $uniqueValueForClass . }""" ; ] ; . dash:UniqueValueForClassConstraintComponent-uniqueValueForClass a sh:Parameter ; sh:path dash:uniqueValueForClass ; dash:reifiableBy dash:ConstraintReificationShape ; sh:class rdfs:Class ; sh:description "States that the values of the property must be unique for all instances of a given class (and its subclasses)." ; sh:name "unique value for class" ; sh:nodeKind sh:IRI ; . dash:UntrustedHTMLViewer a dash:SingleViewer ; rdfs:comment "A Viewer for HTML content from untrusted sources. This viewer will sanitize the HTML before rendering. Any a, button, checkbox, form, hidden, input, img, script, select, style and textarea tags and class and style attributes will be removed." ; rdfs:label "Untrusted HTML viewer" ; . dash:ValidationTestCase a dash:ShapeClass ; dash:abstract true ; rdfs:comment "Abstract superclass for test cases concerning SHACL constraint validation. Future versions may add new kinds of validatin test cases, e.g. to validate a single resource only." ; rdfs:label "Validation test case" ; rdfs:subClassOf dash:TestCase ; . dash:ValueTableViewer a dash:MultiViewer ; rdfs:comment "A viewer that renders all values of a given property as a table, with one value per row, and the columns defined by the shape that is the sh:node or sh:class of the property." ; rdfs:label "Value table viewer" ; . dash:Viewer a dash:ShapeClass ; dash:abstract true ; rdfs:comment "The class of widgets for viewing value nodes." ; rdfs:label "Viewer" ; rdfs:subClassOf dash:Widget ; . dash:Widget a dash:ShapeClass ; dash:abstract true ; rdfs:comment "Base class of user interface components that can be used to display or edit value nodes." ; rdfs:label "Widget" ; rdfs:subClassOf rdfs:Resource ; . dash:abstract a rdf:Property ; rdfs:comment "Indicates that a class is \"abstract\" and cannot be used in asserted rdf:type triples. Only non-abstract subclasses of abstract classes should be instantiated directly." ; rdfs:domain rdfs:Class ; rdfs:label "abstract" ; rdfs:range xsd:boolean ; . dash:actionGroup a rdf:Property ; rdfs:comment "Links an Action with the ActionGroup that it should be arranged in." ; rdfs:domain dash:Action ; rdfs:label "action group" ; rdfs:range dash:ActionGroup ; . dash:actionIconClass a rdf:Property ; rdfs:comment "The (CSS) class of an Action for display purposes alongside the label." ; rdfs:domain dash:Action ; rdfs:label "action icon class" ; rdfs:range xsd:string ; . dash:addedTriple a rdf:Property ; rdfs:comment "May link a dash:GraphUpdate with one or more triples (represented as instances of rdf:Statement) that should be added to fix the source of the result." ; rdfs:domain dash:GraphUpdate ; rdfs:label "added triple" ; rdfs:range rdf:Statement ; . dash:all a rdfs:Resource ; rdfs:comment "Represents all users/roles, for example as a possible value of the default view for role property." ; rdfs:label "all" ; . dash:apiStatus a rdf:Property ; rdfs:comment "Defines how and whether the associated feature
6
Alignment with latest snapshot from TopBraid code base (including various fixes). And #32
1
.ttl
ttl
apache-2.0
TopQuadrant/shacl
175
<NME> dash.ttl <BEF> # baseURI: http://datashapes.org/dash # imports: http://topbraid.org/tosh # imports: http://www.w3.org/ns/shacl# # prefix: dash @prefix dash: <http://datashapes.org/dash#> . @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 tosh: <http://topbraid.org/tosh#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . <http://datashapes.org/dash> a owl:Ontology ; rdfs:comment "DASH is a SHACL library for frequently needed features and design patterns. The constraint components in this library are 100% standards compliant and will work on any engine that fully supports SHACL." ; rdfs:label "DASH Data Shapes Vocabulary" ; owl:imports <http://topbraid.org/tosh> ; owl:imports sh: ; sh:declare [ sh:namespace "http://datashapes.org/dash#"^^xsd:anyURI ; sh:prefix "dash" ; ] ; sh:declare [ sh:namespace "http://purl.org/dc/terms/"^^xsd:anyURI ; sh:prefix "dcterms" ; ] ; sh:declare [ sh:namespace "http://www.w3.org/1999/02/22-rdf-syntax-ns#"^^xsd:anyURI ; sh:prefix "rdf" ; ] ; sh:declare [ sh:namespace "http://www.w3.org/2000/01/rdf-schema#"^^xsd:anyURI ; sh:prefix "rdfs" ; ] ; sh:declare [ sh:namespace "http://www.w3.org/2001/XMLSchema#"^^xsd:anyURI ; sh:prefix "xsd" ; ] ; sh:declare [ sh:namespace "http://www.w3.org/2002/07/owl#"^^xsd:anyURI ; sh:prefix "owl" ; ] ; sh:declare [ sh:namespace "http://www.w3.org/2004/02/skos/core#"^^xsd:anyURI ; sh:prefix "skos" ; ] ; . dash:APIStatus a rdfs:Class ; a sh:NodeShape ; rdfs:comment "The class of possible values for dash:apiStatus." ; rdfs:label "API Status" ; rdfs:subClassOf rdfs:Resource ; . dash:Action a dash:ShapeClass ; dash:abstract true ; rdfs:comment "An executable command triggered by an agent, backed by a Script implementation. Actions may get deactivated using sh:deactivated." ; rdfs:label "Action" ; rdfs:subClassOf dash:Script ; rdfs:subClassOf sh:Parameterizable ; . dash:ActionGroup a dash:ShapeClass ; rdfs:comment "A group of ResourceActions, used to arrange items in menus etc. Similar to sh:PropertyGroups, they may have a sh:order and should have labels (in multiple languages if applicable)." ; rdfs:label "Action group" ; rdfs:subClassOf rdfs:Resource ; . dash:ActionTestCase a dash:ShapeClass ; rdfs:comment """A test case that evaluates a dash:Action using provided input parameters. Requires exactly one value for dash:action and will operate on the test case's graph (with imports) as both data and shapes graph. Currently only supports read-only actions, allowing the comparison of actual results with the expected results.""" ; rdfs:label "Action test case" ; rdfs:subClassOf dash:TestCase ; . dash:AllObjects a dash:AllObjectsTarget ; rdfs:comment "A reusable instance of dash:AllObjectsTarget." ; rdfs:label "All objects" ; . dash:AllObjectsTarget a sh:JSTargetType ; a sh:SPARQLTargetType ; rdfs:comment "A target containing all objects in the data graph as focus nodes." ; rdfs:label "All objects target" ; rdfs:subClassOf sh:Target ; sh:jsFunctionName "dash_allObjects" ; sh:jsLibrary dash:DASHJSLibrary ; sh:labelTemplate "All objects" ; sh:prefixes <http://datashapes.org/dash> ; sh:select """SELECT DISTINCT ?this WHERE { ?anyS ?anyP ?this . }""" ; . dash:AllSubjects a dash:AllSubjectsTarget ; rdfs:comment "A reusable instance of dash:AllSubjectsTarget." ; rdfs:label "All subjects" ; . dash:AllSubjectsTarget a sh:JSTargetType ; a sh:SPARQLTargetType ; rdfs:comment "A target containing all subjects in the data graph as focus nodes." ; rdfs:label "All subjects target" ; rdfs:subClassOf sh:Target ; sh:jsFunctionName "dash_allSubjects" ; sh:jsLibrary dash:DASHJSLibrary ; sh:labelTemplate "All subjects" ; sh:prefixes <http://datashapes.org/dash> ; sh:select """SELECT DISTINCT ?this WHERE { ?this ?anyP ?anyO . }""" ; . dash:AutoCompleteEditor a dash:SingleEditor ; rdfs:comment "An auto-complete field to enter the label of instances of a class. This is the fallback editor for any URI resource if no other editors are more suitable." ; rdfs:label "Auto-complete editor" ; . dash:BlankNodeViewer a dash:SingleViewer ; rdfs:comment "A Viewer for blank nodes, rendering as the label of the blank node." ; rdfs:label "Blank node viewer" ; . dash:BooleanSelectEditor a dash:SingleEditor ; rdfs:comment """An editor for boolean literals, rendering as a select box with values true and false. Also displays the current value (such as \"1\"^^xsd:boolean), but only allows to switch to true or false.""" ; rdfs:label "Boolean select editor" ; . dash:ChangeScript a dash:ShapeClass ; rdfs:comment """Class of ADS scripts that are executed after edits to the data graph were made. These scripts may access the current changes from the graphs with names dataset.addedGraphURI and dataset.deletedGraphURI to learn about which resource values have been added or deleted. For example query them using graph.withDataGraph(dataset.addedGraphURI, ...) or via SPARQL's GRAPH keyword. Change scripts may then perform further changes which would again become visible to other change scripts. Change scripts are executed by their relative sh:order, with a default value of 0. Use lower values to execute before other rules.""" ; rdfs:label "Change script" ; rdfs:subClassOf dash:Script ; . dash:ClosedByTypesConstraintComponent a sh:ConstraintComponent ; rdfs:comment "A constraint component that can be used to declare that focus nodes are \"closed\" based on their rdf:types, meaning that focus nodes may only have values for the properties that are explicitly enumerated via sh:property/sh:path in property constraints at their rdf:types and the superclasses of those. This assumes that the type classes are also shapes." ; rdfs:label "Closed by types constraint component" ; sh:nodeValidator [ a sh:JSValidator ; sh:jsFunctionName "validateClosedByTypesNode" ; sh:jsLibrary dash:DASHJSLibrary ; sh:message "Property is not among those permitted for any of the types" ; ] ; sh:nodeValidator [ a sh:SPARQLSelectValidator ; sh:message "Property {?path} is not among those permitted for any of the types" ; sh:prefixes <http://datashapes.org/dash> ; sh:select """SELECT $this (?predicate AS ?path) ?value WHERE { FILTER ($closedByTypes) . $this ?predicate ?value . FILTER (?predicate != rdf:type) . FILTER NOT EXISTS { $this rdf:type ?type . ?type rdfs:subClassOf* ?class . GRAPH $shapesGraph { ?class sh:property/sh:path ?predicate . } } }""" ; ] ; sh:parameter dash:ClosedByTypesConstraintComponent-closedByTypes ; . dash:ClosedByTypesConstraintComponent-closedByTypes a sh:Parameter ; sh:path dash:closedByTypes ; dash:reifiableBy dash:ConstraintReificationShape ; sh:datatype xsd:boolean ; sh:description "True to indicate that the focus nodes are closed by their types. A constraint violation is reported for each property value of the focus node where the property is not among those that are explicitly declared via sh:property/sh:path in any of the rdf:types of the focus node (and their superclasses). The property rdf:type is always permitted." ; sh:maxCount 1 ; . dash:CoExistsWithConstraintComponent a sh:ConstraintComponent ; dash:localConstraint true ; rdfs:comment "A constraint component that can be used to express a constraint on property shapes so that if the property path has any value then the given property must also have a value, and vice versa." ; rdfs:label "Co-exists-with constraint component" ; sh:message "Values must co-exist with values of {$coExistsWith}" ; sh:parameter dash:CoExistsWithConstraintComponent-coExistsWith ; sh:propertyValidator [ a sh:JSValidator ; sh:jsFunctionName "validateCoExistsWith" ; sh:jsLibrary dash:DASHJSLibrary ; ] ; sh:propertyValidator [ a sh:SPARQLSelectValidator ; sh:prefixes <http://datashapes.org/dash> ; sh:select """SELECT $this WHERE { { FILTER (EXISTS { $this $PATH ?any } && NOT EXISTS { $this $coExistsWith ?any }) } UNION { FILTER (NOT EXISTS { $this $PATH ?any } && EXISTS { $this $coExistsWith ?any }) } }""" ; ] ; . dash:CoExistsWithConstraintComponent-coExistsWith a sh:Parameter ; sh:path dash:coExistsWith ; dash:editor dash:PropertyAutoCompleteEditor ; dash:reifiableBy dash:ConstraintReificationShape ; dash:viewer dash:PropertyLabelViewer ; sh:description "The properties that must co-exist with the surrounding property (path). If the surrounding property path has any value then the given property must also have a value, and vice versa." ; sh:name "co-exists with" ; sh:nodeKind sh:IRI ; . dash:ConstraintReificationShape a sh:NodeShape ; rdfs:comment "Can be used to attach sh:severity and sh:messages to individual constraints using reification." ; rdfs:label "Constraint reification shape" ; sh:property dash:ConstraintReificationShape-message ; sh:property dash:ConstraintReificationShape-severity ; . dash:ConstraintReificationShape-message a sh:PropertyShape ; sh:path sh:message ; dash:singleLine true ; sh:name "messages" ; sh:nodeKind sh:Literal ; sh:or dash:StringOrLangString ; . dash:ConstraintReificationShape-severity a sh:PropertyShape ; sh:path sh:severity ; sh:class sh:Severity ; sh:maxCount 1 ; sh:name "severity" ; sh:nodeKind sh:IRI ; . dash:Constructor a dash:ShapeClass ; rdfs:comment """A script that is executed when a new instance of the class associated via dash:constructor is created, e.g. from a New button. Such scripts typically declare one or more parameters that are collected from the user when the script starts. The values of these parameters can be used as named variables in the script for arbitrary purposes such as setting the URI or initializing some property values of the new instance. The variable focusNode will hold the named node of the selected type, for example when a constructor is associated with a superclass but the user has pressed New for a subclass. The last expression of the script will be used as result of the constructor, so that the surrounding tool knows which resource shall be navigated to next.""" ; rdfs:label "Constructor" ; rdfs:subClassOf dash:Script ; rdfs:subClassOf sh:Parameterizable ; . dash:DASHJSLibrary a sh:JSLibrary ; rdfs:label "DASH JavaScript library" ; sh:jsLibrary dash:RDFQueryJSLibrary ; sh:jsLibraryURL "http://datashapes.org/js/dash.js"^^xsd:anyURI ; . dash:DateOrDateTime a rdf:List ; rdf:first [ sh:datatype xsd:date ; ] ; rdf:rest ( [ sh:datatype xsd:dateTime ; ] ) ; rdfs:comment "An rdf:List that can be used in property constraints as value for sh:or to indicate that all values of a property must be either xsd:date or xsd:dateTime." ; rdfs:label "Date or date time" ; . dash:DatePickerEditor a dash:SingleEditor ; rdfs:comment "An editor for xsd:date literals, offering a calendar-like date picker." ; rdfs:label "Date picker editor" ; . dash:DateTimePickerEditor a dash:SingleEditor ; rdfs:comment "An editor for xsd:dateTime literals, offering a calendar-like date picker and a time selector." ; rdfs:label "Date time picker editor" ; . dash:DepictionRole a dash:PropertyRole ; rdfs:comment "Depiction properties provide images representing the focus nodes. Typical examples may be a photo of an animal or the map of a country." ; rdfs:label "Depiction" ; . dash:Deprecated a dash:APIStatus ; rdfs:comment "Features that have been marked deprecated will remain in the API but should no longer be used by new code and may get deleted in the foreseeable future (e.g., with the next major release)." ; rdfs:label "deprecated" ; . dash:DescriptionRole a dash:PropertyRole ; rdfs:comment "Description properties should produce text literals that may be used as an introduction/summary of what a focus node does." ; rdfs:label "Description" ; . dash:DetailsEditor a dash:SingleEditor ; rdfs:comment "An editor for non-literal values, typically displaying a nested form where the values of the linked resource can be edited directly on the \"parent\" form. Implementations that do not support this (yet) could fall back to an auto-complete widget." ; rdfs:label "Details editor" ; . dash:DetailsViewer a dash:SingleViewer ; rdfs:comment "A Viewer for resources that shows the details of the value using its default view shape as a nested form-like display." ; rdfs:label "Details viewer" ; . dash:Editor a dash:ShapeClass ; dash:abstract true ; rdfs:comment "The class of widgets for editing value nodes." ; rdfs:label "Editor" ; rdfs:subClassOf dash:Widget ; . dash:EnumSelectEditor a dash:SingleEditor ; rdfs:comment "A drop-down editor for enumerated values (typically based on sh:in lists)." ; rdfs:label "Enum select editor" ; . dash:ExecutionPlatform a rdfs:Class ; rdfs:comment "An platform (such as TopBraid) that may have features needed to execute, for example, SPARQL queries." ; rdfs:label "Execution platform" ; rdfs:subClassOf rdfs:Resource ; . dash:Experimental a dash:APIStatus ; rdfs:comment "Features that are marked experimental can be used by early adopters but there is no guarantee that they will reach stable state." ; rdfs:label "experimental" ; . dash:ExploreAction a dash:ShapeClass ; rdfs:comment "An action typically showing up in an Explore section of a selected resource. Cannot make changes to the data." ; rdfs:label "Explore action" ; rdfs:subClassOf dash:ResourceAction ; . dash:FailureResult a rdfs:Class ; rdfs:comment "A result representing a validation failure such as an unsupported recursion." ; rdfs:label "Failure result" ; rdfs:subClassOf sh:AbstractResult ; . dash:FailureTestCaseResult a rdfs:Class ; rdfs:comment "Represents a failure of a test case." ; rdfs:label "Failure test case result" ; rdfs:subClassOf dash:TestCaseResult ; . dash:FunctionTestCase a dash:ShapeClass ; rdfs:comment "A test case that verifies that a given SPARQL expression produces a given, expected result." ; rdfs:label "Function test case" ; rdfs:subClassOf dash:TestCase ; . dash:GraphService a dash:ShapeClass ; rdfs:comment "A service that does not apply to a specific resource (as ResourceService does) but operates on the whole graph. The focusNode variable will be the URI of the current base graph (e.g. <urn:x-evn-master:geo> as a NamedNode." ; rdfs:label "Graph service" ; rdfs:subClassOf dash:Service ; . dash:GraphStoreTestCase a dash:ShapeClass ; rdfs:comment "A test case that can be used to verify that an RDF file could be loaded (from a file) and that the resulting RDF graph is equivalent to a given TTL file." ; rdfs:label "Graph store test case" ; rdfs:subClassOf dash:TestCase ; . dash:GraphUpdate a rdfs:Class ; rdfs:comment "A suggestion consisting of added and/or deleted triples, represented as rdf:Statements via dash:addedTriple and dash:deletedTriple." ; rdfs:label "Graph update" ; rdfs:subClassOf dash:Suggestion ; . dash:GraphValidationTestCase a dash:ShapeClass ; rdfs:comment "A test case that performs SHACL constraint validation on the whole graph and compares the results with the expected validation results stored with the test case. By default this excludes meta-validation (i.e. the validation of the shape definitions themselves). If that's desired, set dash:validateShapes to true." ; rdfs:label "Graph validation test case" ; rdfs:subClassOf dash:ValidationTestCase ; . dash:HTMLOrStringOrLangString a rdf:List ; rdf:first [ sh:datatype rdf:HTML ; ] ; rdf:rest ( [ sh:datatype xsd:string ; ] [ sh:datatype rdf:langString ; ] ) ; rdfs:comment "An rdf:List that can be used in property constraints as value for sh:or to indicate that all values of a property must be either rdf:HTML, xsd:string or rdf:langString (in that order of preference)." ; rdfs:label "HTML or string or langString" ; . dash:HTMLViewer a dash:SingleViewer ; rdfs:comment "A Viewer for HTML encoded text from rdf:HTML literals, rendering as parsed HTML DOM elements. Also displays the language if the HTML has a lang attribute on its root DOM element." ; rdfs:label "HTML viewer" ; . dash:HasValueInConstraintComponent a sh:ConstraintComponent ; rdfs:comment "A constraint component that can be used to express a constraint on property shapes so that one of the values of the property path must be a member of a given list of nodes." ; rdfs:label "Has value in constraint component" ; sh:message "At least one of the values must be in {$hasValueIn}" ; sh:parameter dash:HasValueInConstraintComponent-hasValueIn ; sh:propertyValidator [ a sh:SPARQLSelectValidator ; sh:prefixes <http://datashapes.org/dash> ; sh:select """SELECT $this WHERE { FILTER NOT EXISTS { $this $PATH ?value . GRAPH $shapesGraph { $hasValueIn rdf:rest*/rdf:first ?value . } } }""" ; ] ; . dash:HasValueInConstraintComponent-hasValueIn a sh:Parameter ; sh:path dash:hasValueIn ; dash:reifiableBy dash:ConstraintReificationShape ; sh:description "At least one of the value nodes must be a member of the given list." ; sh:name "has value in" ; sh:node dash:ListShape ; . dash:HasValueTarget a sh:SPARQLTargetType ; rdfs:comment "A target type for all subjects where a given predicate has a certain object value." ; rdfs:label "Has Value target" ; rdfs:subClassOf sh:Target ; sh:labelTemplate "All subjects where {$predicate} has value {$object}" ; sh:parameter [ a sh:Parameter ; sh:path dash:object ; sh:description "The value that is expected to be present." ; sh:name "object" ; ] ; sh:parameter [ a sh:Parameter ; sh:path dash:predicate ; sh:description "The predicate property." ; sh:name "predicate" ; sh:nodeKind sh:IRI ; ] ; sh:prefixes <http://datashapes.org/dash> ; sh:select """SELECT DISTINCT ?this WHERE { ?this $predicate $object . }""" ; . dash:HasValueWithClassConstraintComponent a sh:ConstraintComponent ; rdfs:comment "A constraint component that can be used to express a constraint on property shapes so that one of the values of the property path must be an instance of a given class." ; rdfs:label "Has value with class constraint component" ; sh:message "At least one of the values must be an instance of class {$hasValueWithClass}" ; sh:parameter dash:HasValueWithClassConstraintComponent-hasValueWithClass ; sh:propertyValidator [ a sh:JSValidator ; sh:jsFunctionName "validateHasValueWithClass" ; sh:jsLibrary dash:DASHJSLibrary ; ] ; sh:propertyValidator [ a sh:SPARQLSelectValidator ; sh:prefixes <http://datashapes.org/dash> ; sh:select """SELECT $this WHERE { FILTER NOT EXISTS { $this $PATH ?value . ?value a ?type . ?type rdfs:subClassOf* $hasValueWithClass . } }""" ; ] ; . dash:HasValueWithClassConstraintComponent-hasValueWithClass a sh:Parameter ; sh:path dash:hasValueWithClass ; dash:reifiableBy dash:ConstraintReificationShape ; sh:class rdfs:Class ; sh:description "One of the values of the property path must be an instance of the given class." ; sh:name "has value with class" ; sh:nodeKind sh:IRI ; . dash:HyperlinkViewer a dash:SingleViewer ; rdfs:comment """A Viewer for literals, rendering as a hyperlink to a URL. For literals it assumes the lexical form is the URL. This is often used as default viewer for xsd:anyURI literals. Unsupported for blank nodes.""" ; rdfs:label "Hyperlink viewer" ; . dash:IDRole a dash:PropertyRole ; rdfs:comment "ID properties are short strings or other literals that identify the focus node among siblings. Examples may include social security numbers." ; rdfs:label "ID" ; . dash:IconRole a dash:PropertyRole ; rdfs:comment """Icon properties produce images that are typically small and almost square-shaped, and that may be displayed in the upper left corner of a focus node's display. Values should be xsd:string or xsd:anyURI literals or IRI nodes pointing at URLs. Those URLs should ideally be vector graphics such as .svg files. Instances of the same class often have the same icon, and this icon may be computed using a sh:values rule or as sh:defaultValue. If the value is a relative URL then those should be resolved against the server that delivered the surrounding page.""" ; rdfs:label "Icon" ; . dash:ImageViewer a dash:SingleViewer ; rdfs:comment "A Viewer for URI values that are recognized as images by a browser, rendering as an image." ; rdfs:label "Image viewer" ; . dash:IncludedScript a dash:ShapeClass ; rdfs:comment """The code associated with instances of this class will get injected into the generated APIs, as global code snippets. Typically used to declare libraries of utility functions or constants that are (compared to shape scripts) not necessarily associated with specific classes or shapes. Note that the JavaScript code stored in dash:js cannot use the export keyword because the code must also work in external scripts (such as on Node.js). Instead, you need to enumerate the exported symbols via dash:exports.""" ; rdfs:label "Included script" ; rdfs:subClassOf dash:Script ; sh:property tosh:IncludedScript-exports ; . dash:IndexedConstraintComponent a sh:ConstraintComponent ; rdfs:comment "A constraint component that can be used to mark property shapes to be indexed, meaning that each of its value nodes must carry a dash:index from 0 to N." ; rdfs:label "Indexed constraint component" ; sh:parameter dash:IndexedConstraintComponent-indexed ; . dash:IndexedConstraintComponent-indexed a sh:Parameter ; sh:path dash:indexed ; dash:reifiableBy dash:ConstraintReificationShape ; sh:datatype xsd:boolean ; sh:description "True to activate indexing for this property." ; sh:maxCount 1 ; sh:name "indexed" ; . dash:InferencingTestCase a dash:ShapeClass ; rdfs:comment "A test case to verify whether an inferencing engine is producing identical results to those stored as expected results." ; rdfs:label "Inferencing test case" ; rdfs:subClassOf dash:TestCase ; . dash:InlineViewer a dash:MultiViewer ; rdfs:comment "A multi-viewer that renders all values horizontally, in a more compact form that just a single value per row." ; rdfs:label "Inline viewer" ; . dash:InstancesSelectEditor a dash:SingleEditor ; rdfs:comment "A drop-down editor for all instances of the target class (based on sh:class of the property)." ; rdfs:label "Instances select editor" ; . dash:JSONTableViewer a dash:SingleViewer ; rdfs:comment """A tabular viewer for rdf:JSON literals with a lexical form in the following format: { vars: [ 'col1', 'col2' ], // These are the column keys headerLabels: [ 'Column 1', 'Column 2' ], // Optional, for the column headers bindings: [ // These become the rows { col1: { lex: 'Value2', datatype: '...#string', }, col2: { uri: 'http://.../Instance', label: 'Example Instance', }, }, ... ], } The resulting table will use the headerLabels (if they exist) as column headers, otherwise derive the headers from the variable names. The vars must match the fields in the bindings. The table will contain one row for each binding. Using Active Data Shapes, you can construct such literals dynamically using a sh:values rule, e.g. ex:MyClass-myProperty a sh:PropertyShape ; sh:path ex:myProperty ; sh:values [ dash:js \"\"\" DataViewers.createTableViewerJSON(focusNode.select(` SELECT ?col1 ?col2 WHERE { $this ex:prop1 ?col1 . $this ex:prop2 ?col2 . } `))\"\"\" ] . You may also produce the JSON literal programmatically in JavaScript, or assert the triples by other means.""" ; rdfs:label "JSON table viewer" ; . dash:JSTestCase a dash:ShapeClass ; rdfs:comment "A test case that calls a given SHACL-JS JavaScript function like a sh:JSFunction and compares its result with the dash:expectedResult." ; rdfs:label "SHACL-JS test case" ; rdfs:subClassOf dash:TestCase ; rdfs:subClassOf sh:JSFunction ; . dash:KeyInfoRole a dash:PropertyRole ; rdfs:comment "The Key info role may be assigned to properties that are likely of special interest to a reader, so that they should appear whenever a summary of a focus node is shown." ; rdfs:label "Key info" ; . dash:LabelRole a dash:PropertyRole ; rdfs:comment "Properties with this role produce strings that may serve as display label for the focus nodes. Labels should be either plain string literals or strings with a language tag. The values should also be single-line." ; rdfs:label "Label" ; . dash:LabelViewer a dash:SingleViewer ; rdfs:comment "A Viewer for URI resources, rendering as a hyperlink to that URI based on the display label of the resource. Also includes other ways of interacting with the URI such as opening a nested summary display." ; rdfs:label "Label viewer" ; . dash:LangStringViewer a dash:SingleViewer ; rdfs:comment "A Viewer for literals with a language tag, rendering as the text plus a language indicator." ; rdfs:label "LangString viewer" ; . dash:ListNodeShape a sh:NodeShape ; rdfs:comment "Defines constraints on what it means for a node to be a node within a well-formed RDF list. Note that this does not check whether the rdf:rest items are also well-formed lists as this would lead to unsupported recursion." ; rdfs:label "List node shape" ; sh:or ( [ sh:hasValue () ; sh:property [ a sh:PropertyShape ; sh:path rdf:first ; sh:maxCount 0 ; ] ; sh:property [ a sh:PropertyShape ; sh:path rdf:rest ; sh:maxCount 0 ; ] ; ] [ sh:not [ sh:hasValue () ; ] ; sh:property [ a sh:PropertyShape ; sh:path rdf:first ; sh:maxCount 1 ; sh:minCount 1 ; ] ; sh:property [ a sh:PropertyShape ; sh:path rdf:rest ; sh:maxCount 1 ; sh:minCount 1 ; ] ; ] ) ; . dash:ListShape a sh:NodeShape ; rdfs:comment """Defines constraints on what it means for a node to be a well-formed RDF list. The focus node must either be rdf:nil or not recursive. Furthermore, this shape uses dash:ListNodeShape as a \"helper\" to walk through all members of the whole list (including itself).""" ; rdfs:label "List shape" ; sh:or ( [ sh:hasValue () ; ] [ sh:not [ sh:hasValue () ; ] ; sh:property [ a sh:PropertyShape ; sh:path [ sh:oneOrMorePath rdf:rest ; ] ; dash:nonRecursive true ; ] ; ] ) ; sh:property [ a sh:PropertyShape ; sh:path [ sh:zeroOrMorePath rdf:rest ; ] ; rdfs:comment "Each list member (including this node) must be have the shape dash:ListNodeShape." ; sh:node dash:ListNodeShape ; ] ; . dash:LiteralViewer a dash:SingleViewer ; rdfs:comment "A simple viewer for literals, rendering the lexical form of the value." ; rdfs:label "Literal viewer" ; . dash:ModifyAction a dash:ShapeClass ; rdfs:comment "An action typically showing up in a Modify section of a selected resource. May make changes to the data." ; rdfs:label "Modify action" ; rdfs:subClassOf dash:ResourceAction ; . dash:MultiEditor a dash:ShapeClass ; rdfs:comment "An editor for multiple/all value nodes at once." ; rdfs:label "Multi editor" ; rdfs:subClassOf dash:Editor ; . dash:MultiFunction a rdfs:Class ; a sh:NodeShape ; rdfs:comment """A multi-function is a function that can return zero or more result objects consisting of one or more result variables. While normal (SPARQL/SHACL) functions can only return a single result node, multi-functions may not only return multiple nodes but even multiple individual variables per solution. A common way of defining multi-functions is by wrapping a SPARQL SELECT query, using dash:SPARQLMultiFunction. However, some MultiFunctions (in TopBraid) may also be implemented natively.""" ; rdfs:label "Multi-function" ; rdfs:subClassOf sh:Parameterizable ; sh:nodeKind sh:IRI ; . dash:MultiViewer a dash:ShapeClass ; rdfs:comment "A viewer for multiple/all values at once." ; rdfs:label "Multi viewer" ; rdfs:subClassOf dash:Viewer ; . dash:NoSuitableEditor a dash:SingleEditor ; rdfs:comment "An \"editor\" that simply informs the user that the values cannot be edited here, but for example through source code editing." ; rdfs:label "No suitable editor" ; . dash:NodeExpressionViewer a dash:SingleViewer ; rdfs:comment "A viewer for SHACL Node Expressions."^^rdf:HTML ; rdfs:label "Node expression viewer" ; . dash:NonRecursiveConstraintComponent a sh:ConstraintComponent ; rdfs:comment "Used to state that a property or path must not point back to itself." ; rdfs:label "Non-recursive constraint component" ; sh:message "Points back at itself (recursively)" ; sh:parameter dash:NonRecursiveConstraintComponent-nonRecursive ; sh:propertyValidator [ a sh:JSValidator ; sh:jsFunctionName "validateNonRecursiveProperty" ; sh:jsLibrary dash:DASHJSLibrary ; ] ; sh:propertyValidator [ a sh:SPARQLSelectValidator ; sh:prefixes <http://datashapes.org/dash> ; sh:select """SELECT DISTINCT $this ($this AS ?value) WHERE { { FILTER (?nonRecursive) } $this $PATH $this . }""" ; ] ; . dash:NonRecursiveConstraintComponent-nonRecursive a sh:Parameter ; sh:path dash:nonRecursive ; dash:reifiableBy dash:ConstraintReificationShape ; sh:datatype xsd:boolean ; sh:description """Used to state that a property or path must not point back to itself. For example, \"a person cannot have itself as parent\" can be expressed by setting dash:nonRecursive=true for a given sh:path. To express that a person cannot have itself among any of its (recursive) parents, use a sh:path with the + operator such as ex:parent+.""" ; sh:maxCount 1 ; sh:name "non-recursive" ; . dash:None a sh:NodeShape ; rdfs:comment "A Shape that is no node can conform to." ; rdfs:label "None" ; sh:in () ; . dash:ParameterConstraintComponent a sh:ConstraintComponent ; rdfs:comment "A constraint component that can be used to verify that all value nodes conform to the given Parameter."@en ; rdfs:label "Parameter constraint component"@en ; sh:parameter dash:ParameterConstraintComponent-parameter ; . dash:ParameterConstraintComponent-parameter a sh:Parameter ; sh:path sh:parameter ; . dash:PrimaryKeyConstraintComponent a sh:ConstraintComponent ; dash:localConstraint true ; rdfs:comment "Enforces a constraint that the given property (sh:path) serves as primary key for all resources in the target of the shape. If a property has been declared to be the primary key then each resource must have exactly one value for that property. Furthermore, the URIs of those resources must start with a given string (dash:uriStart), followed by the URL-encoded primary key value. For example if dash:uriStart is \"http://example.org/country-\" and the primary key for an instance is \"de\" then the URI must be \"http://example.org/country-de\". Finally, as a result of the URI policy, there can not be any other resource with the same value under the same primary key policy." ; rdfs:label "Primary key constraint component" ; sh:labelTemplate "The property {?predicate} is the primary key and URIs start with {?uriStart}" ; sh:message "Violation of primary key constraint" ; sh:parameter dash:PrimaryKeyConstraintComponent-uriStart ; sh:propertyValidator [ a sh:JSValidator ; sh:jsFunctionName "validatePrimaryKeyProperty" ; sh:jsLibrary dash:DASHJSLibrary ; ] ; sh:propertyValidator [ a sh:SPARQLSelectValidator ; sh:prefixes <http://datashapes.org/dash> ; sh:select """SELECT DISTINCT $this WHERE { FILTER ( # Must have a value for the primary key NOT EXISTS { ?this $PATH ?any } || # Must have no more than one value for the primary key EXISTS { ?this $PATH ?value1 . ?this $PATH ?value2 . FILTER (?value1 != ?value2) . } || # The value of the primary key must align with the derived URI EXISTS { { ?this $PATH ?value . FILTER NOT EXISTS { ?this $PATH ?value2 . FILTER (?value != ?value2) } } BIND (CONCAT($uriStart, ENCODE_FOR_URI(str(?value))) AS ?uri) . FILTER (str(?this) != ?uri) . } ) }""" ; ] ; . dash:PrimaryKeyConstraintComponent-uriStart a sh:Parameter ; sh:path dash:uriStart ; dash:reifiableBy dash:ConstraintReificationShape ; sh:datatype xsd:string ; sh:description "The start of the URIs of well-formed resources. If specified then the associated property/path serves as \"primary key\" for all target nodes (instances). All such target nodes need to have a URI that starts with the given string, followed by the URI-encoded value of the primary key property." ; sh:maxCount 1 ; sh:name "URI start" ; . dash:PropertyAutoCompleteEditor a dash:SingleEditor ; rdfs:comment "An editor for properties that are either defined as instances of rdf:Property or used as IRI values of sh:path. The component uses auto-complete to find these properties by their rdfs:labels or sh:names." ; rdfs:label "Property auto-complete editor" ; . dash:PropertyLabelViewer a dash:SingleViewer ; rdfs:comment "A viewer for properties that renders a hyperlink using the display label or sh:name, allowing users to either navigate to the rdf:Property resource or the property shape definition. Should be used in conjunction with PropertyAutoCompleteEditor." ; rdfs:label "Property label viewer" ; . dash:PropertyRole a rdfs:Class ; a sh:NodeShape ; rdfs:comment "The class of roles that a property (shape) may take for its focus nodes." ; rdfs:label "Property role" ; rdfs:subClassOf rdfs:Resource ; . dash:QueryTestCase a dash:ShapeClass ; rdfs:comment "A test case running a given SPARQL SELECT query and comparing its results with those stored as JSON Result Set in the expected result property." ; rdfs:label "Query test case" ; rdfs:subClassOf dash:TestCase ; rdfs:subClassOf sh:SPARQLSelectExecutable ; . dash:RDFQueryJSLibrary a sh:JSLibrary ; rdfs:label "rdfQuery JavaScript Library" ; sh:jsLibraryURL "http://datashapes.org/js/rdfquery.js"^^xsd:anyURI ; . dash:ReifiableByConstraintComponent a sh:ConstraintComponent ; rdfs:label "Reifiable-by constraint component" ; sh:labelTemplate "Reifiable by {$reifiableBy}" ; sh:parameter dash:ReifiableByConstraintComponent-reifiableBy ; . dash:ReifiableByConstraintComponent-reifiableBy a sh:Parameter ; sh:path dash:reifiableBy ; sh:class sh:NodeShape ; sh:description "Can be used to specify the node shape that may be applied to reified statements produced by a property shape. The property shape must have a URI resource as its sh:path. The values of this property must be node shapes. User interfaces can use this information to determine which properties to present to users when reified statements are explored or edited. Also, SHACL validators can use it to determine how to validate reified triples. Use dash:None to indicate that no reification should be permitted." ; sh:maxCount 1 ; sh:name "reifiable by" ; sh:nodeKind sh:IRI ; . dash:ResourceAction a dash:ShapeClass ; dash:abstract true ; rdfs:comment "An Action that can be executed for a selected resource. Such Actions show up in context menus once they have been assigned a sh:group." ; rdfs:label "Resource action" ; rdfs:subClassOf dash:Action ; . dash:ResourceService a dash:ShapeClass ; rdfs:comment "A Service that can (and must) be applied to a given resource as focus node. Use dash:resourceService to link a class to the services that apply to its instances." ; rdfs:label "Resource service" ; rdfs:subClassOf dash:Service ; . dash:RichTextEditor a dash:SingleEditor ; rdfs:comment "A rich text editor to enter the lexical value of a literal and a drop down to select language. The selected language is stored in the HTML lang attribute of the root node in the HTML DOM tree." ; rdfs:label "Rich text editor" ; . dash:RootClassConstraintComponent a sh:ConstraintComponent ; rdfs:comment "A constraint component defining the parameter dash:rootClass, which restricts the values to be either the root class itself or one of its subclasses. This is typically used in conjunction with properties that have rdfs:Class as their type." ; rdfs:label "Root class constraint component" ; sh:labelTemplate "Root class {$rootClass}" ; sh:message "Value must be subclass of {$rootClass}" ; sh:parameter dash:RootClassConstraintComponent-rootClass ; sh:validator dash:hasRootClass ; sh:validator [ a sh:JSValidator ; sh:jsFunctionName "validateRootClass" ; sh:jsLibrary dash:DASHJSLibrary ; ] ; . dash:RootClassConstraintComponent-rootClass a sh:Parameter ; sh:path dash:rootClass ; dash:reifiableBy dash:ConstraintReificationShape ; sh:class rdfs:Class ; sh:description "The root class." ; sh:name "root class" ; sh:nodeKind sh:IRI ; . dash:SPARQLConstructTemplate a rdfs:Class ; rdfs:comment "Encapsulates one or more SPARQL CONSTRUCT queries that can be parameterized. Parameters will become pre-bound variables in the queries." ; rdfs:label "SPARQL CONSTRUCT template" ; rdfs:subClassOf sh:Parameterizable ; rdfs:subClassOf sh:SPARQLConstructExecutable ; . dash:SPARQLMultiFunction a rdfs:Class ; a sh:NodeShape ; rdfs:comment "A multi-function based on a SPARQL SELECT query. The query gets executed with the arguments pre-bound to the variables declared as parameters. The results of the multi-function are all result bindings from the SPARQL result set." ; rdfs:label "SPARQL multi-function" ; rdfs:subClassOf dash:MultiFunction ; rdfs:subClassOf sh:SPARQLSelectExecutable ; . dash:SPARQLSelectTemplate a rdfs:Class ; rdfs:comment "Encapsulates a SPARQL SELECT query that can be parameterized. Parameters will become pre-bound variables in the query." ; rdfs:label "SPARQL SELECT template" ; rdfs:subClassOf sh:Parameterizable ; rdfs:subClassOf sh:SPARQLSelectExecutable ; . dash:SPARQLUpdateSuggestionGenerator a rdfs:Class ; rdfs:comment """A SuggestionGenerator based on a SPARQL UPDATE query (sh:update), producing an instance of dash:GraphUpdate. The INSERTs become dash:addedTriple and the DELETEs become dash:deletedTriple. The WHERE clause operates on the data graph with the pre-bound variables $focusNode, $predicate and $value, as well as the other pre-bound variables for the parameters of the constraint. In many cases, there may be multiple possible suggestions to fix a problem. For example, with sh:maxLength there are many ways to slice a string. In those cases, the system will first iterate through the result variables from a SELECT query (sh:select) and apply these results as pre-bound variables into the UPDATE query.""" ; rdfs:label "SPARQL UPDATE suggestion generator" ; rdfs:subClassOf dash:SuggestionGenerator ; rdfs:subClassOf sh:SPARQLSelectExecutable ; rdfs:subClassOf sh:SPARQLUpdateExecutable ; . dash:Script a dash:ShapeClass ; rdfs:comment "An executable unit implemented in one or more languages such as JavaScript." ; rdfs:label "Script" ; rdfs:subClassOf rdfs:Resource ; . rdf:type rdf:Property ; rdfs:label "root class" ; . dash:staticConstraint rdf:type rdf:Property ; rdfs:comment """Can be set to true for those constraint components where the validation does not require to visit any other triples than the parameters. Examples of this include sh:datatype or sh:nodeKind, where no further triples need to be queried to determine the result. . dash:ScriptAPIShape-generateClass a sh:PropertyShape ; sh:path dash:generateClass ; sh:class sh:NodeShape ; sh:description "The API generator will produce classes for each value of this property and all its subclasses and superclasses." ; sh:group dash:ScriptAPIGenerationRules ; sh:name "generate class" ; sh:nodeKind sh:IRI ; sh:order "0"^^xsd:decimal ; . dash:ScriptAPIShape-generatePrefixClasses a sh:PropertyShape ; sh:path dash:generatePrefixClasses ; sh:datatype xsd:string ; sh:description "If a prefix (such as \"edg\") is listed here then the API generator will produce classes for all RDFS classes or node shapes from the associated namespace." ; sh:group dash:ScriptAPIGenerationRules ; sh:name "generate prefix classes" ; sh:order "15"^^xsd:decimal ; . dash:ScriptAPIShape-generatePrefixConstants a sh:PropertyShape ; sh:path dash:generatePrefixConstants ; sh:datatype xsd:string ; sh:description "If a prefix (such as \"edg\") is listed here then the API generator will produce constants for class, datatype, shape and property names." ; sh:group dash:ScriptAPIGenerationRules ; sh:name "generate prefix constants" ; sh:order "10"^^xsd:decimal ; . dash:ScriptConstraint a dash:ShapeClass ; rdfs:comment """The class of constraints that are based on Scripts. Depending on whether dash:onAllValues is set to true, these scripts can access the following pre-assigned variables: - focusNode: the focus node of the constraint (a NamedNode) - if dash:onAllValues is not true: value: the current value node (e.g. a JavaScript string for xsd:string literals, a number for numeric literals or true or false for xsd:boolean literals. All other literals become LiteralNodes, and non-literals become instances of NamedNode) - if dash:onAllValues is true: values: an array of current value nodes, as above. If the expression returns an array then each array member will be mapped to one validation result, following the mapping rules below. For string results, a validation result will use the string as sh:resultMessage. For boolean results, a validation result will be produced if the result is false (true means no violation). For object results, a validation result will be produced using the value of the field \"message\" of the object as result message. If the field \"value\" has a value then this will become the sh:value in the violation. Unless another sh:message has been directly returned, the sh:message of the dash:ScriptConstraint will be used, similar to sh:message at SPARQL Constraints. These sh:messages can access the values {$focusNode}, {$value} etc as template variables.""" ; rdfs:label "Script constraint" ; rdfs:subClassOf dash:Script ; . dash:ScriptConstraintComponent a sh:ConstraintComponent ; rdfs:label "Script constraint component" ; sh:parameter dash:ScriptConstraintComponent-scriptConstraint ; . dash:ScriptConstraintComponent-scriptConstraint a sh:Parameter ; sh:path dash:scriptConstraint ; sh:class dash:ScriptConstraint ; sh:description "The Script constraint(s) to apply." ; sh:name "script constraint" ; . dash:ScriptFunction a rdfs:Class ; a sh:NodeShape ; rdfs:comment """Script functions can be used from SPARQL queries and will be injected into the generated prefix object (in JavaScript, for ADS scripts). The dash:js will be inserted into a generated JavaScript function and therefore needs to use the return keyword to produce results. These JS snippets can access the parameter values based on the local name of the sh:Parameter's path. For example ex:value can be accessed using value. SPARQL use note: Since these functions may be used from any data graph and any shapes graph, they must not rely on any API apart from what's available in the shapes graph that holds the rdf:type triple of the function itself. In other words, at execution time from SPARQL, the ADS shapes graph will be the home graph of the function's declaration.""" ; rdfs:label "Script function" ; rdfs:subClassOf dash:Script ; rdfs:subClassOf sh:Function ; . dash:ScriptSuggestionGenerator a dash:ShapeClass ; rdfs:comment """A Suggestion Generator that is backed by an Active Data Shapes script. The script needs to return a JSON object or an array of JSON objects if it shall generate multiple suggestions. It may also return null to indicate that nothing was suggested. Note that the whole script is evaluated as a (JavaScript) expression, and those will use the last value as result. So simply putting an object at the end of your script should do. Alternatively, define the bulk of the operation as a function and simply call that function in the script. Each response object can have the following fields: { message: \"The human readable message\", // Defaults to the rdfs:label(s) of the suggestion generator add: [ // An array of triples to add, each triple as an array with three nodes [ subject, predicate, object ], [ ... ] ], delete: [ ... like add, for the triples to delete ] } Suggestions with neither added nor deleted triples will be discarded. At execution time, the script operates on the data graph as the active graph, with the following pre-bound variables: - focusNode: the NamedNode that is the sh:focusNode of the validation result - predicate: the NamedNode representing the predicate of the validation result, assuming sh:resultPath is a URI - value: the value node from the validation result's sh:value, cast into the most suitable JS object - the other pre-bound variables for the parameters of the constraint, e.g. in a sh:maxCount constraint it would be maxCount The script will be executed in read-only mode, i.e. it cannot modify the graph. Example with dash:js: ({ message: `Copy labels into ${graph.localName(predicate)}`, add: focusNode.values(rdfs.label).map(label => [ focusNode, predicate, label ] ) })""" ; rdfs:label "Script suggestion generator" ; rdfs:subClassOf dash:Script ; rdfs:subClassOf dash:SuggestionGenerator ; . dash:ScriptTestCase a dash:ShapeClass ; rdfs:comment """A test case that evaluates a script. Requires exactly one value for dash:js and will operate on the test case's graph (with imports) as both data and shapes graph. Supports read-only scripts only at this stage.""" ; rdfs:label "Script test case" ; rdfs:subClassOf dash:Script ; rdfs:subClassOf dash:TestCase ; . dash:ScriptValidator a dash:ShapeClass ; rdfs:comment """A SHACL validator based on an Active Data Shapes script. See the comment at dash:ScriptConstraint for the basic evaluation approach. Note that in addition to focusNode and value/values, the script can access pre-bound variables for each declared argument of the constraint component.""" ; rdfs:label "Script validator" ; rdfs:subClassOf dash:Script ; rdfs:subClassOf sh:Validator ; . dash:Service a dash:ShapeClass ; dash:abstract true ; rdfs:comment "A script that gets exposed as a web service, e.g. /tbl/service/ex/MyService" ; rdfs:label "Service" ; rdfs:subClassOf dash:Script ; rdfs:subClassOf sh:Parameterizable ; . dash:ShapeClass a dash:ShapeClass ; dash:hidden true ; rdfs:comment "A class that is also a node shape. This class can be used as rdf:type instead of the combination of rdfs:Class and sh:NodeShape." ; rdfs:label "Shape class" ; rdfs:subClassOf rdfs:Class ; rdfs:subClassOf sh:NodeShape ; . dash:ShapeScript a rdfs:Class ; rdfs:comment "A shape script contains extra code that gets injected into the API for the associated node shape. In particular you can use this to define additional functions that operate on the current focus node (the this variable in JavaScript)." ; rdfs:label "Shape script" ; rdfs:subClassOf dash:Script ; . dash:SingleEditor a dash:ShapeClass ; rdfs:comment "An editor for individual value nodes." ; rdfs:label "Single editor" ; rdfs:subClassOf dash:Editor ; . dash:SingleLineConstraintComponent a sh:ConstraintComponent ; rdfs:comment """A constraint component that can be used to declare that all values that are literals must have a lexical form that contains no line breaks ('\\n' or '\\r'). User interfaces may use the dash:singleLine flag to prefer a text field over a (multi-line) text area.""" ; rdfs:label "Single line constraint component" ; sh:message "Must not contain line breaks." ; sh:parameter dash:SingleLineConstraintComponent-singleLine ; sh:validator [ a sh:JSValidator ; sh:jsFunctionName "validateSingleLine" ; sh:jsLibrary dash:DASHJSLibrary ; ] ; sh:validator [ a sh:SPARQLAskValidator ; sh:ask """ASK { FILTER (!$singleLine || !isLiteral($value) || (!contains(str($value), '\\n') && !contains(str($value), '\\r'))) }""" ; sh:prefixes <http://datashapes.org/dash> ; ] ; . dash:SingleLineConstraintComponent-singleLine a sh:Parameter ; sh:path dash:singleLine ; dash:reifiableBy dash:ConstraintReificationShape ; sh:datatype xsd:boolean ; sh:description "True to state that the lexical form of literal value nodes must not contain any line breaks. False to state that line breaks are explicitly permitted." ; sh:group tosh:StringConstraintsPropertyGroup ; sh:maxCount 1 ; sh:name "single line" ; sh:order "30"^^xsd:decimal ; . dash:SingleViewer a dash:ShapeClass ; rdfs:comment "A viewer for a single value." ; rdfs:label "Single viewer" ; rdfs:subClassOf dash:Viewer ; . dash:Stable a dash:APIStatus ; rdfs:comment "Features that have been marked stable are deemed of good quality and can be used until marked deprecated." ; rdfs:label "stable" ; . dash:StemConstraintComponent a sh:ConstraintComponent ; dash:staticConstraint true ; rdfs:comment "A constraint component that can be used to verify that every value node is an IRI and the IRI starts with a given string value."@en ; rdfs:label "Stem constraint component"@en ; sh:labelTemplate "Value needs to have stem {$stem}" ; sh:message "Value does not have stem {$stem}" ; sh:parameter dash:StemConstraintComponent-stem ; sh:validator dash:hasStem ; sh:validator [ a sh:JSValidator ; sh:jsFunctionName "validateStem" ; sh:jsLibrary dash:DASHJSLibrary ; ] ; . dash:StemConstraintComponent-stem a sh:Parameter ; sh:path dash:stem ; dash:reifiableBy dash:ConstraintReificationShape ; sh:datatype xsd:string ; sh:description "If specified then every value node must be an IRI and the IRI must start with the given string value." ; sh:maxCount 1 ; sh:name "stem" ; . dash:StringOrLangString a rdf:List ; rdf:first [ sh:datatype xsd:string ; ] ; rdf:rest ( [ sh:datatype rdf:langString ; ] ) ; rdfs:comment "An rdf:List that can be used in property constraints as value for sh:or to indicate that all values of a property must be either xsd:string or rdf:langString." ; rdfs:label "String or langString" ; . dash:StringOrLangStringOrHTML a rdf:List ; rdf:first [ sh:datatype xsd:string ; ] ; rdf:rest ( [ sh:datatype rdf:langString ; ] [ sh:datatype rdf:HTML ; ] ) ; rdfs:comment "An rdf:List that can be used in property constraints as value for sh:or to indicate that all values of a property must be either xsd:string, rdf:langString or rdf:HTML (in that order of preference)." ; rdfs:label "string or langString or HTML" ; . dash:SubClassEditor a dash:SingleEditor ; rdfs:comment "An editor for properties that declare a dash:rootClass. The editor allows selecting either the class itself or one of its subclasses." ; rdfs:label "Sub-Class editor" ; . dash:SubSetOfConstraintComponent a sh:ConstraintComponent ; dash:localConstraint true ; rdfs:comment "A constraint component that can be used to state that the set of value nodes must be a subset of the value of a given property." ; rdfs:label "Sub set of constraint component" ; sh:message "Must be one of the values of {$subSetOf}" ; sh:parameter dash:SubSetOfConstraintComponent-subSetOf ; sh:propertyValidator [ a sh:SPARQLAskValidator ; sh:ask """ASK { $this $subSetOf $value . }""" ; sh:prefixes <http://datashapes.org/dash> ; ] ; sh:validator [ a sh:JSValidator ; sh:jsFunctionName "validateSubSetOf" ; sh:jsLibrary dash:DASHJSLibrary ; ] ; . dash:SubSetOfConstraintComponent-subSetOf sh:targetClass sh:Shape ; . sh:Function dash:abstract "true"^^xsd:boolean ; sh:property [ sh:path dash:cachable ; sh:datatype xsd:boolean ; sh:name "sub-set of" ; sh:nodeKind sh:IRI ; . dash:SuccessResult a rdfs:Class ; rdfs:comment "A result representing a successfully validated constraint." ; rdfs:label "Success result" ; rdfs:subClassOf sh:AbstractResult ; . dash:SuccessTestCaseResult a rdfs:Class ; rdfs:comment "Represents a successful run of a test case." ; rdfs:label "Success test case result" ; rdfs:subClassOf dash:TestCaseResult ; . dash:Suggestion a rdfs:Class ; dash:abstract true ; rdfs:comment "Base class of suggestions that modify a graph to \"fix\" the source of a validation result." ; rdfs:label "Suggestion" ; rdfs:subClassOf rdfs:Resource ; . dash:SuggestionGenerator a rdfs:Class ; dash:abstract true ; rdfs:comment "Base class of objects that can generate suggestions (added or deleted triples) for a validation result of a given constraint component." ; rdfs:label "Suggestion generator" ; rdfs:subClassOf rdfs:Resource ; . dash:SuggestionResult a rdfs:Class ; rdfs:comment "Class of results that have been produced as suggestions, not through SHACL validation. How the actual results are produced is up to implementers. Each instance of this class should have values for sh:focusNode, sh:resultMessage, sh:resultSeverity (suggested default: sh:Info), and dash:suggestion to point at one or more suggestions." ; rdfs:label "Suggestion result" ; rdfs:subClassOf sh:AbstractResult ; . dash:SymmetricConstraintComponent a sh:ConstraintComponent ; rdfs:comment "A contraint component for property shapes to validate that a property is symmetric. For symmetric properties, if A relates to B then B must relate to A." ; rdfs:label "Symmetric constraint component" ; sh:message "Symmetric value expected" ; sh:parameter dash:SymmetricConstraintComponent-symmetric ; sh:propertyValidator [ a sh:JSValidator ; sh:jsFunctionName "validateSymmetric" ; sh:jsLibrary dash:DASHJSLibrary ; ] ; sh:propertyValidator [ a sh:SPARQLSelectValidator ; sh:prefixes <http://datashapes.org/dash> ; sh:select """SELECT $this ?value { FILTER ($symmetric) . $this $PATH ?value . FILTER NOT EXISTS { ?value $PATH $this . } }""" ; ] ; . dash:SymmetricConstraintComponent-symmetric a sh:Parameter ; sh:path dash:symmetric ; dash:reifiableBy dash:ConstraintReificationShape ; sh:datatype xsd:boolean ; sh:description "If set to true then if A relates to B then B must relate to A." ; sh:maxCount 1 ; sh:name "symmetric" ; . dash:TestCase a dash:ShapeClass ; dash:abstract true ; rdfs:comment "A test case to verify that a (SHACL-based) feature works as expected." ; rdfs:label "Test case" ; rdfs:subClassOf rdfs:Resource ; . dash:TestCaseResult a rdfs:Class ; dash:abstract true ; rdfs:comment "Base class for results produced by running test cases." ; rdfs:label "Test case result" ; rdfs:subClassOf sh:AbstractResult ; . dash:TestEnvironment a rdfs:Class ; dash:abstract true ; rdfs:comment "Abstract base class for test environments, holding information on how to set up a test case." ; rdfs:label "Test environment" ; rdfs:subClassOf rdfs:Resource ; . dash:TextAreaEditor a dash:SingleEditor ; rdfs:comment "A multi-line text area to enter the value of a literal." ; rdfs:label "Text area editor" ; . dash:TextAreaWithLangEditor a dash:SingleEditor ; rdfs:comment "A multi-line text area to enter the value of a literal and a drop down to select a language." ; rdfs:label "Text area with lang editor" ; . dash:TextFieldEditor a dash:SingleEditor ; rdfs:comment """A simple input field to enter the value of a literal, without the ability to change language or datatype. This is the fallback editor for any literal if no other editors are more suitable.""" ; rdfs:label "Text field editor" ; . dash:TextFieldWithLangEditor a dash:SingleEditor ; rdfs:comment "A single-line input field to enter the value of a literal and a drop down to select language, which is mandatory unless xsd:string is among the permissible datatypes." ; rdfs:label "Text field with lang editor" ; . dash:URIEditor a dash:SingleEditor ; rdfs:comment "An input field to enter the URI of a resource, e.g. rdfs:seeAlso links or images." ; rdfs:label "URI editor" ; . dash:URIViewer a dash:SingleViewer ; rdfs:comment "A Viewer for URI resources, rendering as a hyperlink to that URI. Also includes other ways of interacting with the URI such as opening a nested summary display." ; rdfs:label "URI viewer" ; . dash:UniqueValueForClassConstraintComponent a sh:ConstraintComponent ; dash:propertySuggestionGenerator tosh:DeleteTripleSuggestionGenerator ; rdfs:comment "A constraint component that can be used to state that the values of a property must be unique for all instances of a given class (and its subclasses)." ; rdfs:label "Unique value for class constraint component" ; sh:labelTemplate "Values must be unique among all instances of {?uniqueValueForClass}" ; sh:parameter dash:UniqueValueForClassConstraintComponent-uniqueValueForClass ; sh:propertyValidator [ a sh:JSValidator ; sh:jsFunctionName "validateUniqueValueForClass" ; sh:jsLibrary dash:DASHJSLibrary ; sh:message "Value {?value} must be unique but is also used by {?other}" ; ] ; sh:propertyValidator [ a sh:SPARQLSelectValidator ; sh:message "Value {?value} must be unique but is also used by {?other}" ; sh:prefixes <http://datashapes.org/dash> ; sh:select """SELECT DISTINCT $this ?value ?other WHERE { { $this $PATH ?value . ?other $PATH ?value . FILTER (?other != $this) . } ?other a ?type . ?type rdfs:subClassOf* $uniqueValueForClass . }""" ; ] ; . dash:UniqueValueForClassConstraintComponent-uniqueValueForClass a sh:Parameter ; sh:path dash:uniqueValueForClass ; dash:reifiableBy dash:ConstraintReificationShape ; sh:class rdfs:Class ; sh:description "States that the values of the property must be unique for all instances of a given class (and its subclasses)." ; sh:name "unique value for class" ; sh:nodeKind sh:IRI ; . dash:UntrustedHTMLViewer a dash:SingleViewer ; rdfs:comment "A Viewer for HTML content from untrusted sources. This viewer will sanitize the HTML before rendering. Any a, button, checkbox, form, hidden, input, img, script, select, style and textarea tags and class and style attributes will be removed." ; rdfs:label "Untrusted HTML viewer" ; . dash:ValidationTestCase a dash:ShapeClass ; dash:abstract true ; rdfs:comment "Abstract superclass for test cases concerning SHACL constraint validation. Future versions may add new kinds of validatin test cases, e.g. to validate a single resource only." ; rdfs:label "Validation test case" ; rdfs:subClassOf dash:TestCase ; . dash:ValueTableViewer a dash:MultiViewer ; rdfs:comment "A viewer that renders all values of a given property as a table, with one value per row, and the columns defined by the shape that is the sh:node or sh:class of the property." ; rdfs:label "Value table viewer" ; . dash:Viewer a dash:ShapeClass ; dash:abstract true ; rdfs:comment "The class of widgets for viewing value nodes." ; rdfs:label "Viewer" ; rdfs:subClassOf dash:Widget ; . dash:Widget a dash:ShapeClass ; dash:abstract true ; rdfs:comment "Base class of user interface components that can be used to display or edit value nodes." ; rdfs:label "Widget" ; rdfs:subClassOf rdfs:Resource ; . dash:abstract a rdf:Property ; rdfs:comment "Indicates that a class is \"abstract\" and cannot be used in asserted rdf:type triples. Only non-abstract subclasses of abstract classes should be instantiated directly." ; rdfs:domain rdfs:Class ; rdfs:label "abstract" ; rdfs:range xsd:boolean ; . dash:actionGroup a rdf:Property ; rdfs:comment "Links an Action with the ActionGroup that it should be arranged in." ; rdfs:domain dash:Action ; rdfs:label "action group" ; rdfs:range dash:ActionGroup ; . dash:actionIconClass a rdf:Property ; rdfs:comment "The (CSS) class of an Action for display purposes alongside the label." ; rdfs:domain dash:Action ; rdfs:label "action icon class" ; rdfs:range xsd:string ; . dash:addedTriple a rdf:Property ; rdfs:comment "May link a dash:GraphUpdate with one or more triples (represented as instances of rdf:Statement) that should be added to fix the source of the result." ; rdfs:domain dash:GraphUpdate ; rdfs:label "added triple" ; rdfs:range rdf:Statement ; . dash:all a rdfs:Resource ; rdfs:comment "Represents all users/roles, for example as a possible value of the default view for role property." ; rdfs:label "all" ; . dash:apiStatus a rdf:Property ; rdfs:comment "Defines how and whether the associated feature
6
Alignment with latest snapshot from TopBraid code base (including various fixes). And #32
1
.ttl
ttl
apache-2.0
TopQuadrant/shacl
176
<NME> anon-shape-002.test.ttl <BEF> # baseURI: http://datashapes.org/sh/tests/shapedefs/anon-shape-002.test # imports: http://datashapes.org/dash # prefix: ex @prefix dash: <http://datashapes.org/dash#> . @prefix ex: <http://datashapes.org/sh/tests/shapedefs/anon-shape-002.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/shapedefs/anon-shape-002.test> rdf:type owl:Ontology ; rdfs:label "Test of anonymous shape definition 002" ; owl:imports <http://datashapes.org/dash> ; . 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:InvalidNode1 ; sh:resultPath ex:property ; sh:resultSeverity sh:Violation ; sh:sourceConstraintComponent sh:MinCountConstraintComponent ; sh:sourceShape [] ; ] ; ] ; dash:validateShapes "true"^^xsd:boolean ; . ex:InvalidNode1 rdfs:label "Invalid node 1" ; . ex:ValidNode1 ex:property 42 ; . [ rdf:type sh:NodeShape ; sh:minCount 1 ; sh:name "property" ; ] ; sh:scopeNode ex:InvalidNode1 ; sh:scopeNode ex:ValidNode1 ; ]. sh:name "property" ; ] ; sh:targetNode ex:InvalidNode1 ; sh:targetNode ex:ValidNode1 ; ]. <MSG> Updates to latest spec (scope -> target) <DFF> @@ -42,6 +42,6 @@ ex:ValidNode1 sh:minCount 1 ; sh:name "property" ; ] ; - sh:scopeNode ex:InvalidNode1 ; - sh:scopeNode ex:ValidNode1 ; + sh:targetNode ex:InvalidNode1 ; + sh:targetNode ex:ValidNode1 ; ].
2
Updates to latest spec (scope -> target)
2
.ttl
test
apache-2.0
TopQuadrant/shacl
177
<NME> anon-shape-002.test.ttl <BEF> # baseURI: http://datashapes.org/sh/tests/shapedefs/anon-shape-002.test # imports: http://datashapes.org/dash # prefix: ex @prefix dash: <http://datashapes.org/dash#> . @prefix ex: <http://datashapes.org/sh/tests/shapedefs/anon-shape-002.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/shapedefs/anon-shape-002.test> rdf:type owl:Ontology ; rdfs:label "Test of anonymous shape definition 002" ; owl:imports <http://datashapes.org/dash> ; . 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:InvalidNode1 ; sh:resultPath ex:property ; sh:resultSeverity sh:Violation ; sh:sourceConstraintComponent sh:MinCountConstraintComponent ; sh:sourceShape [] ; ] ; ] ; dash:validateShapes "true"^^xsd:boolean ; . ex:InvalidNode1 rdfs:label "Invalid node 1" ; . ex:ValidNode1 ex:property 42 ; . [ rdf:type sh:NodeShape ; sh:minCount 1 ; sh:name "property" ; ] ; sh:scopeNode ex:InvalidNode1 ; sh:scopeNode ex:ValidNode1 ; ]. sh:name "property" ; ] ; sh:targetNode ex:InvalidNode1 ; sh:targetNode ex:ValidNode1 ; ]. <MSG> Updates to latest spec (scope -> target) <DFF> @@ -42,6 +42,6 @@ ex:ValidNode1 sh:minCount 1 ; sh:name "property" ; ] ; - sh:scopeNode ex:InvalidNode1 ; - sh:scopeNode ex:ValidNode1 ; + sh:targetNode ex:InvalidNode1 ; + sh:targetNode ex:ValidNode1 ; ].
2
Updates to latest spec (scope -> target)
2
.ttl
test
apache-2.0
TopQuadrant/shacl
178
<NME> DASH.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; /** * Vocabulary for http://datashapes.org/dash */ public class DASH { public final static String BASE_URI = "http://datashapes.org/dash"; public final static String NAME = "DASH Data Shapes Vocabulary"; public final static String NS = BASE_URI + "#"; public final static String PREFIX = "dash"; public final static Resource Action = ResourceFactory.createResource(NS + "Action"); public final static Resource ActionGroup = ResourceFactory.createResource(NS + "ActionGroup"); public final static Resource ActionTestCase = ResourceFactory.createResource(NS + "ActionTestCase"); public final static Resource addedGraph = ResourceFactory.createResource(NS + "addedGraph"); public final static Resource all = ResourceFactory.createResource(NS + "all"); public final static Resource ChangeScript = ResourceFactory.createResource(NS + "ChangeScript"); public final static Resource CommitScript = ResourceFactory.createResource(NS + "CommitScript"); public final static Resource Constructor = ResourceFactory.createResource(NS + "Constructor"); public final static Resource deletedGraph = ResourceFactory.createResource(NS + "deletedGraph"); public final static Resource DepictionRole = ResourceFactory.createResource(NS + "DepictionRole"); public final static Resource Deprecated = ResourceFactory.createResource(NS + "Deprecated"); public final static Resource DescriptionRole = ResourceFactory.createResource(NS + "DescriptionRole"); public final static Resource Editor = ResourceFactory.createResource(NS + "Editor"); public final static Resource ExecutionPlatform = ResourceFactory.createResource(NS + "ExecutionPlatform"); public final static Resource Experimental = ResourceFactory.createResource(NS + "Experimental"); public final static Resource ExploreAction = ResourceFactory.createResource(NS + "ExploreAction"); public final static Resource FailureResult = ResourceFactory.createResource(NS + "FailureResult"); public final static Resource FailureTestCaseResult = ResourceFactory.createResource(NS + "FailureTestCaseResult"); public final static Resource FunctionTestCase = ResourceFactory.createResource(NS + "FunctionTestCase"); public final static Resource GraphService = ResourceFactory.createResource(NS + "GraphService"); public final static Resource GraphStoreTestCase = ResourceFactory.createResource(NS + "GraphStoreTestCase"); public final static Resource GraphUpdate = ResourceFactory.createResource(NS + "GraphUpdate"); public final static Resource GraphValidationTestCase = ResourceFactory.createResource(NS + "GraphValidationTestCase"); public final static Resource IconRole = ResourceFactory.createResource(NS + "IconRole"); public final static Resource IDRole = ResourceFactory.createResource(NS + "IDRole"); public final static Resource IncludedScript = ResourceFactory.createResource(NS + "IncludedScript"); public final static Resource IndexedConstraintComponent = ResourceFactory.createResource(NS + "IndexedConstraintComponent"); public final static Resource InferencingTestCase = ResourceFactory.createResource(NS + "InferencingTestCase"); public final static Resource isDeactivated = ResourceFactory.createResource(NS + "isDeactivated"); public final static Property expectedResult = ResourceFactory.createProperty(NS + "expectedResult"); public final static Property expectedResultIsTTL = ResourceFactory.createProperty(NS + "expectedResultIsTTL"); public final static Property expression = ResourceFactory.createProperty(NS + "expression"); public final static Resource ModifyAction = ResourceFactory.createResource(NS + "ModifyAction"); public final static Resource MultiFunction = ResourceFactory.createResource(NS + "MultiFunction"); public final static Resource None = ResourceFactory.createResource(NS + "None"); public final static Resource NonRecursiveConstraintComponent = ResourceFactory.createResource(NS + "NonRecursiveConstraintComponent"); public final static Resource QueryTestCase = ResourceFactory.createResource(NS + "QueryTestCase"); public final static Resource ParameterConstraintComponent = ResourceFactory.createResource(NS + "ParameterConstraintComponent"); public final static Resource RDFQueryJSLibrary = ResourceFactory.createResource(NS + "RDFQueryJSLibrary"); public final static Resource ReifiableByConstraintComponent = ResourceFactory.createResource(NS + "ReifiableByConstraintComponent"); public final static Resource ResourceAction = ResourceFactory.createResource(NS + "ResourceAction"); public final static Resource ResourceService = ResourceFactory.createResource(NS + "ResourceService"); public final static Resource Script = ResourceFactory.createResource(NS + "Script"); public final static Resource ScriptConstraint = ResourceFactory.createResource(NS + "ScriptConstraint"); public final static Resource ScriptConstraintComponent = ResourceFactory.createResource(NS + "ScriptConstraintComponent"); public final static Resource ScriptFunction = ResourceFactory.createResource(NS + "ScriptFunction"); public final static Resource ScriptSuggestionGenerator = ResourceFactory.createResource(NS + "ScriptSuggestionGenerator"); public final static Resource ScriptTestCase = ResourceFactory.createResource(NS + "ScriptTestCase"); public final static Resource ScriptValidator = ResourceFactory.createResource(NS + "ScriptValidator"); public final static Resource Service = ResourceFactory.createResource(NS + "Service"); public final static Resource ShapeClass = ResourceFactory.createResource(NS + "ShapeClass"); public final static Resource ShapeScript = ResourceFactory.createResource(NS + "ShapeScript"); public final static Resource SPARQLConstructTemplate = ResourceFactory.createResource(NS + "SPARQLConstructTemplate"); public final static Resource SPARQLMultiFunction = ResourceFactory.createResource(NS + "SPARQLMultiFunction"); public final static Resource SPARQLSelectTemplate = ResourceFactory.createResource(NS + "SPARQLSelectTemplate"); public final static Resource SPARQLUpdateSuggestionGenerator = ResourceFactory.createResource(NS + "SPARQLUpdateSuggestionGenerator"); public final static Resource SingleLineConstraintComponent = ResourceFactory.createResource(NS + "SingleLineConstraintComponent"); public final static Resource Stable = ResourceFactory.createResource(NS + "Stable"); public final static Resource SuccessResult = ResourceFactory.createResource(NS + "SuccessResult"); public final static Resource SuccessTestCaseResult = ResourceFactory.createResource(NS + "SuccessTestCaseResult"); public final static Resource SuggestionResult = ResourceFactory.createResource(NS + "SuggestionResult"); public final static Resource TestCase = ResourceFactory.createResource(NS + "TestCase"); public final static Resource ValidationTestCase = ResourceFactory.createResource(NS + "ValidationTestCase"); public final static Resource ValueTableViewer = ResourceFactory.createResource(NS + "ValueTableViewer"); public final static Resource Viewer = ResourceFactory.createResource(NS + "Viewer"); public final static Resource Widget = ResourceFactory.createResource(NS + "Widget"); public final static Property abstract_ = ResourceFactory.createProperty(NS + "abstract"); public final static Property action = ResourceFactory.createProperty(NS + "action"); public final static Property actualResult = ResourceFactory.createProperty(NS + "actualResult"); public final static Property actionGroup = ResourceFactory.createProperty(NS + "actionGroup"); public final static Property addedTriple = ResourceFactory.createProperty(NS + "addedTriple"); public final static Property apiStatus = ResourceFactory.createProperty(NS + "apiStatus"); public final static Property applicableToClass = ResourceFactory.createProperty(NS + "applicableToClass"); public final static Property cachable = ResourceFactory.createProperty(NS + "cachable"); public final static Property canWrite = ResourceFactory.createProperty(NS + "canWrite"); public final static Property composite = ResourceFactory.createProperty(NS + "composite"); public final static Property constructor = ResourceFactory.createProperty(NS + "constructor"); public final static Property contextFree = ResourceFactory.createProperty(NS + "contextFree"); public final static Property defaultViewForRole = ResourceFactory.createProperty(NS + "defaultViewForRole"); public final static Property deletedTriple = ResourceFactory.createProperty(NS + "deletedTriple"); public final static Property dependencyPredicate = ResourceFactory.createProperty(NS + "dependencyPredicate"); public final static Property detailsEndpoint = ResourceFactory.createProperty(NS + "detailsEndpoint"); public final static Property detailsGraph = ResourceFactory.createProperty(NS + "detailsGraph"); public final static Property editor = ResourceFactory.createProperty(NS + "editor"); public final static Property expectedResult = ResourceFactory.createProperty(NS + "expectedResult"); public final static Property expectedResultIsJSON = ResourceFactory.createProperty(NS + "expectedResultIsJSON"); public final static Property expectedResultIsTTL = ResourceFactory.createProperty(NS + "expectedResultIsTTL"); public final static Property exports = ResourceFactory.createProperty(NS + "exports"); public final static Property expression = ResourceFactory.createProperty(NS + "expression"); public final static Property focusNode = ResourceFactory.createProperty(NS + "focusNode"); public final static Property generateClass = ResourceFactory.createProperty(NS + "generateClass"); public final static Property generatePrefixClasses = ResourceFactory.createProperty(NS + "generatePrefixClasses"); public final static Property generatePrefixConstants = ResourceFactory.createProperty(NS + "generatePrefixConstants"); public final static Property hidden = ResourceFactory.createProperty(NS + "hidden"); public final static Property includedExecutionPlatform = ResourceFactory.createProperty(NS + "includedExecutionPlatform"); public final static Property includeSuggestions = ResourceFactory.createProperty(NS + "includeSuggestions"); public final static Property index = ResourceFactory.createProperty(NS + "index"); public final static Property indexed = ResourceFactory.createProperty(NS + "indexed"); public final static Property js = ResourceFactory.createProperty(NS + "js"); public final static Property jsCondition = ResourceFactory.createProperty(NS + "jsCondition"); public final static Property mimeTypes = ResourceFactory.createProperty(NS + "mimeTypes"); public final static Property neverMaterialize = ResourceFactory.createProperty(NS + "neverMaterialize"); public final static Property node = ResourceFactory.createProperty(NS + "node"); public final static Property onAllValues = ResourceFactory.createProperty(NS + "onAllValues"); public final static Property private_ = ResourceFactory.createProperty(NS + "private"); public final static Property propertyRole = ResourceFactory.createProperty(NS + "propertyRole"); public final static Property propertySuggestionGenerator = ResourceFactory.createProperty(NS + "propertySuggestionGenerator"); public final static Property requiredExecutionPlatform = ResourceFactory.createProperty(NS + "requiredExecutionPlatform"); public final static Property resultVariable = ResourceFactory.createProperty(NS + "resultVariable"); public final static Property rootClass = ResourceFactory.createProperty(NS + "rootClass"); public final static Property readOnly = ResourceFactory.createProperty(NS + "readOnly"); public final static Property reifiableBy = ResourceFactory.createProperty(NS + "reifiableBy"); public final static Property resourceAction = ResourceFactory.createProperty(NS + "resourceAction"); public final static Property resourceService = ResourceFactory.createProperty(NS + "resourceService"); public final static Property responseContentType = ResourceFactory.createProperty(NS + "responseContentType"); public final static Property scriptConstraint = ResourceFactory.createProperty(NS + "scriptConstraint"); public final static Property shape = ResourceFactory.createProperty(NS + "shape"); public final static Property shapeScript = ResourceFactory.createProperty(NS + "shapeScript"); public final static Property singleLine = ResourceFactory.createProperty(NS + "singleLine"); public final static Property suggestion = ResourceFactory.createProperty(NS + "suggestion"); public final static Property suggestionConfidence = ResourceFactory.createProperty(NS + "suggestionConfidence"); public final static Property suggestionGenerator = ResourceFactory.createProperty(NS + "suggestionGenerator"); public final static Property suggestionGroup = ResourceFactory.createProperty(NS + "suggestionGroup"); public final static Property testCase = ResourceFactory.createProperty(NS + "testCase"); public final static Property testGraph = ResourceFactory.createProperty(NS + "testGraph"); public final static Property uri = ResourceFactory.createProperty(NS + "uri"); public final static Property uriStart = ResourceFactory.createProperty(NS + "uriStart"); public final static Property validateShapes = ResourceFactory.createProperty(NS + "validateShapes"); public final static Property variables = ResourceFactory.createProperty(NS + "variables"); public final static Property viewer = ResourceFactory.createProperty(NS + "viewer"); public final static Property x = ResourceFactory.createProperty(NS + "x"); public final static Property y = ResourceFactory.createProperty(NS + "y"); public static String getURI() { return NS; } /** * Checks whether a given feature shall be included into the generated APIs. * @param feature the feature to check * @return true currently if the feature has any value for dash:apiStatus but this may change in case we introduce * additional stati in the future. */ public static boolean isAPI(Resource feature) { return feature.hasProperty(DASH.apiStatus); } } <MSG> Made ValidationEngine.validateNodesAgainstConstraint protected so that it can be overridden for diagnostic reasons. Changed ShapesGraph.getRootShapes() to only return non-deactivated shapes <DFF> @@ -95,6 +95,8 @@ public class DASH { public final static Property expectedResult = ResourceFactory.createProperty(NS + "expectedResult"); + public final static Property expectedResultIsJSON = ResourceFactory.createProperty(NS + "expectedResultIsJSON"); + public final static Property expectedResultIsTTL = ResourceFactory.createProperty(NS + "expectedResultIsTTL"); public final static Property expression = ResourceFactory.createProperty(NS + "expression");
2
Made ValidationEngine.validateNodesAgainstConstraint protected so that it can be overridden for diagnostic reasons. Changed ShapesGraph.getRootShapes() to only return non-deactivated shapes
0
.java
java
apache-2.0
TopQuadrant/shacl
179
<NME> DASH.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; /** * Vocabulary for http://datashapes.org/dash */ public class DASH { public final static String BASE_URI = "http://datashapes.org/dash"; public final static String NAME = "DASH Data Shapes Vocabulary"; public final static String NS = BASE_URI + "#"; public final static String PREFIX = "dash"; public final static Resource Action = ResourceFactory.createResource(NS + "Action"); public final static Resource ActionGroup = ResourceFactory.createResource(NS + "ActionGroup"); public final static Resource ActionTestCase = ResourceFactory.createResource(NS + "ActionTestCase"); public final static Resource addedGraph = ResourceFactory.createResource(NS + "addedGraph"); public final static Resource all = ResourceFactory.createResource(NS + "all"); public final static Resource ChangeScript = ResourceFactory.createResource(NS + "ChangeScript"); public final static Resource CommitScript = ResourceFactory.createResource(NS + "CommitScript"); public final static Resource Constructor = ResourceFactory.createResource(NS + "Constructor"); public final static Resource deletedGraph = ResourceFactory.createResource(NS + "deletedGraph"); public final static Resource DepictionRole = ResourceFactory.createResource(NS + "DepictionRole"); public final static Resource Deprecated = ResourceFactory.createResource(NS + "Deprecated"); public final static Resource DescriptionRole = ResourceFactory.createResource(NS + "DescriptionRole"); public final static Resource Editor = ResourceFactory.createResource(NS + "Editor"); public final static Resource ExecutionPlatform = ResourceFactory.createResource(NS + "ExecutionPlatform"); public final static Resource Experimental = ResourceFactory.createResource(NS + "Experimental"); public final static Resource ExploreAction = ResourceFactory.createResource(NS + "ExploreAction"); public final static Resource FailureResult = ResourceFactory.createResource(NS + "FailureResult"); public final static Resource FailureTestCaseResult = ResourceFactory.createResource(NS + "FailureTestCaseResult"); public final static Resource FunctionTestCase = ResourceFactory.createResource(NS + "FunctionTestCase"); public final static Resource GraphService = ResourceFactory.createResource(NS + "GraphService"); public final static Resource GraphStoreTestCase = ResourceFactory.createResource(NS + "GraphStoreTestCase"); public final static Resource GraphUpdate = ResourceFactory.createResource(NS + "GraphUpdate"); public final static Resource GraphValidationTestCase = ResourceFactory.createResource(NS + "GraphValidationTestCase"); public final static Resource IconRole = ResourceFactory.createResource(NS + "IconRole"); public final static Resource IDRole = ResourceFactory.createResource(NS + "IDRole"); public final static Resource IncludedScript = ResourceFactory.createResource(NS + "IncludedScript"); public final static Resource IndexedConstraintComponent = ResourceFactory.createResource(NS + "IndexedConstraintComponent"); public final static Resource InferencingTestCase = ResourceFactory.createResource(NS + "InferencingTestCase"); public final static Resource isDeactivated = ResourceFactory.createResource(NS + "isDeactivated"); public final static Property expectedResult = ResourceFactory.createProperty(NS + "expectedResult"); public final static Property expectedResultIsTTL = ResourceFactory.createProperty(NS + "expectedResultIsTTL"); public final static Property expression = ResourceFactory.createProperty(NS + "expression"); public final static Resource ModifyAction = ResourceFactory.createResource(NS + "ModifyAction"); public final static Resource MultiFunction = ResourceFactory.createResource(NS + "MultiFunction"); public final static Resource None = ResourceFactory.createResource(NS + "None"); public final static Resource NonRecursiveConstraintComponent = ResourceFactory.createResource(NS + "NonRecursiveConstraintComponent"); public final static Resource QueryTestCase = ResourceFactory.createResource(NS + "QueryTestCase"); public final static Resource ParameterConstraintComponent = ResourceFactory.createResource(NS + "ParameterConstraintComponent"); public final static Resource RDFQueryJSLibrary = ResourceFactory.createResource(NS + "RDFQueryJSLibrary"); public final static Resource ReifiableByConstraintComponent = ResourceFactory.createResource(NS + "ReifiableByConstraintComponent"); public final static Resource ResourceAction = ResourceFactory.createResource(NS + "ResourceAction"); public final static Resource ResourceService = ResourceFactory.createResource(NS + "ResourceService"); public final static Resource Script = ResourceFactory.createResource(NS + "Script"); public final static Resource ScriptConstraint = ResourceFactory.createResource(NS + "ScriptConstraint"); public final static Resource ScriptConstraintComponent = ResourceFactory.createResource(NS + "ScriptConstraintComponent"); public final static Resource ScriptFunction = ResourceFactory.createResource(NS + "ScriptFunction"); public final static Resource ScriptSuggestionGenerator = ResourceFactory.createResource(NS + "ScriptSuggestionGenerator"); public final static Resource ScriptTestCase = ResourceFactory.createResource(NS + "ScriptTestCase"); public final static Resource ScriptValidator = ResourceFactory.createResource(NS + "ScriptValidator"); public final static Resource Service = ResourceFactory.createResource(NS + "Service"); public final static Resource ShapeClass = ResourceFactory.createResource(NS + "ShapeClass"); public final static Resource ShapeScript = ResourceFactory.createResource(NS + "ShapeScript"); public final static Resource SPARQLConstructTemplate = ResourceFactory.createResource(NS + "SPARQLConstructTemplate"); public final static Resource SPARQLMultiFunction = ResourceFactory.createResource(NS + "SPARQLMultiFunction"); public final static Resource SPARQLSelectTemplate = ResourceFactory.createResource(NS + "SPARQLSelectTemplate"); public final static Resource SPARQLUpdateSuggestionGenerator = ResourceFactory.createResource(NS + "SPARQLUpdateSuggestionGenerator"); public final static Resource SingleLineConstraintComponent = ResourceFactory.createResource(NS + "SingleLineConstraintComponent"); public final static Resource Stable = ResourceFactory.createResource(NS + "Stable"); public final static Resource SuccessResult = ResourceFactory.createResource(NS + "SuccessResult"); public final static Resource SuccessTestCaseResult = ResourceFactory.createResource(NS + "SuccessTestCaseResult"); public final static Resource SuggestionResult = ResourceFactory.createResource(NS + "SuggestionResult"); public final static Resource TestCase = ResourceFactory.createResource(NS + "TestCase"); public final static Resource ValidationTestCase = ResourceFactory.createResource(NS + "ValidationTestCase"); public final static Resource ValueTableViewer = ResourceFactory.createResource(NS + "ValueTableViewer"); public final static Resource Viewer = ResourceFactory.createResource(NS + "Viewer"); public final static Resource Widget = ResourceFactory.createResource(NS + "Widget"); public final static Property abstract_ = ResourceFactory.createProperty(NS + "abstract"); public final static Property action = ResourceFactory.createProperty(NS + "action"); public final static Property actualResult = ResourceFactory.createProperty(NS + "actualResult"); public final static Property actionGroup = ResourceFactory.createProperty(NS + "actionGroup"); public final static Property addedTriple = ResourceFactory.createProperty(NS + "addedTriple"); public final static Property apiStatus = ResourceFactory.createProperty(NS + "apiStatus"); public final static Property applicableToClass = ResourceFactory.createProperty(NS + "applicableToClass"); public final static Property cachable = ResourceFactory.createProperty(NS + "cachable"); public final static Property canWrite = ResourceFactory.createProperty(NS + "canWrite"); public final static Property composite = ResourceFactory.createProperty(NS + "composite"); public final static Property constructor = ResourceFactory.createProperty(NS + "constructor"); public final static Property contextFree = ResourceFactory.createProperty(NS + "contextFree"); public final static Property defaultViewForRole = ResourceFactory.createProperty(NS + "defaultViewForRole"); public final static Property deletedTriple = ResourceFactory.createProperty(NS + "deletedTriple"); public final static Property dependencyPredicate = ResourceFactory.createProperty(NS + "dependencyPredicate"); public final static Property detailsEndpoint = ResourceFactory.createProperty(NS + "detailsEndpoint"); public final static Property detailsGraph = ResourceFactory.createProperty(NS + "detailsGraph"); public final static Property editor = ResourceFactory.createProperty(NS + "editor"); public final static Property expectedResult = ResourceFactory.createProperty(NS + "expectedResult"); public final static Property expectedResultIsJSON = ResourceFactory.createProperty(NS + "expectedResultIsJSON"); public final static Property expectedResultIsTTL = ResourceFactory.createProperty(NS + "expectedResultIsTTL"); public final static Property exports = ResourceFactory.createProperty(NS + "exports"); public final static Property expression = ResourceFactory.createProperty(NS + "expression"); public final static Property focusNode = ResourceFactory.createProperty(NS + "focusNode"); public final static Property generateClass = ResourceFactory.createProperty(NS + "generateClass"); public final static Property generatePrefixClasses = ResourceFactory.createProperty(NS + "generatePrefixClasses"); public final static Property generatePrefixConstants = ResourceFactory.createProperty(NS + "generatePrefixConstants"); public final static Property hidden = ResourceFactory.createProperty(NS + "hidden"); public final static Property includedExecutionPlatform = ResourceFactory.createProperty(NS + "includedExecutionPlatform"); public final static Property includeSuggestions = ResourceFactory.createProperty(NS + "includeSuggestions"); public final static Property index = ResourceFactory.createProperty(NS + "index"); public final static Property indexed = ResourceFactory.createProperty(NS + "indexed"); public final static Property js = ResourceFactory.createProperty(NS + "js"); public final static Property jsCondition = ResourceFactory.createProperty(NS + "jsCondition"); public final static Property mimeTypes = ResourceFactory.createProperty(NS + "mimeTypes"); public final static Property neverMaterialize = ResourceFactory.createProperty(NS + "neverMaterialize"); public final static Property node = ResourceFactory.createProperty(NS + "node"); public final static Property onAllValues = ResourceFactory.createProperty(NS + "onAllValues"); public final static Property private_ = ResourceFactory.createProperty(NS + "private"); public final static Property propertyRole = ResourceFactory.createProperty(NS + "propertyRole"); public final static Property propertySuggestionGenerator = ResourceFactory.createProperty(NS + "propertySuggestionGenerator"); public final static Property requiredExecutionPlatform = ResourceFactory.createProperty(NS + "requiredExecutionPlatform"); public final static Property resultVariable = ResourceFactory.createProperty(NS + "resultVariable"); public final static Property rootClass = ResourceFactory.createProperty(NS + "rootClass"); public final static Property readOnly = ResourceFactory.createProperty(NS + "readOnly"); public final static Property reifiableBy = ResourceFactory.createProperty(NS + "reifiableBy"); public final static Property resourceAction = ResourceFactory.createProperty(NS + "resourceAction"); public final static Property resourceService = ResourceFactory.createProperty(NS + "resourceService"); public final static Property responseContentType = ResourceFactory.createProperty(NS + "responseContentType"); public final static Property scriptConstraint = ResourceFactory.createProperty(NS + "scriptConstraint"); public final static Property shape = ResourceFactory.createProperty(NS + "shape"); public final static Property shapeScript = ResourceFactory.createProperty(NS + "shapeScript"); public final static Property singleLine = ResourceFactory.createProperty(NS + "singleLine"); public final static Property suggestion = ResourceFactory.createProperty(NS + "suggestion"); public final static Property suggestionConfidence = ResourceFactory.createProperty(NS + "suggestionConfidence"); public final static Property suggestionGenerator = ResourceFactory.createProperty(NS + "suggestionGenerator"); public final static Property suggestionGroup = ResourceFactory.createProperty(NS + "suggestionGroup"); public final static Property testCase = ResourceFactory.createProperty(NS + "testCase"); public final static Property testGraph = ResourceFactory.createProperty(NS + "testGraph"); public final static Property uri = ResourceFactory.createProperty(NS + "uri"); public final static Property uriStart = ResourceFactory.createProperty(NS + "uriStart"); public final static Property validateShapes = ResourceFactory.createProperty(NS + "validateShapes"); public final static Property variables = ResourceFactory.createProperty(NS + "variables"); public final static Property viewer = ResourceFactory.createProperty(NS + "viewer"); public final static Property x = ResourceFactory.createProperty(NS + "x"); public final static Property y = ResourceFactory.createProperty(NS + "y"); public static String getURI() { return NS; } /** * Checks whether a given feature shall be included into the generated APIs. * @param feature the feature to check * @return true currently if the feature has any value for dash:apiStatus but this may change in case we introduce * additional stati in the future. */ public static boolean isAPI(Resource feature) { return feature.hasProperty(DASH.apiStatus); } } <MSG> Made ValidationEngine.validateNodesAgainstConstraint protected so that it can be overridden for diagnostic reasons. Changed ShapesGraph.getRootShapes() to only return non-deactivated shapes <DFF> @@ -95,6 +95,8 @@ public class DASH { public final static Property expectedResult = ResourceFactory.createProperty(NS + "expectedResult"); + public final static Property expectedResultIsJSON = ResourceFactory.createProperty(NS + "expectedResultIsJSON"); + public final static Property expectedResultIsTTL = ResourceFactory.createProperty(NS + "expectedResultIsTTL"); public final static Property expression = ResourceFactory.createProperty(NS + "expression");
2
Made ValidationEngine.validateNodesAgainstConstraint protected so that it can be overridden for diagnostic reasons. Changed ShapesGraph.getRootShapes() to only return non-deactivated shapes
0
.java
java
apache-2.0
TopQuadrant/shacl
180
<NME> TestDASHTestCases.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; import java.io.File; import java.io.FileInputStream; import java.io.InputStream; import java.util.Collection; import java.util.LinkedList; import java.util.List; import org.apache.jena.rdf.model.Model; 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.util.FileUtils; import org.apache.jena.vocabulary.OWL; import org.apache.jena.vocabulary.RDF; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; import org.topbraid.jenax.util.JenaUtil; import org.topbraid.shacl.testcases.TestCase; import org.topbraid.shacl.testcases.TestCaseType; import org.topbraid.shacl.testcases.TestCaseTypes; @Override public JSScriptEngine createScriptEngine() { return new NashornScriptEngine() { protected Reader createScriptReader(String url) throws Exception { if(DASH_JS.equals(url)) { return new InputStreamReader(NashornScriptEngine.class.getResourceAsStream("/etc/dash.js")); } public static Collection<Object[]> data() throws Exception { List<TestCase> testCases = new LinkedList<TestCase>(); File rootFolder = new File("src/test/resources"); collectTestCases(rootFolder, testCases); List<Object[]> results = new LinkedList<Object[]>(); for(TestCase testCase : testCases) { results.add(new Object[]{ testCase }); } return results; } private static void collectTestCases(File folder, List<TestCase> testCases) throws Exception { for(File f : folder.listFiles()) { if(f.isDirectory()) { collectTestCases(f, testCases); } else if(f.isFile() && f.getName().endsWith(".ttl")) { Model testModel = JenaUtil.createDefaultModel(); InputStream is = new FileInputStream(f); testModel.read(is, "urn:dummy", FileUtils.langTurtle); testModel.add(SHACLSystemModel.getSHACLModel()); Resource ontology = testModel.listStatements(null, OWL.imports, ResourceFactory.createResource(DASH.BASE_URI)).next().getSubject(); for(TestCaseType type : TestCaseTypes.getTypes()) { testCases.addAll(type.getTestCases(testModel, ontology)); } } } } private TestCase testCase; public TestDASHTestCases(TestCase testCase) { this.testCase = testCase; } @Test public void testTestCase() { System.out.println(" - " + testCase.getResource()); Model results = JenaUtil.createMemoryModel(); try { testCase.run(results); } catch(Exception ex) { testCase.createFailure(results, "Exception during test case execution: " + ex); ex.printStackTrace(); } for(Statement s : results.listStatements(null, RDF.type, DASH.FailureTestCaseResult).toList()) { String message = JenaUtil.getStringProperty(s.getSubject(), SH.resultMessage); if(message == null) { message = "(No " + SH.PREFIX + ":" + SH.resultMessage.getLocalName() + " found in failure)"; } Assert.fail(testCase.getResource() + ": " + message); } } } <MSG> Fix warnings (as marked by Eclipse Neon) <DFF> @@ -42,7 +42,8 @@ public class TestDASHTestCases { @Override public JSScriptEngine createScriptEngine() { return new NashornScriptEngine() { - protected Reader createScriptReader(String url) throws Exception { + @Override + protected Reader createScriptReader(String url) throws Exception { if(DASH_JS.equals(url)) { return new InputStreamReader(NashornScriptEngine.class.getResourceAsStream("/etc/dash.js")); }
2
Fix warnings (as marked by Eclipse Neon)
1
.java
java
apache-2.0
TopQuadrant/shacl
181
<NME> TestDASHTestCases.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; import java.io.File; import java.io.FileInputStream; import java.io.InputStream; import java.util.Collection; import java.util.LinkedList; import java.util.List; import org.apache.jena.rdf.model.Model; 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.util.FileUtils; import org.apache.jena.vocabulary.OWL; import org.apache.jena.vocabulary.RDF; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; import org.topbraid.jenax.util.JenaUtil; import org.topbraid.shacl.testcases.TestCase; import org.topbraid.shacl.testcases.TestCaseType; import org.topbraid.shacl.testcases.TestCaseTypes; @Override public JSScriptEngine createScriptEngine() { return new NashornScriptEngine() { protected Reader createScriptReader(String url) throws Exception { if(DASH_JS.equals(url)) { return new InputStreamReader(NashornScriptEngine.class.getResourceAsStream("/etc/dash.js")); } public static Collection<Object[]> data() throws Exception { List<TestCase> testCases = new LinkedList<TestCase>(); File rootFolder = new File("src/test/resources"); collectTestCases(rootFolder, testCases); List<Object[]> results = new LinkedList<Object[]>(); for(TestCase testCase : testCases) { results.add(new Object[]{ testCase }); } return results; } private static void collectTestCases(File folder, List<TestCase> testCases) throws Exception { for(File f : folder.listFiles()) { if(f.isDirectory()) { collectTestCases(f, testCases); } else if(f.isFile() && f.getName().endsWith(".ttl")) { Model testModel = JenaUtil.createDefaultModel(); InputStream is = new FileInputStream(f); testModel.read(is, "urn:dummy", FileUtils.langTurtle); testModel.add(SHACLSystemModel.getSHACLModel()); Resource ontology = testModel.listStatements(null, OWL.imports, ResourceFactory.createResource(DASH.BASE_URI)).next().getSubject(); for(TestCaseType type : TestCaseTypes.getTypes()) { testCases.addAll(type.getTestCases(testModel, ontology)); } } } } private TestCase testCase; public TestDASHTestCases(TestCase testCase) { this.testCase = testCase; } @Test public void testTestCase() { System.out.println(" - " + testCase.getResource()); Model results = JenaUtil.createMemoryModel(); try { testCase.run(results); } catch(Exception ex) { testCase.createFailure(results, "Exception during test case execution: " + ex); ex.printStackTrace(); } for(Statement s : results.listStatements(null, RDF.type, DASH.FailureTestCaseResult).toList()) { String message = JenaUtil.getStringProperty(s.getSubject(), SH.resultMessage); if(message == null) { message = "(No " + SH.PREFIX + ":" + SH.resultMessage.getLocalName() + " found in failure)"; } Assert.fail(testCase.getResource() + ": " + message); } } } <MSG> Fix warnings (as marked by Eclipse Neon) <DFF> @@ -42,7 +42,8 @@ public class TestDASHTestCases { @Override public JSScriptEngine createScriptEngine() { return new NashornScriptEngine() { - protected Reader createScriptReader(String url) throws Exception { + @Override + protected Reader createScriptReader(String url) throws Exception { if(DASH_JS.equals(url)) { return new InputStreamReader(NashornScriptEngine.class.getResourceAsStream("/etc/dash.js")); }
2
Fix warnings (as marked by Eclipse Neon)
1
.java
java
apache-2.0
TopQuadrant/shacl
182
<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 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". The release artifacts end up in "Repositories -> Releases -> org.topbraid". ### Clearup Check where any intermediate files are left over. local system with: `mvn clean install` and clean your local maven repository of old snapshots. <MSG> Add github release step. <DFF> @@ -145,6 +145,10 @@ Note from 1.0.1: this happened automatically. The rules ran as part of `release: 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.
4
Add github release step.
0
.md
md
apache-2.0
TopQuadrant/shacl
183
<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 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". The release artifacts end up in "Repositories -> Releases -> org.topbraid". ### Clearup Check where any intermediate files are left over. local system with: `mvn clean install` and clean your local maven repository of old snapshots. <MSG> Add github release step. <DFF> @@ -145,6 +145,10 @@ Note from 1.0.1: this happened automatically. The rules ran as part of `release: 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.
4
Add github release step.
0
.md
md
apache-2.0
TopQuadrant/shacl
184
<NME> targetSubjectsOf-002.test.ttl <BEF> ADDFILE <MSG> Adding core test cases <DFF> @@ -0,0 +1,69 @@ +# baseURI: http://datashapes.org/sh/tests/core/targets/targetSubjectsOf-002.test +# imports: http://datashapes.org/dash +# prefix: ex + +@prefix dash: <http://datashapes.org/dash#> . +@prefix ex: <http://datashapes.org/sh/tests/core/targets/targetSubjectsOf-002.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/targets/targetSubjectsOf-002.test> + rdf:type owl:Ontology ; + rdfs:label "Test of sh:targetSubjectsOf 002" ; + owl:imports <http://datashapes.org/dash> ; +. +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:InvalidInstance1 ; + sh:resultPath ex:myProperty ; + sh:resultSeverity sh:Violation ; + sh:sourceConstraintComponent sh:MaxCountConstraintComponent ; + sh:sourceShape ex:TestShape-myProperty ; + ] ; + sh:result [ + rdf:type sh:ValidationResult ; + sh:focusNode ex:InvalidInstance2 ; + sh:resultPath ex:myProperty ; + sh:resultSeverity sh:Violation ; + sh:sourceConstraintComponent sh:MaxCountConstraintComponent ; + sh:sourceShape ex:TestShape-myProperty ; + ] ; + ] ; +. +ex:InvalidInstance1 + rdf:type ex:MyClass ; + ex:myProperty "A" ; + ex:myProperty "B" ; +. +ex:InvalidInstance2 + ex:myProperty "A" ; + ex:myProperty "B" ; +. +ex:MyClass + rdf:type rdfs:Class ; +. +ex:TestShape + rdf:type sh:NodeShape ; + sh:property ex:TestShape-myProperty ; + sh:targetClass ex:MyClass ; + sh:targetSubjectsOf ex:myProperty ; +. +ex:TestShape-myProperty + sh:path ex:myProperty ; + sh:maxCount 1 ; +. +ex:ValidInstance1 + rdf:type ex:MyClass ; + ex:myProperty "A" ; +. +ex:ValidInstance2 + ex:myProperty "A" ; +.
69
Adding core test cases
0
.ttl
test
apache-2.0
TopQuadrant/shacl
185
<NME> targetSubjectsOf-002.test.ttl <BEF> ADDFILE <MSG> Adding core test cases <DFF> @@ -0,0 +1,69 @@ +# baseURI: http://datashapes.org/sh/tests/core/targets/targetSubjectsOf-002.test +# imports: http://datashapes.org/dash +# prefix: ex + +@prefix dash: <http://datashapes.org/dash#> . +@prefix ex: <http://datashapes.org/sh/tests/core/targets/targetSubjectsOf-002.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/targets/targetSubjectsOf-002.test> + rdf:type owl:Ontology ; + rdfs:label "Test of sh:targetSubjectsOf 002" ; + owl:imports <http://datashapes.org/dash> ; +. +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:InvalidInstance1 ; + sh:resultPath ex:myProperty ; + sh:resultSeverity sh:Violation ; + sh:sourceConstraintComponent sh:MaxCountConstraintComponent ; + sh:sourceShape ex:TestShape-myProperty ; + ] ; + sh:result [ + rdf:type sh:ValidationResult ; + sh:focusNode ex:InvalidInstance2 ; + sh:resultPath ex:myProperty ; + sh:resultSeverity sh:Violation ; + sh:sourceConstraintComponent sh:MaxCountConstraintComponent ; + sh:sourceShape ex:TestShape-myProperty ; + ] ; + ] ; +. +ex:InvalidInstance1 + rdf:type ex:MyClass ; + ex:myProperty "A" ; + ex:myProperty "B" ; +. +ex:InvalidInstance2 + ex:myProperty "A" ; + ex:myProperty "B" ; +. +ex:MyClass + rdf:type rdfs:Class ; +. +ex:TestShape + rdf:type sh:NodeShape ; + sh:property ex:TestShape-myProperty ; + sh:targetClass ex:MyClass ; + sh:targetSubjectsOf ex:myProperty ; +. +ex:TestShape-myProperty + sh:path ex:myProperty ; + sh:maxCount 1 ; +. +ex:ValidInstance1 + rdf:type ex:MyClass ; + ex:myProperty "A" ; +. +ex:ValidInstance2 + ex:myProperty "A" ; +.
69
Adding core test cases
0
.ttl
test
apache-2.0
TopQuadrant/shacl
186
<NME> README.md <BEF> # TopBraid SHACL API An open source implementation of the evolving W3C Shapes Constraint Language (SHACL) based on the Jena API. Contact: Holger Knublauch (holger@topquadrant.com) Can be used to perform SHACL constraint checking 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 on correctness. 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 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 Please prefix your messages with [SHACL API] To get started, look at the classes ModelConstraintValidator and ResourceConstraintValidator in the package org.topbraid.shacl.constraints. 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> @@ -1,12 +1,12 @@ # TopBraid SHACL API -An open source implementation of the evolving W3C Shapes Constraint Language (SHACL) based on the Jena API. +**An open source implementation of the evolving W3C Shapes Constraint Language (SHACL) based on the Jena API.** Contact: Holger Knublauch (holger@topquadrant.com) Can be used to perform SHACL constraint checking 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 on correctness. +**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 @@ -18,4 +18,4 @@ https://groups.google.com/forum/#!forum/topbraid-users Please prefix your messages with [SHACL API] To get started, look at the classes ModelConstraintValidator and ResourceConstraintValidator in -the package org.topbraid.shacl.constraints. +the package org.topbraid.shacl.constraints. There is also an [Example Test Case](../master/src/test/java/org/topbraid/shacl/ValidateSquareExampleTest.java)
3
Merge branch 'master' of https://github.com/TopQuadrant/shacl
3
.md
md
apache-2.0
TopQuadrant/shacl
187
<NME> README.md <BEF> # TopBraid SHACL API An open source implementation of the evolving W3C Shapes Constraint Language (SHACL) based on the Jena API. Contact: Holger Knublauch (holger@topquadrant.com) Can be used to perform SHACL constraint checking 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 on correctness. 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 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 Please prefix your messages with [SHACL API] To get started, look at the classes ModelConstraintValidator and ResourceConstraintValidator in the package org.topbraid.shacl.constraints. 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> @@ -1,12 +1,12 @@ # TopBraid SHACL API -An open source implementation of the evolving W3C Shapes Constraint Language (SHACL) based on the Jena API. +**An open source implementation of the evolving W3C Shapes Constraint Language (SHACL) based on the Jena API.** Contact: Holger Knublauch (holger@topquadrant.com) Can be used to perform SHACL constraint checking 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 on correctness. +**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 @@ -18,4 +18,4 @@ https://groups.google.com/forum/#!forum/topbraid-users Please prefix your messages with [SHACL API] To get started, look at the classes ModelConstraintValidator and ResourceConstraintValidator in -the package org.topbraid.shacl.constraints. +the package org.topbraid.shacl.constraints. There is also an [Example Test Case](../master/src/test/java/org/topbraid/shacl/ValidateSquareExampleTest.java)
3
Merge branch 'master' of https://github.com/TopQuadrant/shacl
3
.md
md
apache-2.0
TopQuadrant/shacl
188
<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 (holger@topquadrant.com) 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> Update README.md <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
Update README.md
1
.md
md
apache-2.0
TopQuadrant/shacl
189
<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 (holger@topquadrant.com) 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> Update README.md <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
Update README.md
1
.md
md
apache-2.0
TopQuadrant/shacl
190
<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
Support for parsing SHACL Compact Syntax (uses shaded Antlr library for now). Misc accumulated fixes.
4
.ttl
ttl
apache-2.0
TopQuadrant/shacl
191
<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
Support for parsing SHACL Compact Syntax (uses shaded Antlr library for now). Misc accumulated fixes.
4
.ttl
ttl
apache-2.0
TopQuadrant/shacl
192
<NME> property-001.test.ttl <BEF> ADDFILE <MSG> Latest updates <DFF> @@ -0,0 +1,93 @@ +# baseURI: http://datashapes.org/sh/tests/core/property/property-001.test +# imports: http://datashapes.org/dash +# prefix: ex + +@prefix dash: <http://datashapes.org/dash#> . +@prefix ex: <http://datashapes.org/sh/tests/core/property/property-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/property-001.test> + rdf:type owl:Ontology ; + rdfs:label "Test of property-001" ; + owl:imports <http://datashapes.org/dash> ; + owl:versionInfo "Created with TopBraid Composer" ; +. +ex:Address + rdf:type rdfs:Class ; + rdfs:label "Address" ; + rdfs:subClassOf rdfs:Resource ; +. +ex:City + rdf:type rdfs:Class ; + rdfs:label "City" ; + rdfs:subClassOf rdfs:Resource ; +. +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:InvalidAddress ; + sh:resultPath ex:city ; + sh:resultSeverity sh:Violation ; + sh:sourceConstraintComponent sh:ClassConstraintComponent ; + sh:value ex:InvalidCity ; + ] ; + sh:result [ + rdf:type sh:ValidationResult ; + sh:focusNode ex:InvalidAddress ; + sh:resultPath ex:city ; + sh:resultSeverity sh:Violation ; + sh:sourceConstraintComponent sh:ClassConstraintComponent ; + sh:value ex:InvalidCity ; + ] ; + ] ; +. +ex:InvalidAddress + rdf:type ex:Address ; + ex:city ex:InvalidCity ; +. +ex:InvalidPerson1 + rdf:type ex:Person ; + ex:address ex:InvalidAddress ; +. +ex:InvalidPerson2 + rdf:type ex:Person ; + ex:address ex:InvalidAddress ; + ex:address ex:ValidAddress ; +. +ex:Person + rdf:type rdfs:Class ; + rdfs:label "Person" ; + rdfs:subClassOf rdfs:Resource ; +. +ex:PersonShape + rdf:type sh:NodeShape ; + rdfs:label "Person shape" ; + sh:property [ + sh:path ex:address ; + sh:property [ + sh:path ex:city ; + sh:class ex:City ; + ] ; + ] ; + sh:targetClass ex:Person ; +. +ex:ProperCity + rdf:type ex:City ; + rdfs:label "Proper city" ; +. +ex:ValidAddress + rdf:type ex:Address ; + ex:city ex:ProperCity ; +. +ex:ValidPerson1 + rdf:type ex:Person ; + ex:address ex:ValidAddress ; +.
93
Latest updates
0
.ttl
test
apache-2.0
TopQuadrant/shacl
193
<NME> property-001.test.ttl <BEF> ADDFILE <MSG> Latest updates <DFF> @@ -0,0 +1,93 @@ +# baseURI: http://datashapes.org/sh/tests/core/property/property-001.test +# imports: http://datashapes.org/dash +# prefix: ex + +@prefix dash: <http://datashapes.org/dash#> . +@prefix ex: <http://datashapes.org/sh/tests/core/property/property-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/property-001.test> + rdf:type owl:Ontology ; + rdfs:label "Test of property-001" ; + owl:imports <http://datashapes.org/dash> ; + owl:versionInfo "Created with TopBraid Composer" ; +. +ex:Address + rdf:type rdfs:Class ; + rdfs:label "Address" ; + rdfs:subClassOf rdfs:Resource ; +. +ex:City + rdf:type rdfs:Class ; + rdfs:label "City" ; + rdfs:subClassOf rdfs:Resource ; +. +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:InvalidAddress ; + sh:resultPath ex:city ; + sh:resultSeverity sh:Violation ; + sh:sourceConstraintComponent sh:ClassConstraintComponent ; + sh:value ex:InvalidCity ; + ] ; + sh:result [ + rdf:type sh:ValidationResult ; + sh:focusNode ex:InvalidAddress ; + sh:resultPath ex:city ; + sh:resultSeverity sh:Violation ; + sh:sourceConstraintComponent sh:ClassConstraintComponent ; + sh:value ex:InvalidCity ; + ] ; + ] ; +. +ex:InvalidAddress + rdf:type ex:Address ; + ex:city ex:InvalidCity ; +. +ex:InvalidPerson1 + rdf:type ex:Person ; + ex:address ex:InvalidAddress ; +. +ex:InvalidPerson2 + rdf:type ex:Person ; + ex:address ex:InvalidAddress ; + ex:address ex:ValidAddress ; +. +ex:Person + rdf:type rdfs:Class ; + rdfs:label "Person" ; + rdfs:subClassOf rdfs:Resource ; +. +ex:PersonShape + rdf:type sh:NodeShape ; + rdfs:label "Person shape" ; + sh:property [ + sh:path ex:address ; + sh:property [ + sh:path ex:city ; + sh:class ex:City ; + ] ; + ] ; + sh:targetClass ex:Person ; +. +ex:ProperCity + rdf:type ex:City ; + rdfs:label "Proper city" ; +. +ex:ValidAddress + rdf:type ex:Address ; + ex:city ex:ProperCity ; +. +ex:ValidPerson1 + rdf:type ex:Person ; + ex:address ex:ValidAddress ; +.
93
Latest updates
0
.ttl
test
apache-2.0
TopQuadrant/shacl
194
<NME> VarFinder.java <BEF> package org.topbraid.jenax.util; import java.util.HashSet; import java.util.Iterator; import java.util.Set; import org.apache.jena.graph.Triple; import org.apache.jena.query.Query; import org.apache.jena.sparql.core.TriplePath; import org.apache.jena.sparql.core.Var; import org.apache.jena.sparql.core.VarExprList; import org.apache.jena.sparql.expr.ExprVars; import org.apache.jena.sparql.syntax.ElementAssign; import org.apache.jena.sparql.syntax.ElementFilter; import org.apache.jena.sparql.syntax.ElementNamedGraph; import org.apache.jena.sparql.syntax.ElementPathBlock; import org.apache.jena.sparql.syntax.ElementService; import org.apache.jena.sparql.syntax.ElementSubQuery; import org.apache.jena.sparql.syntax.ElementTriplesBlock; import org.apache.jena.sparql.syntax.ElementVisitor; import org.apache.jena.sparql.syntax.ElementVisitorBase; import org.apache.jena.sparql.syntax.ElementWalker; import org.apache.jena.sparql.util.VarUtils; public class VarFinder { /** * Gets the names of all variables mentioned in a SPARQL Query. * @param query the Query to query * @return a Set of variables */ public static Set<String> varsMentioned(Query query) { final Set<String> results = new HashSet<>(); // Recommended by Andy but does not work: /*for(Object object : OpVars.allVars(Algebra.compile(query))) { results.add(((Var)object).getName()); }*/ if(query.isSelectType()) { for(Object var : query.getResultVars()) { results.add((String)var); } } else if(query.isConstructType()) { for(Triple t : query.getConstructTemplate().getTriples()) { if(t.getMatchSubject().isVariable()) { results.add(t.getMatchSubject().getName()); } if(t.getMatchPredicate().isVariable()) { results.add(t.getMatchPredicate().getName()); } if(t.getMatchObject().isVariable()) { results.add(t.getMatchObject().getName()); } } } final Set<Var> vars = new HashSet<Var>(); ElementVisitor v = new ElementVisitorBase() { @Override public void visit(ElementTriplesBlock el) { for (Iterator<Triple> iter = el.patternElts(); iter.hasNext(); ) { Triple t = iter.next() ; VarUtils.addVarsFromTriple(vars, t) ; } } @Override public void visit(ElementPathBlock el) { for (Iterator<TriplePath> iter = el.patternElts() ; iter.hasNext() ; ) { TriplePath tp = iter.next() ; // If it's triple-izable, then use the triple. if ( tp.isTriple() ) { VarUtils.addVarsFromTriple(vars, tp.asTriple()) ; } else { VarUtils.addVarsFromTriplePath(vars, tp) ; } } } @Override public void visit(ElementFilter el) { ExprVars.varsMentioned(vars, el.getExpr()); } @Override public void visit(ElementNamedGraph el) { VarUtils.addVar(vars, el.getGraphNameNode()) ; } @Override public void visit(ElementService el) { VarUtils.addVar(vars, el.getServiceNode()); } @Override public void visit(ElementSubQuery el) { el.getQuery().setResultVars() ; VarExprList x = el.getQuery().getProject() ; vars.addAll(x.getVars()) ; } @Override public void visit(ElementAssign el) { vars.add(el.getVar()) ; ExprVars.varsMentioned(vars, el.getExpr()); } }; ElementWalker.walk(query.getQueryPattern(), v) ; for(Var var : vars) { results.add(var.getName()); } return results; } } <MSG> Minor code clean up (e.g. alphabetical ordering of methods), deleted an unused interface <DFF> @@ -33,11 +33,6 @@ public class VarFinder { public static Set<String> varsMentioned(Query query) { final Set<String> results = new HashSet<>(); - // Recommended by Andy but does not work: - /*for(Object object : OpVars.allVars(Algebra.compile(query))) { - results.add(((Var)object).getName()); - }*/ - if(query.isSelectType()) { for(Object var : query.getResultVars()) { results.add((String)var);
0
Minor code clean up (e.g. alphabetical ordering of methods), deleted an unused interface
5
.java
java
apache-2.0
TopQuadrant/shacl
195
<NME> VarFinder.java <BEF> package org.topbraid.jenax.util; import java.util.HashSet; import java.util.Iterator; import java.util.Set; import org.apache.jena.graph.Triple; import org.apache.jena.query.Query; import org.apache.jena.sparql.core.TriplePath; import org.apache.jena.sparql.core.Var; import org.apache.jena.sparql.core.VarExprList; import org.apache.jena.sparql.expr.ExprVars; import org.apache.jena.sparql.syntax.ElementAssign; import org.apache.jena.sparql.syntax.ElementFilter; import org.apache.jena.sparql.syntax.ElementNamedGraph; import org.apache.jena.sparql.syntax.ElementPathBlock; import org.apache.jena.sparql.syntax.ElementService; import org.apache.jena.sparql.syntax.ElementSubQuery; import org.apache.jena.sparql.syntax.ElementTriplesBlock; import org.apache.jena.sparql.syntax.ElementVisitor; import org.apache.jena.sparql.syntax.ElementVisitorBase; import org.apache.jena.sparql.syntax.ElementWalker; import org.apache.jena.sparql.util.VarUtils; public class VarFinder { /** * Gets the names of all variables mentioned in a SPARQL Query. * @param query the Query to query * @return a Set of variables */ public static Set<String> varsMentioned(Query query) { final Set<String> results = new HashSet<>(); // Recommended by Andy but does not work: /*for(Object object : OpVars.allVars(Algebra.compile(query))) { results.add(((Var)object).getName()); }*/ if(query.isSelectType()) { for(Object var : query.getResultVars()) { results.add((String)var); } } else if(query.isConstructType()) { for(Triple t : query.getConstructTemplate().getTriples()) { if(t.getMatchSubject().isVariable()) { results.add(t.getMatchSubject().getName()); } if(t.getMatchPredicate().isVariable()) { results.add(t.getMatchPredicate().getName()); } if(t.getMatchObject().isVariable()) { results.add(t.getMatchObject().getName()); } } } final Set<Var> vars = new HashSet<Var>(); ElementVisitor v = new ElementVisitorBase() { @Override public void visit(ElementTriplesBlock el) { for (Iterator<Triple> iter = el.patternElts(); iter.hasNext(); ) { Triple t = iter.next() ; VarUtils.addVarsFromTriple(vars, t) ; } } @Override public void visit(ElementPathBlock el) { for (Iterator<TriplePath> iter = el.patternElts() ; iter.hasNext() ; ) { TriplePath tp = iter.next() ; // If it's triple-izable, then use the triple. if ( tp.isTriple() ) { VarUtils.addVarsFromTriple(vars, tp.asTriple()) ; } else { VarUtils.addVarsFromTriplePath(vars, tp) ; } } } @Override public void visit(ElementFilter el) { ExprVars.varsMentioned(vars, el.getExpr()); } @Override public void visit(ElementNamedGraph el) { VarUtils.addVar(vars, el.getGraphNameNode()) ; } @Override public void visit(ElementService el) { VarUtils.addVar(vars, el.getServiceNode()); } @Override public void visit(ElementSubQuery el) { el.getQuery().setResultVars() ; VarExprList x = el.getQuery().getProject() ; vars.addAll(x.getVars()) ; } @Override public void visit(ElementAssign el) { vars.add(el.getVar()) ; ExprVars.varsMentioned(vars, el.getExpr()); } }; ElementWalker.walk(query.getQueryPattern(), v) ; for(Var var : vars) { results.add(var.getName()); } return results; } } <MSG> Minor code clean up (e.g. alphabetical ordering of methods), deleted an unused interface <DFF> @@ -33,11 +33,6 @@ public class VarFinder { public static Set<String> varsMentioned(Query query) { final Set<String> results = new HashSet<>(); - // Recommended by Andy but does not work: - /*for(Object object : OpVars.allVars(Algebra.compile(query))) { - results.add(((Var)object).getName()); - }*/ - if(query.isSelectType()) { for(Object var : query.getResultVars()) { results.add((String)var);
0
Minor code clean up (e.g. alphabetical ordering of methods), deleted an unused interface
5
.java
java
apache-2.0
TopQuadrant/shacl
196
<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()) { List<RDFNode> filtered = new LinkedList<>(); for(RDFNode targetNode : targetNodes) { if(nodeConformsToAllShapes(targetNode, conditions)) { filtered.add(targetNode); } } executeRule(rule, filtered, shape); } else { executeRule(rule, targetNodes, shape); } if(monitor != null) { monitor.worked(1); } } } } public Model getShapesModel() { return dataset.getNamedModel(shapesGraphURI.toString()); } 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); } } public void setProgressMonitor(ProgressMonitor value) { this.monitor = value; } } } 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> Upgraded to Jena 3.7 <DFF> @@ -240,7 +240,8 @@ public class RuleEngine extends AbstractEngine { } - public Model getShapesModel() { + @Override + public Model getShapesModel() { return dataset.getNamedModel(shapesGraphURI.toString()); } @@ -261,7 +262,8 @@ public class RuleEngine extends AbstractEngine { } - public void setProgressMonitor(ProgressMonitor value) { + @Override + public void setProgressMonitor(ProgressMonitor value) { this.monitor = value; } }
4
Upgraded to Jena 3.7
2
.java
java
apache-2.0
TopQuadrant/shacl
197
<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()) { List<RDFNode> filtered = new LinkedList<>(); for(RDFNode targetNode : targetNodes) { if(nodeConformsToAllShapes(targetNode, conditions)) { filtered.add(targetNode); } } executeRule(rule, filtered, shape); } else { executeRule(rule, targetNodes, shape); } if(monitor != null) { monitor.worked(1); } } } } public Model getShapesModel() { return dataset.getNamedModel(shapesGraphURI.toString()); } 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); } } public void setProgressMonitor(ProgressMonitor value) { this.monitor = value; } } } 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> Upgraded to Jena 3.7 <DFF> @@ -240,7 +240,8 @@ public class RuleEngine extends AbstractEngine { } - public Model getShapesModel() { + @Override + public Model getShapesModel() { return dataset.getNamedModel(shapesGraphURI.toString()); } @@ -261,7 +262,8 @@ public class RuleEngine extends AbstractEngine { } - public void setProgressMonitor(ProgressMonitor value) { + @Override + public void setProgressMonitor(ProgressMonitor value) { this.monitor = value; } }
4
Upgraded to Jena 3.7
2
.java
java
apache-2.0
TopQuadrant/shacl
198
<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 (holger@topquadrant.com) 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. **The code is not really optimized for performance, just for correctness.** Coverage: * [SHACL Core and SHACL-SPARQL validation](https://www.w3.org/TR/shacl/) 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/` 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 <DFF> @@ -6,7 +6,8 @@ Contact: Holger Knublauch (holger@topquadrant.com) 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. -**The code is not really optimized for performance, just for correctness.** + +**The code is not really optimized for performance, just for correctness. An optimized version of the code is used in the TopBraid products such as [TopBraid EDG](https://www.topquadrant.com/products/topbraid-enterprise-data-governance/)** Coverage: * [SHACL Core and SHACL-SPARQL validation](https://www.w3.org/TR/shacl/)
2
Update README.md
1
.md
md
apache-2.0
TopQuadrant/shacl
199
<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 (holger@topquadrant.com) 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. **The code is not really optimized for performance, just for correctness.** Coverage: * [SHACL Core and SHACL-SPARQL validation](https://www.w3.org/TR/shacl/) 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/` 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 <DFF> @@ -6,7 +6,8 @@ Contact: Holger Knublauch (holger@topquadrant.com) 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. -**The code is not really optimized for performance, just for correctness.** + +**The code is not really optimized for performance, just for correctness. An optimized version of the code is used in the TopBraid products such as [TopBraid EDG](https://www.topquadrant.com/products/topbraid-enterprise-data-governance/)** Coverage: * [SHACL Core and SHACL-SPARQL validation](https://www.w3.org/TR/shacl/)
2
Update README.md
1
.md
md
apache-2.0
TopQuadrant/shacl