├── .gitignore
├── .project
├── .travis.yml
├── LICENSE
├── README.md
├── gulpfile.js
├── index.js
├── package.json
├── public
├── index.html
└── src
│ └── test.js
├── shared
├── dash.js
└── rdfquery.js
├── src
├── libraries.js
├── rdflib-graph.js
├── rdfquery.js
├── rdfquery
│ └── term-factory.js
├── shapes-graph.js
├── validation-engine-configuration.js
├── validation-engine.js
├── validation-function.js
├── validation-report.js
└── vocabularies.js
├── templates
└── rdfquery.js
├── test
├── configuration_tests.js
├── data
│ ├── core
│ │ ├── complex
│ │ │ └── personexample.test.ttl
│ │ ├── misc
│ │ │ ├── deactivated-001.test.ttl
│ │ │ ├── deactivated-002.test.ttl
│ │ │ ├── severity-001.test.ttl
│ │ │ └── severity-002.test.ttl
│ │ ├── node
│ │ │ ├── and-001.test.ttl
│ │ │ ├── and-002.test.ttl
│ │ │ ├── class-001.test.ttl
│ │ │ ├── class-002.test.ttl
│ │ │ ├── closed-001.test.ttl
│ │ │ ├── closed-002.test.ttl
│ │ │ ├── datatype-001.test.ttl
│ │ │ ├── datatype-002.test.ttl
│ │ │ ├── disjoint-001.test.ttl
│ │ │ ├── equals-001.test.ttl
│ │ │ ├── hasValue-001.test.ttl
│ │ │ ├── in-001.test.ttl
│ │ │ ├── languageIn-001.test.ttl
│ │ │ ├── maxExclusive-001.test.ttl
│ │ │ ├── maxInclusive-001.test.ttl
│ │ │ ├── maxLength-001.test.ttl
│ │ │ ├── minExclusive-001.test.ttl
│ │ │ ├── minInclusive-001.test.ttl
│ │ │ ├── minLength-001.test.ttl
│ │ │ ├── node-001.test.ttl
│ │ │ ├── nodeKind-001.test.ttl
│ │ │ ├── not-001.test.ttl
│ │ │ ├── not-002.test.ttl
│ │ │ ├── or-001.test.ttl
│ │ │ ├── pattern-001.test.ttl
│ │ │ ├── pattern-002.test.ttl
│ │ │ └── xone-001.test.ttl
│ │ ├── path
│ │ │ ├── path-alternative-001.test.ttl
│ │ │ ├── path-complex-001.test.ttl
│ │ │ ├── path-inverse-001.test.ttl
│ │ │ ├── path-oneOrMore-001.test.ttl
│ │ │ ├── path-sequence-001.test.ttl
│ │ │ ├── path-sequence-002.test.ttl
│ │ │ ├── path-sequence-duplicate-001.test.ttl
│ │ │ ├── path-zeroOrMore-001.test.ttl
│ │ │ └── path-zeroOrOne-001.test.ttl
│ │ ├── property
│ │ │ ├── and-001.test.ttl
│ │ │ ├── class-001.test.ttl
│ │ │ ├── datatype-001.test.ttl
│ │ │ ├── datatype-002.test.ttl
│ │ │ ├── datatype-003.test.ttl
│ │ │ ├── disjoint-001.test.ttl
│ │ │ ├── equals-001.test.ttl
│ │ │ ├── hasValue-001.test.ttl
│ │ │ ├── in-001.test.ttl
│ │ │ ├── languageIn-001.test.ttl
│ │ │ ├── lessThan-001.test.ttl
│ │ │ ├── lessThan-002.test.ttl
│ │ │ ├── lessThanOrEquals-001.test.ttl
│ │ │ ├── maxCount-001.test.ttl
│ │ │ ├── maxCount-002.test.ttl
│ │ │ ├── maxExclusive-001.test.ttl
│ │ │ ├── maxInclusive-001.test.ttl
│ │ │ ├── maxLength-001.test.ttl
│ │ │ ├── minCount-001.test.ttl
│ │ │ ├── minCount-002.test.ttl
│ │ │ ├── minExclusive-001.test.ttl
│ │ │ ├── minExclusive-002.test.ttl
│ │ │ ├── minLength-001.test.ttl
│ │ │ ├── node-001.test.ttl
│ │ │ ├── node-002.test.ttl
│ │ │ ├── nodeKind-001.test.ttl
│ │ │ ├── not-001.test.ttl
│ │ │ ├── or-001.test.ttl
│ │ │ ├── or-datatypes-001.test.ttl
│ │ │ ├── pattern-001.test.ttl
│ │ │ ├── pattern-002.test.ttl
│ │ │ ├── property-001.test.ttl
│ │ │ ├── qualifiedMinCountDisjoint-001.test.ttl
│ │ │ ├── qualifiedValueShape-001.test.ttl
│ │ │ ├── qualifiedValueShapesDisjoint-001.test.ttl
│ │ │ └── uniqueLang-001.test.ttl
│ │ └── targets
│ │ │ ├── multipleTargets-001.test.ttl
│ │ │ ├── targetClass-001.test.ttl
│ │ │ ├── targetClassImplicit-001.test.ttl
│ │ │ ├── targetNode-001.test.ttl
│ │ │ ├── targetObjectsOf-001.test.ttl
│ │ │ ├── targetSubjectsOf-001.test.ttl
│ │ │ └── targetSubjectsOf-002.test.ttl
│ └── functionregistry
│ │ └── jsconstraintcomponent
│ │ ├── data.ttl
│ │ └── library.js
├── function_registration_tests.js
├── inmemory_model_tests.js
└── integration_tests.js
└── vocabularies
├── dash.ttl
└── shacl.ttl
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | .idea
3 | public/data/*
4 | public/test.js
5 | public/test_cases.json
6 | public/shacl.js
7 |
--------------------------------------------------------------------------------
/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | shacl-js
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: node_js
2 | node_js:
3 | - "node"
4 | before_script:
5 | - gulp checkJavaFiles
6 | - gulp generate-vocabularies
7 | - gulp generate-libraries
8 | script: npm test
9 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # SHACL.js [](https://travis-ci.org/TopQuadrant/shacl-js)
2 |
3 | ## Status
4 |
5 | This project is not really actively maintained anymore.
6 | For a more modern JavaScript implementation, see https://github.com/zazuko/rdf-validate-shacl
7 |
8 | ## Usage
9 |
10 | Create a new SHACL validator and load shapes and data to trigger the validation.
11 | The validation function returns a `ValidationReport` object that can be used to inspect conformance rand results.
12 |
13 | ```javascript
14 | var validator = new SHACLValidator();
15 | validator.validate(data, "text/turtle", shapes, "text/turtle", function (e, report) {
16 | console.log("Conforms? " + report.conforms());
17 | if (report.conforms() === false) {
18 | report.results().forEach(function(result) {
19 | console.log(" - Severity: " + result.severity() + " for " + result.sourceConstraintComponent());
20 | });
21 | }
22 | });
23 | ```
24 |
25 | ## Building for the web
26 |
27 | A browser version of the library will be built in the `dist` directory using the gulp `browserify` task.
28 |
29 | ## Running the tests
30 |
31 | Tests can be run using the `test` gulp task.
32 |
33 | ## Running the web tests
34 |
35 | Tests can be run for the browser version running the `test-web` gulp task. This task will generate the test cases from
36 | the node version and start a server in port 3000. The browser version of the library must have been built before running
37 | this task.
38 |
39 | ## Regenerating vocabularies and libraries
40 |
41 | The vocabularies for SHACL and DASH are located in the `vocabularies` directory. After modifying these files, they must
42 | be transformed into library code using the `generate-vocabularies` gulp task.
43 | The JS libraries referenced in the DASH vocabulary can be found in the `shared` directory. They can be bundled into the
44 | library build using the `generate-libraries` gulp command. If they are not bundled, the library will try to de-reference
45 | them using HTTP.
46 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "shacl",
3 | "version": "1.1.0-SNAPSHOT",
4 | "description": "SHACL.JS Validator",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "gulp test"
8 | },
9 | "author": "Holger Knublauch ",
10 | "license": "Apache-2.0",
11 | "dependencies": {
12 | "rdflib": "^0.15.0"
13 | },
14 | "devDependencies": {
15 | "gulp": "^3.9.1",
16 | "gulp-browserify": "^0.5.1",
17 | "gulp-cli": "^1.4.0",
18 | "gulp-nodeunit": "^0.1.0",
19 | "gulp-serve": "^1.4.0",
20 | "http-browserify": "^1.7.0",
21 | "nodeunit": "^0.11.1"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | SHACL.JS Test Suite
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/src/rdfquery/term-factory.js:
--------------------------------------------------------------------------------
1 | // In some environments such as Nashorn this may already have a value
2 | // In TopBraid this is redirecting to native Jena calls
3 | var TermFactory = {
4 |
5 | REGEX_URI: /^([a-z][a-z0-9+.-]*):(?:\/\/((?:(?=((?:[a-z0-9-._~!$&'()*+,;=:]|%[0-9A-F]{2})*))(\3)@)?(?=(\[[0-9A-F:.]{2,}\]|(?:[a-z0-9-._~!$&'()*+,;=]|%[0-9A-F]{2})*))\5(?::(?=(\d*))\6)?)(\/(?=((?:[a-z0-9-._~!$&'()*+,;=:@\/]|%[0-9A-F]{2})*))\8)?|(\/?(?!\/)(?=((?:[a-z0-9-._~!$&'()*+,;=:@\/]|%[0-9A-F]{2})*))\10)?)(?:\?(?=((?:[a-z0-9-._~!$&'()*+,;=:@\/?]|%[0-9A-F]{2})*))\11)?(?:#(?=((?:[a-z0-9-._~!$&'()*+,;=:@\/?]|%[0-9A-F]{2})*))\12)?$/i,
6 |
7 | impl: require("rdflib"), // This needs to be connected to an API such as $rdf
8 |
9 | // Globally registered prefixes for TTL short cuts
10 | namespaces: {},
11 |
12 | /**
13 | * Registers a new namespace prefix for global TTL short cuts (qnames).
14 | * @param prefix the prefix to add
15 | * @param namespace the namespace to add for the prefix
16 | */
17 | registerNamespace: function (prefix, namespace) {
18 | if (this.namespaces.prefix) {
19 | throw "Prefix " + prefix + " already registered"
20 | }
21 | this.namespaces[prefix] = namespace;
22 | },
23 |
24 | /**
25 | * Produces an RDF* term from a TTL string representation.
26 | * Also uses the registered prefixes.
27 | * @param str a string, e.g. "owl:Thing" or "true" or '"Hello"@en'.
28 | * @return an RDF term
29 | */
30 | term: function (str) {
31 | // TODO: this implementation currently only supports booleans and qnames - better overload to rdflib.js
32 | if ("true" === str || "false" === str) {
33 | return this.literal(str, (this.term("xsd:boolean")));
34 | }
35 |
36 | if (str.match(/^\d+$/)) {
37 | return this.literal(str, (this.term("xsd:integer")));
38 | }
39 |
40 | if (str.match(/^\d+\.\d+$/)) {
41 | return this.literal(str, (this.term("xsd:float")));
42 | }
43 |
44 | const col = str.indexOf(":");
45 | if (col > 0) {
46 | const ns = this.namespaces[str.substring(0, col)];
47 | if (ns != null) {
48 | return this.namedNode(ns + str.substring(col + 1));
49 | } else {
50 | if (str.match(REGEX_URI)) {
51 | return this.namedNode(str)
52 | }
53 | }
54 | }
55 | return this.literal(str);
56 | },
57 |
58 | /**
59 | * Produces a new blank node.
60 | * @param id an optional ID for the node
61 | */
62 | blankNode: function (id) {
63 | return this.impl.blankNode(id);
64 | },
65 |
66 | /**
67 | * Produces a new literal. For example .literal("42", T("xsd:integer")).
68 | * @param lex the lexical form, e.g. "42"
69 | * @param langOrDatatype either a language string or a URI node with the datatype
70 | */
71 | literal: function (lex, langOrDatatype) {
72 | return this.impl.literal(lex, langOrDatatype)
73 | },
74 |
75 | // This function is basically left for Task Force compatibility, but the preferred function is uri()
76 | namedNode: function (uri) {
77 | return this.impl.namedNode(uri)
78 | },
79 |
80 | /**
81 | * Produces a new URI node.
82 | * @param uri the URI of the node
83 | */
84 | uri: function (uri) {
85 | return TermFactory.namedNode(uri);
86 | }
87 | };
88 |
89 | module.exports = TermFactory;
--------------------------------------------------------------------------------
/src/validation-engine-configuration.js:
--------------------------------------------------------------------------------
1 |
2 | var ValidationEngineConfiguration = function() {
3 | // By default validate all errors
4 | this.validationErrorBatch = -1;
5 | };
6 |
7 |
8 | ValidationEngineConfiguration.prototype.setValidationErrorBatch = function(validationErrorBatch) {
9 | this.validationErrorBatch = validationErrorBatch;
10 | return this;
11 | };
12 |
13 | ValidationEngineConfiguration.prototype.getValidationErrorBatch = function() {
14 | return this.validationErrorBatch;
15 | };
16 |
17 | module.exports = ValidationEngineConfiguration;
--------------------------------------------------------------------------------
/src/validation-function.js:
--------------------------------------------------------------------------------
1 | // class ValidationFunction
2 | var RDFQuery = require("./rdfquery");
3 | var debug = require("debug")("validation-function");
4 |
5 | var globalObject = typeof window !== 'undefined' ? window : global;
6 |
7 | var ValidationFunction = function (functionName, parameters, findInScript) {
8 |
9 | this.funcName = functionName;
10 | this.func = findInScript(functionName);
11 | if (!this.func) {
12 | throw "Cannot find validator function " + functionName;
13 | }
14 | // Get list of argument of the function, see
15 | // https://davidwalsh.name/javascript-arguments
16 | var args = this.func.toString().match(/function\s.*?\(([^)]*)\)/)[1];
17 | var funcArgsRaw = args.split(',').map(function (arg) {
18 | return arg.replace(/\/\*.*\*\//, '').trim();
19 | }).filter(function (arg) {
20 | return arg;
21 | });
22 | this.funcArgs = [];
23 | this.parameters = [];
24 | for (var i = 0; i < funcArgsRaw.length; i++) {
25 | var arg = funcArgsRaw[i];
26 | if (arg.indexOf("$") === 0) {
27 | arg = arg.substring(1);
28 | }
29 | this.funcArgs.push(arg);
30 | for (var j = 0; j < parameters.length; j++) {
31 | var parameter = parameters[j];
32 | var localName = RDFQuery.getLocalName(parameter.value);
33 | if (arg === localName) {
34 | this.parameters[i] = parameter;
35 | break;
36 | }
37 | }
38 | }
39 | };
40 |
41 | ValidationFunction.prototype.doExecute = function (args) {
42 | return this.func.apply(globalObject, args);
43 | };
44 |
45 | ValidationFunction.prototype.execute = function (focusNode, valueNode, constraint) {
46 | debug("Validating " + this.funcName);
47 | var args = [];
48 | for (var i = 0; i < this.funcArgs.length; i++) {
49 | var arg = this.funcArgs[i];
50 | var param = this.parameters[i];
51 | if (param) {
52 | var value = constraint.getParameterValue(arg);
53 | args.push(value);
54 | }
55 | else if (arg === "focusNode") {
56 | args.push(focusNode);
57 | }
58 | else if (arg === "value") {
59 | args.push(valueNode);
60 | }
61 | else if (arg === "currentShape") {
62 | args.push(constraint.shape.shapeNode);
63 | }
64 | else if (arg === "path") {
65 | args.push(constraint.shape.path);
66 | }
67 | else if (arg === "shapesGraph") {
68 | args.push("DummyShapesGraph");
69 | }
70 | else if (arg === "this") {
71 | args.push(focusNode);
72 | }
73 | else {
74 | throw "Unexpected validator function argument " + arg + " for function " + this.funcName;
75 | }
76 | }
77 | return this.doExecute(args);
78 | };
79 |
80 | module.exports = ValidationFunction;
--------------------------------------------------------------------------------
/src/validation-report.js:
--------------------------------------------------------------------------------
1 |
2 |
3 | var extractValue = function(node, property) {
4 | var obj = node[property];
5 | if (obj) {
6 | return obj[0]["@value"];
7 | }
8 | };
9 |
10 | var extractId = function(node, property) {
11 | var obj = node[property];
12 | if (obj) {
13 | return obj[0]["@id"];
14 | }
15 | };
16 |
17 | var ValidationResult = function(resultNode, g) {
18 | this.graph = g;
19 | this.resultNode = resultNode;
20 | };
21 |
22 | ValidationResult.prototype.message = function() {
23 | return extractValue(this.resultNode, "http://www.w3.org/ns/shacl#resultMessage");
24 | };
25 |
26 | ValidationResult.prototype.path = function() {
27 | return extractId(this.resultNode, "http://www.w3.org/ns/shacl#resultPath");
28 | };
29 |
30 | ValidationResult.prototype.sourceConstraintComponent = function() {
31 | return extractId(this.resultNode, "http://www.w3.org/ns/shacl#sourceConstraintComponent");
32 | };
33 |
34 | ValidationResult.prototype.focusNode = function() {
35 | return extractId(this.resultNode, "http://www.w3.org/ns/shacl#focusNode");
36 | };
37 |
38 | ValidationResult.prototype.severity = function() {
39 | var severity = extractId(this.resultNode, "http://www.w3.org/ns/shacl#resultSeverity");
40 | if (severity != null) {
41 | return severity.split("#")[1];
42 | }
43 | };
44 |
45 | ValidationResult.prototype.sourceConstraintComponent = function() {
46 | return extractId(this.resultNode, "http://www.w3.org/ns/shacl#sourceConstraintComponent");
47 | };
48 |
49 | ValidationResult.prototype.sourceShape = function() {
50 | return extractId(this.resultNode, "http://www.w3.org/ns/shacl#sourceShape");
51 | };
52 |
53 | var ValidationReport = function(g) {
54 | this.graph = g;
55 | this.validationNode = null;
56 | for(var i=0; i
7 |
8 | /// ADDED...
9 | RDFQuery.T = T;
10 | RDFQuery.getLocalName = getLocalName;
11 | RDFQuery.compareTerms = compareTerms;
12 | RDFQuery.exprEquals = exprEquals;
13 | RDFQuery.exprNotEquals = exprNotEquals;
14 | RDFQuery.NodeSet = NodeSet;
15 |
16 | module.exports = RDFQuery;
17 | ///
--------------------------------------------------------------------------------
/test/configuration_tests.js:
--------------------------------------------------------------------------------
1 | var SHACLValidator = require("../index");
2 |
3 | var fs = require("fs");
4 |
5 | exports.maxErrorsTest = function(test) {
6 | var validator = new SHACLValidator();
7 |
8 | var data = fs.readFileSync(__dirname + "/data/core/property/class-001.test.ttl").toString();
9 |
10 | validator.validate(data, "text/turtle", data, "text/turtle", function(e, report) {
11 | test.ok(report.conforms() === false);
12 | test.ok(report.results().length === 2);
13 | validator.getConfiguration().setValidationErrorBatch(1);
14 | validator.validate(data, "text/turtle", data, "text/turtle", function(e, report) {
15 | test.ok(report.conforms() === false);
16 | test.ok(report.results().length === 1);
17 | test.done();
18 | });
19 | });
20 | };
--------------------------------------------------------------------------------
/test/data/core/complex/personexample.test.ttl:
--------------------------------------------------------------------------------
1 | # baseURI: http://datashapes.org/sh/tests/core/complex/personexample.test
2 | # imports: http://datashapes.org/dash
3 | # prefix: ex
4 |
5 | @prefix dash: .
6 | @prefix ex: .
7 | @prefix owl: .
8 | @prefix rdf: .
9 | @prefix rdfs: .
10 | @prefix sh: .
11 | @prefix xsd: .
12 |
13 |
14 | rdf:type owl:Ontology ;
15 | rdfs:label "Test of personexample" ;
16 | owl:imports ;
17 | owl:versionInfo "Created with TopBraid Composer" ;
18 | .
19 | ex:Alice
20 | rdf:type ex:Person ;
21 | ex:ssn "987-65-432A" ;
22 | .
23 | ex:Bob
24 | rdf:type ex:Person ;
25 | ex:ssn "123-45-6789" ;
26 | ex:ssn "124-35-6789" ;
27 | .
28 | ex:Calvin
29 | rdf:type ex:Person ;
30 | ex:birthDate "1999-09-09"^^xsd:date ;
31 | ex:worksFor ex:UntypedCompany ;
32 | .
33 | ex:GraphValidationTestCase
34 | rdf:type dash:GraphValidationTestCase ;
35 | dash:expectedResult [
36 | rdf:type sh:ValidationReport ;
37 | sh:conforms "false"^^xsd:boolean ;
38 | sh:result [
39 | rdf:type sh:ValidationResult ;
40 | sh:focusNode ex:Alice ;
41 | sh:resultPath ex:ssn ;
42 | sh:resultSeverity sh:Violation ;
43 | sh:sourceConstraintComponent sh:PatternConstraintComponent ;
44 | sh:sourceShape _:b1 ;
45 | sh:value "987-65-432A" ;
46 | ] ;
47 | sh:result [
48 | rdf:type sh:ValidationResult ;
49 | sh:focusNode ex:Bob ;
50 | sh:resultPath ex:ssn ;
51 | sh:resultSeverity sh:Violation ;
52 | sh:sourceConstraintComponent sh:MaxCountConstraintComponent ;
53 | sh:sourceShape _:b1 ;
54 | ] ;
55 | sh:result [
56 | rdf:type sh:ValidationResult ;
57 | sh:focusNode ex:Calvin ;
58 | sh:resultPath ex:birthDate ;
59 | sh:resultSeverity sh:Violation ;
60 | sh:sourceConstraintComponent sh:ClosedConstraintComponent ;
61 | sh:value "1999-09-09"^^xsd:date ;
62 | sh:sourceShape ex:PersonShape ;
63 | ] ;
64 | sh:result [
65 | rdf:type sh:ValidationResult ;
66 | sh:focusNode ex:Calvin ;
67 | sh:resultPath ex:worksFor ;
68 | sh:resultSeverity sh:Violation ;
69 | sh:sourceConstraintComponent sh:ClassConstraintComponent ;
70 | sh:sourceShape [] ;
71 | sh:value ex:UntypedCompany ;
72 | ] ;
73 | ] ;
74 | .
75 | ex:PersonShape
76 | rdf:type sh:NodeShape ;
77 | sh:closed "true"^^xsd:boolean ;
78 | sh:ignoredProperties (
79 | rdf:type
80 | ) ;
81 | sh:property [
82 | sh:path ex:ssn ;
83 | sh:datatype xsd:string ;
84 | sh:maxCount 1 ;
85 | sh:pattern "^\\d{3}-\\d{2}-\\d{4}$" ;
86 | ] ;
87 | sh:property [
88 | sh:path ex:worksFor ;
89 | sh:class ex:Company ;
90 | sh:nodeKind sh:IRI ;
91 | ] ;
92 | sh:property [
93 | sh:path [
94 | sh:inversePath ex:worksFor ;
95 | ] ;
96 | sh:name "employee" ;
97 | ] ;
98 | sh:targetClass ex:Person ;
99 | .
100 |
--------------------------------------------------------------------------------
/test/data/core/misc/deactivated-001.test.ttl:
--------------------------------------------------------------------------------
1 | # baseURI: http://datashapes.org/sh/tests/core/misc/deactivated-001.test
2 | # imports: http://datashapes.org/dash
3 | # prefix: ex
4 |
5 | @prefix dash: .
6 | @prefix ex: .
7 | @prefix owl: .
8 | @prefix rdf: .
9 | @prefix rdfs: .
10 | @prefix sh: .
11 | @prefix xsd: .
12 |
13 |
14 | rdf:type owl:Ontology ;
15 | rdfs:label "Test of deactivated-001" ;
16 | owl:imports ;
17 | owl:versionInfo "Created with TopBraid Composer" ;
18 | .
19 | ex:GraphValidationTestCase
20 | rdf:type dash:GraphValidationTestCase ;
21 | dash:expectedResult [
22 | rdf:type sh:ValidationReport ;
23 | sh:conforms "true"^^xsd:boolean ;
24 | ] ;
25 | .
26 | ex:InvalidResource
27 | rdf:type rdfs:Resource ;
28 | .
29 | ex:TestShape
30 | rdf:type sh:NodeShape ;
31 | sh:datatype xsd:boolean ;
32 | sh:deactivated "true"^^xsd:boolean ;
33 | sh:property ex:TestShape2 ;
34 | sh:targetNode ex:InvalidResource ;
35 | .
36 | ex:TestShape2
37 | rdf:type sh:PropertyShape ;
38 | sh:path ex:property ;
39 | sh:minCount 1 ;
40 | .
41 |
--------------------------------------------------------------------------------
/test/data/core/misc/deactivated-002.test.ttl:
--------------------------------------------------------------------------------
1 | # baseURI: http://datashapes.org/sh/tests/core/misc/deactivated-002.test
2 | # imports: http://datashapes.org/dash
3 | # prefix: ex
4 |
5 | @prefix dash: .
6 | @prefix ex: .
7 | @prefix owl: .
8 | @prefix rdf: .
9 | @prefix rdfs: .
10 | @prefix sh: .
11 | @prefix xsd: .
12 |
13 |
14 | rdf:type owl:Ontology ;
15 | rdfs:label "Test of deactivated-002" ;
16 | owl:imports ;
17 | owl:versionInfo "Created with TopBraid Composer" ;
18 | .
19 | ex:GraphValidationTestCase
20 | rdf:type dash:GraphValidationTestCase ;
21 | dash:expectedResult [
22 | rdf:type sh:ValidationReport ;
23 | sh:conforms "false"^^xsd:boolean ;
24 | sh:result [
25 | rdf:type sh:ValidationResult ;
26 | sh:focusNode 32 ;
27 | sh:resultSeverity sh:Violation ;
28 | sh:sourceConstraintComponent sh:DatatypeConstraintComponent ;
29 | sh:sourceShape ex:TestShape ;
30 | sh:value 32 ;
31 | ] ;
32 | ] ;
33 | .
34 | ex:TestShape
35 | rdf:type sh:NodeShape ;
36 | sh:datatype xsd:boolean ;
37 | sh:deactivated "false"^^xsd:boolean ;
38 | sh:targetNode 32 ;
39 | .
40 |
--------------------------------------------------------------------------------
/test/data/core/misc/severity-001.test.ttl:
--------------------------------------------------------------------------------
1 | # baseURI: http://datashapes.org/sh/tests/core/misc/severity-001.test
2 | # imports: http://datashapes.org/dash
3 | # prefix: ex
4 |
5 | @prefix dash: .
6 | @prefix ex: .
7 | @prefix owl: .
8 | @prefix rdf: .
9 | @prefix rdfs: .
10 | @prefix sh: .
11 | @prefix xsd: .
12 |
13 |
14 | rdf:type owl:Ontology ;
15 | rdfs:label "Test of sh:severity 001" ;
16 | owl:imports ;
17 | .
18 | ex:GraphValidationTestCase
19 | rdf:type dash:GraphValidationTestCase ;
20 | dash:expectedResult [
21 | rdf:type sh:ValidationReport ;
22 | sh:conforms "false"^^xsd:boolean ;
23 | sh:result [
24 | rdf:type sh:ValidationResult ;
25 | sh:focusNode "Hello" ;
26 | sh:resultSeverity sh:Warning ;
27 | sh:sourceConstraintComponent sh:DatatypeConstraintComponent ;
28 | sh:sourceShape ex:TestShape ;
29 | sh:value "Hello" ;
30 | ] ;
31 | ] ;
32 | .
33 | ex:TestShape
34 | rdf:type sh:NodeShape ;
35 | sh:datatype xsd:integer ;
36 | sh:severity sh:Warning ;
37 | sh:targetNode "Hello" ;
38 | .
39 |
--------------------------------------------------------------------------------
/test/data/core/misc/severity-002.test.ttl:
--------------------------------------------------------------------------------
1 | # baseURI: http://datashapes.org/sh/tests/core/misc/severity-002.test
2 | # imports: http://datashapes.org/dash
3 | # prefix: ex
4 |
5 | @prefix dash: .
6 | @prefix ex: .
7 | @prefix owl: .
8 | @prefix rdf: .
9 | @prefix rdfs: .
10 | @prefix sh: .
11 | @prefix xsd: .
12 |
13 |
14 | rdf:type owl:Ontology ;
15 | rdfs:label "Test of sh:severity 002" ;
16 | owl:imports ;
17 | .
18 | ex:GraphValidationTestCase
19 | rdf:type dash:GraphValidationTestCase ;
20 | dash:expectedResult [
21 | rdf:type sh:ValidationReport ;
22 | sh:conforms "false"^^xsd:boolean ;
23 | sh:result [
24 | rdf:type sh:ValidationResult ;
25 | sh:focusNode ex:InvalidResource1 ;
26 | sh:resultPath ex:property ;
27 | sh:resultSeverity sh:Info ;
28 | sh:sourceConstraintComponent sh:DatatypeConstraintComponent ;
29 | sh:sourceShape ex:TestShape2 ;
30 | sh:value "true"^^xsd:boolean ;
31 | ] ;
32 | sh:result [
33 | rdf:type sh:ValidationResult ;
34 | sh:focusNode ex:InvalidResource1 ;
35 | sh:resultSeverity ex:MySeverity ;
36 | sh:sourceConstraintComponent sh:NodeKindConstraintComponent ;
37 | sh:sourceShape ex:TestShape1 ;
38 | sh:value ex:InvalidResource1 ;
39 | ] ;
40 | ] ;
41 | .
42 | ex:InvalidResource1
43 | ex:property "true"^^xsd:boolean ;
44 | .
45 | ex:TestShape1
46 | sh:nodeKind sh:BlankNode ;
47 | sh:property ex:TestShape2 ;
48 | sh:severity ex:MySeverity ;
49 | sh:targetNode ex:InvalidResource1 ;
50 | .
51 | ex:TestShape2
52 | sh:path ex:property ;
53 | sh:datatype xsd:integer ;
54 | sh:severity sh:Info ;
55 | .
56 |
--------------------------------------------------------------------------------
/test/data/core/node/and-001.test.ttl:
--------------------------------------------------------------------------------
1 | # baseURI: http://datashapes.org/sh/tests/core/node/and-001.test
2 | # imports: http://datashapes.org/dash
3 | # prefix: ex
4 |
5 | @prefix dash: .
6 | @prefix ex: .
7 | @prefix owl: .
8 | @prefix rdf: .
9 | @prefix rdfs: .
10 | @prefix sh: .
11 | @prefix xsd: .
12 |
13 |
14 | rdf:type owl:Ontology ;
15 | rdfs:label "Test of sh:and at node shape 001" ;
16 | owl:imports ;
17 | .
18 | ex:GraphValidationTestCase
19 | rdf:type dash:GraphValidationTestCase ;
20 | dash:expectedResult [
21 | rdf:type sh:ValidationReport ;
22 | sh:conforms "false"^^xsd:boolean ;
23 | sh:result [
24 | rdf:type sh:ValidationResult ;
25 | sh:focusNode ex:InvalidRectangle1 ;
26 | sh:resultSeverity sh:Violation ;
27 | sh:sourceConstraintComponent sh:AndConstraintComponent ;
28 | sh:sourceShape ex:Rectangle ;
29 | sh:value ex:InvalidRectangle1 ;
30 | ] ;
31 | sh:result [
32 | rdf:type sh:ValidationResult ;
33 | sh:focusNode ex:InvalidRectangle2 ;
34 | sh:resultSeverity sh:Violation ;
35 | sh:sourceConstraintComponent sh:AndConstraintComponent ;
36 | sh:sourceShape ex:Rectangle ;
37 | sh:value ex:InvalidRectangle2 ;
38 | ] ;
39 | ] ;
40 | .
41 | ex:InvalidRectangle1
42 | rdf:type ex:Rectangle ;
43 | ex:height 3 ;
44 | .
45 | ex:InvalidRectangle2
46 | rdf:type ex:Rectangle ;
47 | ex:width 2 ;
48 | .
49 | ex:Rectangle
50 | rdf:type rdfs:Class ;
51 | rdf:type sh:NodeShape ;
52 | rdfs:subClassOf rdfs:Resource ;
53 | sh:and (
54 | [
55 | sh:property [
56 | sh:path ex:width ;
57 | sh:minCount 1 ;
58 | ] ;
59 | ]
60 | [
61 | sh:property [
62 | sh:path ex:height ;
63 | sh:minCount 1 ;
64 | ] ;
65 | ]
66 | ) ;
67 | .
68 | ex:ValidRectangle1
69 | rdf:type ex:Rectangle ;
70 | ex:height 3 ;
71 | ex:width 2 ;
72 | .
73 |
--------------------------------------------------------------------------------
/test/data/core/node/and-002.test.ttl:
--------------------------------------------------------------------------------
1 | # baseURI: http://datashapes.org/sh/tests/core/node/and-002.test
2 | # imports: http://datashapes.org/dash
3 | # prefix: ex
4 |
5 | @prefix dash: .
6 | @prefix ex: .
7 | @prefix owl: .
8 | @prefix rdf: .
9 | @prefix rdfs: .
10 | @prefix sh: .
11 | @prefix xsd: .
12 |
13 |
14 | rdf:type owl:Ontology ;
15 | rdfs:label "Test of sh:and at node shape 002" ;
16 | owl:imports ;
17 | owl:versionInfo "Created with TopBraid Composer" ;
18 | .
19 | ex:AndShape
20 | rdf:type sh:NodeShape ;
21 | sh:and (
22 | ex:SuperShape
23 | [
24 | sh:property [
25 | sh:path ex:property ;
26 | sh:maxCount 1 ;
27 | ] ;
28 | ]
29 | ) ;
30 | sh:targetNode ex:InvalidInstance1 ;
31 | sh:targetNode ex:InvalidInstance2 ;
32 | sh:targetNode ex:ValidInstance1 ;
33 | .
34 | ex:GraphValidationTestCase
35 | rdf:type dash:GraphValidationTestCase ;
36 | dash:expectedResult [
37 | rdf:type sh:ValidationReport ;
38 | sh:conforms "false"^^xsd:boolean ;
39 | sh:result [
40 | rdf:type sh:ValidationResult ;
41 | sh:focusNode ex:InvalidInstance1 ;
42 | sh:resultSeverity sh:Violation ;
43 | sh:sourceConstraintComponent sh:AndConstraintComponent ;
44 | sh:sourceShape ex:AndShape ;
45 | sh:value ex:InvalidInstance1 ;
46 | ] ;
47 | sh:result [
48 | rdf:type sh:ValidationResult ;
49 | sh:focusNode ex:InvalidInstance2 ;
50 | sh:resultSeverity sh:Violation ;
51 | sh:sourceConstraintComponent sh:AndConstraintComponent ;
52 | sh:sourceShape ex:AndShape ;
53 | sh:value ex:InvalidInstance2 ;
54 | ] ;
55 | ] ;
56 | .
57 | ex:InvalidInstance2
58 | ex:property "One" ;
59 | ex:property "Two" ;
60 | .
61 | ex:SuperShape
62 | rdf:type sh:NodeShape ;
63 | sh:property [
64 | sh:path ex:property ;
65 | sh:minCount 1 ;
66 | ] ;
67 | .
68 | ex:ValidInstance1
69 | ex:property "One" ;
70 | .
71 |
--------------------------------------------------------------------------------
/test/data/core/node/class-001.test.ttl:
--------------------------------------------------------------------------------
1 | # baseURI: http://datashapes.org/sh/tests/core/node/class-001.test
2 | # imports: http://datashapes.org/dash
3 | # prefix: ex
4 |
5 | @prefix dash: .
6 | @prefix ex: .
7 | @prefix owl: .
8 | @prefix rdf: .
9 | @prefix rdfs: .
10 | @prefix sh: .
11 | @prefix xsd: .
12 |
13 |
14 | rdf:type owl:Ontology ;
15 | rdfs:label "Test of sh:class at node shape 001" ;
16 | owl:imports ;
17 | .
18 | ex:GraphValidationTestCase
19 | rdf:type dash:GraphValidationTestCase ;
20 | dash:expectedResult [
21 | rdf:type sh:ValidationReport ;
22 | sh:conforms "false"^^xsd:boolean ;
23 | sh:result [
24 | rdf:type sh:ValidationResult ;
25 | sh:focusNode ex:Quokki ;
26 | sh:resultSeverity sh:Violation ;
27 | sh:sourceConstraintComponent sh:ClassConstraintComponent ;
28 | sh:sourceShape ex:TestShape ;
29 | sh:value ex:Quokki ;
30 | ] ;
31 | sh:result [
32 | rdf:type sh:ValidationResult ;
33 | sh:focusNode ex:Typeless ;
34 | sh:resultSeverity sh:Violation ;
35 | sh:sourceConstraintComponent sh:ClassConstraintComponent ;
36 | sh:sourceShape ex:TestShape ;
37 | sh:value ex:Typeless ;
38 | ] ;
39 | ] ;
40 | .
41 | ex:John
42 | rdf:type ex:MalePerson ;
43 | .
44 | ex:MalePerson
45 | rdf:type rdfs:Class ;
46 | rdfs:subClassOf ex:Person ;
47 | .
48 | ex:Person
49 | rdf:type rdfs:Class ;
50 | rdfs:subClassOf rdfs:Resource ;
51 | .
52 | ex:Quokki
53 | rdf:type ex:Animal ;
54 | .
55 | ex:Someone
56 | rdf:type ex:Person ;
57 | .
58 | ex:TestShape
59 | rdf:type sh:NodeShape ;
60 | sh:class ex:Person ;
61 | sh:targetNode ex:John ;
62 | sh:targetNode ex:Quokki ;
63 | sh:targetNode ex:Someone ;
64 | sh:targetNode ex:Typeless ;
65 | .
66 |
--------------------------------------------------------------------------------
/test/data/core/node/class-002.test.ttl:
--------------------------------------------------------------------------------
1 | # baseURI: http://datashapes.org/sh/tests/core/node/class-002.test
2 | # imports: http://datashapes.org/dash
3 | # prefix: ex
4 |
5 | @prefix dash: .
6 | @prefix ex: .
7 | @prefix owl: .
8 | @prefix rdf: .
9 | @prefix rdfs: .
10 | @prefix sh: .
11 | @prefix xsd: .
12 |
13 |
14 | rdf:type owl:Ontology ;
15 | rdfs:label "Test of sh:class at node shape 002" ;
16 | owl:imports ;
17 | .
18 | ex:GraphValidationTestCase
19 | rdf:type dash:GraphValidationTestCase ;
20 | dash:expectedResult [
21 | rdf:type sh:ValidationReport ;
22 | sh:conforms "false"^^xsd:boolean ;
23 | sh:result [
24 | rdf:type sh:ValidationResult ;
25 | sh:focusNode "String" ;
26 | sh:resultSeverity sh:Violation ;
27 | sh:sourceConstraintComponent sh:ClassConstraintComponent ;
28 | sh:sourceShape ex:TestShape ;
29 | sh:value "String" ;
30 | ] ;
31 | sh:result [
32 | rdf:type sh:ValidationResult ;
33 | sh:focusNode _:b9751 ;
34 | sh:resultSeverity sh:Violation ;
35 | sh:sourceConstraintComponent sh:ClassConstraintComponent ;
36 | sh:sourceShape ex:TestShape ;
37 | sh:value _:b9751 ;
38 | ] ;
39 | ] ;
40 | .
41 | ex:NamedInstance
42 | rdf:type ex:TestClass ;
43 | .
44 | ex:TestShape
45 | rdf:type sh:NodeShape ;
46 | sh:class ex:TestClass ;
47 | sh:targetClass ex:BNodeClass ;
48 | sh:targetNode ex:NamedInstance ;
49 | sh:targetNode "String" ;
50 | .
51 | _:b9751
52 | rdf:type ex:BNodeClass ;
53 | .
54 | [
55 | rdf:type ex:BNodeClass ;
56 | rdf:type ex:TestClass ;
57 | ].
58 |
--------------------------------------------------------------------------------
/test/data/core/node/closed-001.test.ttl:
--------------------------------------------------------------------------------
1 | # baseURI: http://datashapes.org/sh/tests/core/node/closed-001.test
2 | # imports: http://datashapes.org/dash
3 | # prefix: ex
4 |
5 | @prefix dash: .
6 | @prefix ex: .
7 | @prefix owl: .
8 | @prefix rdf: .
9 | @prefix rdfs: .
10 | @prefix sh: .
11 | @prefix xsd: .
12 |
13 |
14 | rdf:type owl:Ontology ;
15 | rdfs:label "Test of sh:closed at node shape 001" ;
16 | owl:imports ;
17 | owl:versionInfo "Created with TopBraid Composer" ;
18 | .
19 | ex:GraphValidationTestCase
20 | rdf:type dash:GraphValidationTestCase ;
21 | dash:expectedResult [
22 | rdf:type sh:ValidationReport ;
23 | sh:conforms "false"^^xsd:boolean ;
24 | sh:result [
25 | rdf:type sh:ValidationResult ;
26 | sh:focusNode ex:InvalidInstance1 ;
27 | sh:resultPath rdf:type ;
28 | sh:resultSeverity sh:Violation ;
29 | sh:sourceConstraintComponent sh:ClosedConstraintComponent ;
30 | sh:sourceShape ex:MyShape ;
31 | sh:value ex:SomeClass ;
32 | ] ;
33 | sh:result [
34 | rdf:type sh:ValidationResult ;
35 | sh:focusNode ex:InvalidInstance1 ;
36 | sh:resultPath ex:otherProperty ;
37 | sh:resultSeverity sh:Violation ;
38 | sh:sourceConstraintComponent sh:ClosedConstraintComponent ;
39 | sh:sourceShape ex:MyShape ;
40 | sh:value 4 ;
41 | ] ;
42 | ] ;
43 | .
44 | ex:InvalidInstance1
45 | rdf:type ex:SomeClass ;
46 | ex:otherProperty 4 ;
47 | ex:someProperty 3 ;
48 | .
49 | ex:MyShape
50 | rdf:type sh:NodeShape ;
51 | sh:closed "true"^^xsd:boolean ;
52 | sh:property [
53 | sh:path ex:someProperty ;
54 | ] ;
55 | sh:targetNode ex:InvalidInstance1 ;
56 | sh:targetNode ex:ValidInstance1 ;
57 | .
58 | ex:ValidInstance1
59 | ex:someProperty 3 ;
60 | .
61 |
--------------------------------------------------------------------------------
/test/data/core/node/closed-002.test.ttl:
--------------------------------------------------------------------------------
1 | # baseURI: http://datashapes.org/sh/tests/core/node/closed-002.test
2 | # imports: http://datashapes.org/dash
3 | # prefix: ex
4 |
5 | @prefix dash: .
6 | @prefix ex: .
7 | @prefix owl: .
8 | @prefix rdf: .
9 | @prefix rdfs: .
10 | @prefix sh: .
11 | @prefix xsd: .
12 |
13 |
14 | rdf:type owl:Ontology ;
15 | rdfs:label "Test of sh:closed at node shape 002" ;
16 | owl:imports ;
17 | owl:versionInfo "Created with TopBraid Composer" ;
18 | .
19 | ex:GraphValidationTestCase
20 | rdf:type dash:GraphValidationTestCase ;
21 | dash:expectedResult [
22 | rdf:type sh:ValidationReport ;
23 | sh:conforms "false"^^xsd:boolean ;
24 | sh:result [
25 | rdf:type sh:ValidationResult ;
26 | sh:focusNode ex:InvalidInstance1 ;
27 | sh:resultPath ex:otherProperty ;
28 | sh:resultSeverity sh:Violation ;
29 | sh:sourceConstraintComponent sh:ClosedConstraintComponent ;
30 | sh:sourceShape ex:MyShape ;
31 | sh:value 4 ;
32 | ] ;
33 | ] ;
34 | .
35 | ex:InvalidInstance1
36 | ex:otherProperty 4 ;
37 | ex:someProperty 3 ;
38 | .
39 | ex:MyShape
40 | rdf:type sh:NodeShape ;
41 | sh:closed "true"^^xsd:boolean ;
42 | sh:ignoredProperties (
43 | rdf:type
44 | ) ;
45 | sh:property [
46 | sh:path ex:someProperty ;
47 | ] ;
48 | sh:targetNode ex:InvalidInstance1 ;
49 | sh:targetNode ex:ValidInstance1 ;
50 | .
51 | ex:ValidInstance1
52 | rdf:type ex:SomeClass ;
53 | ex:someProperty 3 ;
54 | .
55 |
--------------------------------------------------------------------------------
/test/data/core/node/datatype-001.test.ttl:
--------------------------------------------------------------------------------
1 | # baseURI: http://datashapes.org/sh/tests/core/node/datatype-001.test
2 | # imports: http://datashapes.org/dash
3 | # prefix: ex
4 |
5 | @prefix dash: .
6 | @prefix ex: .
7 | @prefix owl: .
8 | @prefix rdf: .
9 | @prefix rdfs: .
10 | @prefix sh: .
11 | @prefix xsd: .
12 |
13 |
14 | rdf:type owl:Ontology ;
15 | rdfs:label "Test of sh:datatype at node shape 001" ;
16 | owl:imports ;
17 | .
18 | ex:GraphValidationTestCase
19 | rdf:type dash:GraphValidationTestCase ;
20 | dash:expectedResult [
21 | rdf:type sh:ValidationReport ;
22 | sh:conforms "false"^^xsd:boolean ;
23 | sh:result [
24 | rdf:type sh:ValidationResult ;
25 | sh:focusNode xsd:integer ;
26 | sh:resultSeverity sh:Violation ;
27 | sh:sourceConstraintComponent sh:DatatypeConstraintComponent ;
28 | sh:sourceShape ex:TestShape ;
29 | sh:value xsd:integer ;
30 | ] ;
31 | sh:result [
32 | rdf:type sh:ValidationResult ;
33 | sh:focusNode "aldi"^^xsd:integer ;
34 | sh:resultSeverity sh:Violation ;
35 | sh:sourceConstraintComponent sh:DatatypeConstraintComponent ;
36 | sh:sourceShape ex:TestShape ;
37 | sh:value "aldi"^^xsd:integer ;
38 | ] ;
39 | sh:result [
40 | rdf:type sh:ValidationResult ;
41 | sh:focusNode _:b9649 ;
42 | sh:resultSeverity sh:Violation ;
43 | sh:sourceConstraintComponent sh:DatatypeConstraintComponent ;
44 | sh:sourceShape ex:TestShape ;
45 | sh:value _:b9649 ;
46 | ] ;
47 | ] ;
48 | .
49 | ex:TestShape
50 | rdf:type sh:NodeShape ;
51 | sh:datatype xsd:integer ;
52 | sh:targetNode xsd:integer ;
53 | sh:targetNode 42 ;
54 | sh:targetNode "aldi"^^xsd:integer ;
55 | sh:targetClass ex:TestClass ;
56 | .
57 | _:b9649
58 | rdf:type ex:TestClass ;
59 | .
60 |
--------------------------------------------------------------------------------
/test/data/core/node/datatype-002.test.ttl:
--------------------------------------------------------------------------------
1 | # baseURI: http://datashapes.org/sh/tests/core/node/datatype-002.test
2 | # imports: http://datashapes.org/dash
3 | # prefix: ex
4 |
5 | @prefix dash: .
6 | @prefix ex: .
7 | @prefix owl: .
8 | @prefix rdf: .
9 | @prefix rdfs: .
10 | @prefix sh: .
11 | @prefix xsd: .
12 |
13 |
14 | rdf:type owl:Ontology ;
15 | rdfs:label "Test of sh:datatype at node shape 002" ;
16 | owl:imports ;
17 | .
18 | ex:GraphValidationTestCase
19 | rdf:type dash:GraphValidationTestCase ;
20 | dash:expectedResult [
21 | rdf:type sh:ValidationReport ;
22 | sh:conforms "false"^^xsd:boolean ;
23 | sh:result [
24 | rdf:type sh:ValidationResult ;
25 | sh:focusNode "Hello"^^rdf:HTML ;
26 | sh:resultSeverity sh:Violation ;
27 | sh:sourceConstraintComponent sh:DatatypeConstraintComponent ;
28 | sh:sourceShape ex:TestShape ;
29 | sh:value "Hello"^^rdf:HTML ;
30 | ] ;
31 | sh:result [
32 | rdf:type sh:ValidationResult ;
33 | sh:focusNode "Hello" ;
34 | sh:resultSeverity sh:Violation ;
35 | sh:sourceConstraintComponent sh:DatatypeConstraintComponent ;
36 | sh:sourceShape ex:TestShape ;
37 | sh:value "Hello" ;
38 | ] ;
39 | ] ;
40 | .
41 | ex:TestShape
42 | rdf:type sh:NodeShape ;
43 | sh:datatype rdf:langString ;
44 | sh:targetNode "Hello"^^rdf:HTML ;
45 | sh:targetNode "G'day"@en-AU ;
46 | sh:targetNode "Hallo"@de ;
47 | sh:targetNode "Hello" ;
48 | .
49 |
--------------------------------------------------------------------------------
/test/data/core/node/disjoint-001.test.ttl:
--------------------------------------------------------------------------------
1 | # baseURI: http://datashapes.org/sh/tests/core/node/disjoint-001.test
2 | # imports: http://datashapes.org/dash
3 | # prefix: ex
4 |
5 | @prefix dash: .
6 | @prefix ex: .
7 | @prefix owl: .
8 | @prefix rdf: .
9 | @prefix rdfs: .
10 | @prefix sh: .
11 | @prefix xsd: .
12 |
13 |
14 | rdf:type owl:Ontology ;
15 | rdfs:label "Test of sh:disjoint at node shape 001" ;
16 | owl:imports ;
17 | owl:versionInfo "Created with TopBraid Composer" ;
18 | .
19 | ex:GraphValidationTestCase
20 | rdf:type dash:GraphValidationTestCase ;
21 | dash:expectedResult [
22 | rdf:type sh:ValidationReport ;
23 | sh:conforms "false"^^xsd:boolean ;
24 | sh:result [
25 | rdf:type sh:ValidationResult ;
26 | sh:focusNode ex:InvalidResource1 ;
27 | sh:resultSeverity sh:Violation ;
28 | sh:sourceConstraintComponent sh:DisjointConstraintComponent ;
29 | sh:sourceShape ex:TestShape ;
30 | sh:value ex:InvalidResource1 ;
31 | ] ;
32 | ] ;
33 | .
34 | ex:InvalidResource1
35 | ex:property ex:InvalidResource1 ;
36 | ex:property ex:ValidResource1 ;
37 | .
38 | ex:TestShape
39 | rdf:type sh:NodeShape ;
40 | rdfs:label "Test shape" ;
41 | sh:disjoint ex:property ;
42 | sh:targetNode ex:InvalidResource1 ;
43 | sh:targetNode ex:ValidResource1 ;
44 | .
45 | ex:ValidResource1
46 | ex:property ex:InvalidResource1 ;
47 | .
48 |
--------------------------------------------------------------------------------
/test/data/core/node/equals-001.test.ttl:
--------------------------------------------------------------------------------
1 | # baseURI: http://datashapes.org/sh/tests/core/node/equals-001.test
2 | # imports: http://datashapes.org/dash
3 | # prefix: ex
4 |
5 | @prefix dash: .
6 | @prefix ex: .
7 | @prefix owl: .
8 | @prefix rdf: .
9 | @prefix rdfs: .
10 | @prefix sh: .
11 | @prefix xsd: .
12 |
13 |
14 | rdf:type owl:Ontology ;
15 | rdfs:label "Test of sh:equals at node shape 001" ;
16 | owl:imports ;
17 | owl:versionInfo "Created with TopBraid Composer" ;
18 | .
19 | ex:GraphValidationTestCase
20 | rdf:type dash:GraphValidationTestCase ;
21 | dash:expectedResult [
22 | rdf:type sh:ValidationReport ;
23 | sh:conforms "false"^^xsd:boolean ;
24 | sh:result [
25 | rdf:type sh:ValidationResult ;
26 | sh:focusNode ex:InvalidResource1 ;
27 | sh:resultSeverity sh:Violation ;
28 | sh:sourceConstraintComponent sh:EqualsConstraintComponent ;
29 | sh:sourceShape ex:TestShape ;
30 | sh:value ex:SomeValue ;
31 | ] ;
32 | sh:result [
33 | rdf:type sh:ValidationResult ;
34 | sh:focusNode ex:InvalidResource2 ;
35 | sh:resultSeverity sh:Violation ;
36 | sh:sourceConstraintComponent sh:EqualsConstraintComponent ;
37 | sh:sourceShape ex:TestShape ;
38 | sh:value ex:InvalidResource2 ;
39 | ] ;
40 | ] ;
41 | .
42 | ex:InvalidResource1
43 | ex:property ex:InvalidResource1 ;
44 | ex:property ex:SomeValue ;
45 | .
46 | ex:TestShape
47 | rdf:type sh:NodeShape ;
48 | sh:equals ex:property ;
49 | sh:targetNode ex:InvalidResource1 ;
50 | sh:targetNode ex:InvalidResource2 ;
51 | sh:targetNode ex:ValidResource1 ;
52 | .
53 | ex:ValidResource1
54 | ex:property ex:ValidResource1 ;
55 | .
56 |
--------------------------------------------------------------------------------
/test/data/core/node/hasValue-001.test.ttl:
--------------------------------------------------------------------------------
1 | # baseURI: http://datashapes.org/sh/tests/core/node/hasValue-001.test
2 | # imports: http://datashapes.org/dash
3 | # prefix: ex
4 |
5 | @prefix dash: .
6 | @prefix ex: .
7 | @prefix owl: .
8 | @prefix rdf: .
9 | @prefix rdfs: .
10 | @prefix sh: .
11 | @prefix xsd: .
12 |
13 |
14 | rdf:type owl:Ontology ;
15 | rdfs:label "Test of sh:hasValue at node shape 001" ;
16 | owl:imports ;
17 | owl:versionInfo "Created with TopBraid Composer" ;
18 | .
19 | ex:GraphValidationTestCase
20 | rdf:type dash:GraphValidationTestCase ;
21 | dash:expectedResult [
22 | rdf:type sh:ValidationReport ;
23 | sh:conforms "false"^^xsd:boolean ;
24 | sh:result [
25 | rdf:type sh:ValidationResult ;
26 | sh:focusNode "Invalid String" ;
27 | sh:resultSeverity sh:Violation ;
28 | sh:sourceConstraintComponent sh:HasValueConstraintComponent ;
29 | sh:sourceShape ex:TestShape ;
30 | sh:value "Invalid String" ;
31 | ] ;
32 | ] ;
33 | .
34 | ex:TestShape
35 | rdf:type sh:NodeShape ;
36 | rdfs:label "Test shape" ;
37 | sh:hasValue "Test" ;
38 | sh:targetNode "Invalid String" ;
39 | sh:targetNode "Test" ;
40 | .
41 |
--------------------------------------------------------------------------------
/test/data/core/node/in-001.test.ttl:
--------------------------------------------------------------------------------
1 | # baseURI: http://datashapes.org/sh/tests/core/node/in-001.test
2 | # imports: http://datashapes.org/dash
3 | # prefix: ex
4 |
5 | @prefix dash: .
6 | @prefix ex: .
7 | @prefix owl: .
8 | @prefix rdf: .
9 | @prefix rdfs: .
10 | @prefix sh: .
11 | @prefix xsd: .
12 |
13 |
14 | rdf:type owl:Ontology ;
15 | rdfs:label "Test of sh:in at node shape 001" ;
16 | owl:imports ;
17 | owl:versionInfo "Created with TopBraid Composer" ;
18 | .
19 | ex:GraphValidationTestCase
20 | rdf:type dash:GraphValidationTestCase ;
21 | dash:expectedResult [
22 | rdf:type sh:ValidationReport ;
23 | sh:conforms "false"^^xsd:boolean ;
24 | sh:result [
25 | rdf:type sh:ValidationResult ;
26 | sh:focusNode ex:InvalidInstance ;
27 | sh:resultSeverity sh:Violation ;
28 | sh:sourceConstraintComponent sh:InConstraintComponent ;
29 | sh:sourceShape ex:TestShape ;
30 | sh:value ex:InvalidInstance ;
31 | ] ;
32 | ] ;
33 | .
34 | ex:Green
35 | rdf:type ex:TestShape ;
36 | rdfs:label "Green" ;
37 | .
38 | ex:InvalidInstance
39 | rdf:type ex:TestShape ;
40 | rdfs:label "Invalid instance" ;
41 | .
42 | ex:Red
43 | rdf:type ex:TestShape ;
44 | rdfs:label "Red" ;
45 | .
46 | ex:TestShape
47 | rdf:type rdfs:Class ;
48 | rdf:type sh:NodeShape ;
49 | rdfs:label "Test shape" ;
50 | sh:in (
51 | ex:Green
52 | ex:Red
53 | ex:Yellow
54 | ) ;
55 | .
56 | ex:Yellow
57 | rdf:type ex:TestShape ;
58 | rdfs:label "Yellow" ;
59 | .
60 |
--------------------------------------------------------------------------------
/test/data/core/node/languageIn-001.test.ttl:
--------------------------------------------------------------------------------
1 | # baseURI: http://datashapes.org/sh/tests/core/node/languageIn-001.test
2 | # imports: http://datashapes.org/dash
3 | # prefix: ex
4 |
5 | @prefix dash: .
6 | @prefix ex: .
7 | @prefix owl: .
8 | @prefix rdf: .
9 | @prefix rdfs: .
10 | @prefix sh: .
11 | @prefix xsd: .
12 |
13 |
14 | rdf:type owl:Ontology ;
15 | rdfs:label "Test of sh:languageIn at node shape 001" ;
16 | owl:imports ;
17 | .
18 | ex:GraphValidationTestCase
19 | rdf:type dash:GraphValidationTestCase ;
20 | dash:expectedResult [
21 | rdf:type sh:ValidationReport ;
22 | sh:conforms "false"^^xsd:boolean ;
23 | sh:result [
24 | rdf:type sh:ValidationResult ;
25 | sh:focusNode rdfs:Resource ;
26 | sh:resultSeverity sh:Violation ;
27 | sh:sourceConstraintComponent sh:LanguageInConstraintComponent ;
28 | sh:sourceShape ex:TestShape ;
29 | sh:value rdfs:Resource ;
30 | ] ;
31 | sh:result [
32 | rdf:type sh:ValidationResult ;
33 | sh:focusNode "Deutsch"@de ;
34 | sh:resultSeverity sh:Violation ;
35 | sh:sourceConstraintComponent sh:LanguageInConstraintComponent ;
36 | sh:sourceShape ex:TestShape ;
37 | sh:value "Deutsch"@de ;
38 | ] ;
39 | sh:result [
40 | rdf:type sh:ValidationResult ;
41 | sh:focusNode "Plain String" ;
42 | sh:resultSeverity sh:Violation ;
43 | sh:sourceConstraintComponent sh:LanguageInConstraintComponent ;
44 | sh:sourceShape ex:TestShape ;
45 | sh:value "Plain String" ;
46 | ] ;
47 | ] ;
48 | .
49 | ex:TestShape
50 | rdf:type sh:NodeShape ;
51 | rdfs:label "Test shape" ;
52 | sh:languageIn (
53 | "en"
54 | "fr"
55 | ) ;
56 | sh:targetNode rdfs:Resource ;
57 | sh:targetNode "Deutsch"@de ;
58 | sh:targetNode "English"@en ;
59 | sh:targetNode "Francais"@fr ;
60 | sh:targetNode "Plain String" ;
61 | .
62 |
--------------------------------------------------------------------------------
/test/data/core/node/maxExclusive-001.test.ttl:
--------------------------------------------------------------------------------
1 | # baseURI: http://datashapes.org/sh/tests/core/node/maxExclusive-001.test
2 | # imports: http://datashapes.org/dash
3 | # prefix: ex
4 |
5 | @prefix dash: .
6 | @prefix ex: .
7 | @prefix owl: .
8 | @prefix rdf: .
9 | @prefix rdfs: .
10 | @prefix sh: .
11 | @prefix xsd: .
12 |
13 |
14 | rdf:type owl:Ontology ;
15 | rdfs:label "Test of sh:maxExclusive at node shape 001" ;
16 | owl:imports ;
17 | .
18 | ex:GraphValidationTestCase
19 | rdf:type dash:GraphValidationTestCase ;
20 | dash:expectedResult [
21 | rdf:type sh:ValidationReport ;
22 | sh:conforms "false"^^xsd:boolean ;
23 | sh:result [
24 | rdf:type sh:ValidationResult ;
25 | sh:focusNode ex:John ;
26 | sh:resultSeverity sh:Violation ;
27 | sh:sourceConstraintComponent sh:MaxExclusiveConstraintComponent ;
28 | sh:sourceShape ex:TestShape ;
29 | sh:value ex:John ;
30 | ] ;
31 | sh:result [
32 | rdf:type sh:ValidationResult ;
33 | sh:focusNode 4 ;
34 | sh:resultSeverity sh:Violation ;
35 | sh:sourceConstraintComponent sh:MaxExclusiveConstraintComponent ;
36 | sh:sourceShape ex:TestShape ;
37 | sh:value 4 ;
38 | ] ;
39 | sh:result [
40 | rdf:type sh:ValidationResult ;
41 | sh:focusNode 4.0 ;
42 | sh:resultSeverity sh:Violation ;
43 | sh:sourceConstraintComponent sh:MaxExclusiveConstraintComponent ;
44 | sh:sourceShape ex:TestShape ;
45 | sh:value 4.0 ;
46 | ] ;
47 | sh:result [
48 | rdf:type sh:ValidationResult ;
49 | sh:focusNode 4.1 ;
50 | sh:resultSeverity sh:Violation ;
51 | sh:sourceConstraintComponent sh:MaxExclusiveConstraintComponent ;
52 | sh:sourceShape ex:TestShape ;
53 | sh:value 4.1 ;
54 | ] ;
55 | sh:result [
56 | rdf:type sh:ValidationResult ;
57 | sh:focusNode "Hello" ;
58 | sh:resultSeverity sh:Violation ;
59 | sh:sourceConstraintComponent sh:MaxExclusiveConstraintComponent ;
60 | sh:sourceShape ex:TestShape ;
61 | sh:value "Hello" ;
62 | ] ;
63 | sh:result [
64 | rdf:type sh:ValidationResult ;
65 | sh:focusNode _:b9649 ;
66 | sh:resultSeverity sh:Violation ;
67 | sh:sourceConstraintComponent sh:MaxExclusiveConstraintComponent ;
68 | sh:sourceShape ex:TestShape ;
69 | sh:value _:b9649 ;
70 | ] ;
71 | ] ;
72 | .
73 | ex:TestShape
74 | rdf:type sh:NodeShape ;
75 | sh:maxExclusive 4 ;
76 | sh:targetNode ex:John ;
77 | sh:targetNode 3.9 ;
78 | sh:targetNode 4 ;
79 | sh:targetNode 4.0 ;
80 | sh:targetNode 4.1 ;
81 | sh:targetNode "Hello" ;
82 | sh:targetClass ex:TestClass ;
83 | .
84 | _:b9649
85 | rdf:type ex:TestClass ;
86 | .
87 |
--------------------------------------------------------------------------------
/test/data/core/node/maxInclusive-001.test.ttl:
--------------------------------------------------------------------------------
1 | # baseURI: http://datashapes.org/sh/tests/core/node/maxInclusive-001.test
2 | # imports: http://datashapes.org/dash
3 | # prefix: ex
4 |
5 | @prefix dash: .
6 | @prefix ex: .
7 | @prefix owl: .
8 | @prefix rdf: .
9 | @prefix rdfs: .
10 | @prefix sh: .
11 | @prefix xsd: .
12 |
13 |
14 | rdf:type owl:Ontology ;
15 | rdfs:label "Test of sh:maxInclusive at node shape 001" ;
16 | owl:imports ;
17 | .
18 | ex:GraphValidationTestCase
19 | rdf:type dash:GraphValidationTestCase ;
20 | dash:expectedResult [
21 | rdf:type sh:ValidationReport ;
22 | sh:conforms "false"^^xsd:boolean ;
23 | sh:result [
24 | rdf:type sh:ValidationResult ;
25 | sh:focusNode ex:John ;
26 | sh:resultSeverity sh:Violation ;
27 | sh:sourceConstraintComponent sh:MaxInclusiveConstraintComponent ;
28 | sh:sourceShape ex:TestShape ;
29 | sh:value ex:John ;
30 | ] ;
31 | sh:result [
32 | rdf:type sh:ValidationResult ;
33 | sh:focusNode 4.1 ;
34 | sh:resultSeverity sh:Violation ;
35 | sh:sourceConstraintComponent sh:MaxInclusiveConstraintComponent ;
36 | sh:sourceShape ex:TestShape ;
37 | sh:value 4.1 ;
38 | ] ;
39 | sh:result [
40 | rdf:type sh:ValidationResult ;
41 | sh:focusNode "Hello" ;
42 | sh:resultSeverity sh:Violation ;
43 | sh:sourceConstraintComponent sh:MaxInclusiveConstraintComponent ;
44 | sh:sourceShape ex:TestShape ;
45 | sh:value "Hello" ;
46 | ] ;
47 | sh:result [
48 | rdf:type sh:ValidationResult ;
49 | sh:focusNode _:b9649 ;
50 | sh:resultSeverity sh:Violation ;
51 | sh:sourceConstraintComponent sh:MaxInclusiveConstraintComponent ;
52 | sh:sourceShape ex:TestShape ;
53 | sh:value _:b9649 ;
54 | ] ;
55 | ] ;
56 | .
57 | ex:TestShape
58 | rdf:type sh:NodeShape ;
59 | sh:maxInclusive 4 ;
60 | sh:targetNode ex:John ;
61 | sh:targetNode 3.9 ;
62 | sh:targetNode 4 ;
63 | sh:targetNode 4.0 ;
64 | sh:targetNode 4.1 ;
65 | sh:targetNode "Hello" ;
66 | sh:targetClass ex:TestClass ;
67 | .
68 | _:b9649
69 | rdf:type ex:TestClass ;
70 | .
71 |
--------------------------------------------------------------------------------
/test/data/core/node/maxLength-001.test.ttl:
--------------------------------------------------------------------------------
1 | # baseURI: http://datashapes.org/sh/tests/core/node/maxLength-001.test
2 | # imports: http://datashapes.org/dash
3 | # prefix: ex
4 |
5 | @prefix dash: .
6 | @prefix ex: .
7 | @prefix owl: .
8 | @prefix rdf: .
9 | @prefix rdfs: .
10 | @prefix sh: .
11 | @prefix xsd: .
12 |
13 |
14 | rdf:type owl:Ontology ;
15 | rdfs:label "Test of sh:maxLength at node shape 001" ;
16 | owl:imports ;
17 | .
18 | ex:GraphValidationTestCase
19 | rdf:type dash:GraphValidationTestCase ;
20 | dash:expectedResult [
21 | rdf:type sh:ValidationReport ;
22 | sh:conforms "false"^^xsd:boolean ;
23 | sh:result [
24 | rdf:type sh:ValidationResult ;
25 | sh:focusNode ex:John ;
26 | sh:resultSeverity sh:Violation ;
27 | sh:sourceConstraintComponent sh:MaxLengthConstraintComponent ;
28 | sh:sourceShape ex:TestShape ;
29 | sh:value ex:John ;
30 | ] ;
31 | sh:result [
32 | rdf:type sh:ValidationResult ;
33 | sh:focusNode 12345 ;
34 | sh:resultSeverity sh:Violation ;
35 | sh:sourceConstraintComponent sh:MaxLengthConstraintComponent ;
36 | sh:sourceShape ex:TestShape ;
37 | sh:value 12345 ;
38 | ] ;
39 | sh:result [
40 | rdf:type sh:ValidationResult ;
41 | sh:focusNode "2017-03-29"^^xsd:date ;
42 | sh:resultSeverity sh:Violation ;
43 | sh:sourceConstraintComponent sh:MaxLengthConstraintComponent ;
44 | sh:sourceShape ex:TestShape ;
45 | sh:value "2017-03-29"^^xsd:date ;
46 | ] ;
47 | sh:result [
48 | rdf:type sh:ValidationResult ;
49 | sh:focusNode "Hello" ;
50 | sh:resultSeverity sh:Violation ;
51 | sh:sourceConstraintComponent sh:MaxLengthConstraintComponent ;
52 | sh:sourceShape ex:TestShape ;
53 | sh:value "Hello" ;
54 | ] ;
55 | sh:result [
56 | rdf:type sh:ValidationResult ;
57 | sh:focusNode _:b9649 ;
58 | sh:resultSeverity sh:Violation ;
59 | sh:sourceConstraintComponent sh:MaxLengthConstraintComponent ;
60 | sh:sourceShape ex:TestShape ;
61 | sh:value _:b9649 ;
62 | ] ;
63 | ] ;
64 | .
65 | ex:TestShape
66 | rdf:type sh:NodeShape ;
67 | sh:maxLength 4 ;
68 | sh:targetNode ;
69 | sh:targetNode ex:John ;
70 | sh:targetNode 123 ;
71 | sh:targetNode 1234 ;
72 | sh:targetNode 12345 ;
73 | sh:targetNode "2017-03-29"^^xsd:date ;
74 | sh:targetNode "Hel" ;
75 | sh:targetNode "Hell" ;
76 | sh:targetNode "Hell"@en ;
77 | sh:targetNode "Hello" ;
78 | sh:targetClass ex:TestClass ;
79 | .
80 | _:b9649
81 | rdf:type ex:TestClass ;
82 | .
83 |
--------------------------------------------------------------------------------
/test/data/core/node/minExclusive-001.test.ttl:
--------------------------------------------------------------------------------
1 | # baseURI: http://datashapes.org/sh/tests/core/node/minExclusive-001.test
2 | # imports: http://datashapes.org/dash
3 | # prefix: ex
4 |
5 | @prefix dash: .
6 | @prefix ex: .
7 | @prefix owl: .
8 | @prefix rdf: .
9 | @prefix rdfs: .
10 | @prefix sh: .
11 | @prefix xsd: .
12 |
13 |
14 | rdf:type owl:Ontology ;
15 | rdfs:label "Test of sh:minExclusive at node shape 001" ;
16 | owl:imports ;
17 | .
18 | ex:GraphValidationTestCase
19 | rdf:type dash:GraphValidationTestCase ;
20 | dash:expectedResult [
21 | rdf:type sh:ValidationReport ;
22 | sh:conforms "false"^^xsd:boolean ;
23 | sh:result [
24 | rdf:type sh:ValidationResult ;
25 | sh:focusNode ex:John ;
26 | sh:resultSeverity sh:Violation ;
27 | sh:sourceConstraintComponent sh:MinExclusiveConstraintComponent ;
28 | sh:sourceShape ex:TestShape ;
29 | sh:value ex:John ;
30 | ] ;
31 | sh:result [
32 | rdf:type sh:ValidationResult ;
33 | sh:focusNode 3.9 ;
34 | sh:resultSeverity sh:Violation ;
35 | sh:sourceConstraintComponent sh:MinExclusiveConstraintComponent ;
36 | sh:sourceShape ex:TestShape ;
37 | sh:value 3.9 ;
38 | ] ;
39 | sh:result [
40 | rdf:type sh:ValidationResult ;
41 | sh:focusNode 4 ;
42 | sh:resultSeverity sh:Violation ;
43 | sh:sourceConstraintComponent sh:MinExclusiveConstraintComponent ;
44 | sh:sourceShape ex:TestShape ;
45 | sh:value 4 ;
46 | ] ;
47 | sh:result [
48 | rdf:type sh:ValidationResult ;
49 | sh:focusNode 4.0 ;
50 | sh:resultSeverity sh:Violation ;
51 | sh:sourceConstraintComponent sh:MinExclusiveConstraintComponent ;
52 | sh:sourceShape ex:TestShape ;
53 | sh:value 4.0 ;
54 | ] ;
55 | sh:result [
56 | rdf:type sh:ValidationResult ;
57 | sh:focusNode "Hello" ;
58 | sh:resultSeverity sh:Violation ;
59 | sh:sourceConstraintComponent sh:MinExclusiveConstraintComponent ;
60 | sh:sourceShape ex:TestShape ;
61 | sh:value "Hello" ;
62 | ] ;
63 | sh:result [
64 | rdf:type sh:ValidationResult ;
65 | sh:focusNode _:b9649 ;
66 | sh:resultSeverity sh:Violation ;
67 | sh:sourceConstraintComponent sh:MinExclusiveConstraintComponent ;
68 | sh:sourceShape ex:TestShape ;
69 | sh:value _:b9649 ;
70 | ] ;
71 | ] ;
72 | .
73 | ex:TestShape
74 | rdf:type sh:NodeShape ;
75 | sh:minExclusive 4 ;
76 | sh:targetNode ex:John ;
77 | sh:targetNode 3.9 ;
78 | sh:targetNode 4 ;
79 | sh:targetNode 4.0 ;
80 | sh:targetNode 4.1 ;
81 | sh:targetNode "Hello" ;
82 | sh:targetClass ex:TestClass ;
83 | .
84 | _:b9649
85 | rdf:type ex:TestClass ;
86 | .
87 |
--------------------------------------------------------------------------------
/test/data/core/node/minInclusive-001.test.ttl:
--------------------------------------------------------------------------------
1 | # baseURI: http://datashapes.org/sh/tests/core/node/minInclusive-001.test
2 | # imports: http://datashapes.org/dash
3 | # prefix: ex
4 |
5 | @prefix dash: .
6 | @prefix ex: .
7 | @prefix owl: .
8 | @prefix rdf: .
9 | @prefix rdfs: .
10 | @prefix sh: .
11 | @prefix xsd: .
12 |
13 |
14 | rdf:type owl:Ontology ;
15 | rdfs:label "Test of sh:minInclusive at node shape 001" ;
16 | owl:imports ;
17 | owl:versionInfo "Created with TopBraid Composer" ;
18 | .
19 | ex:GraphValidationTestCase
20 | rdf:type dash:GraphValidationTestCase ;
21 | dash:expectedResult [
22 | rdf:type sh:ValidationReport ;
23 | sh:conforms "false"^^xsd:boolean ;
24 | sh:result [
25 | rdf:type sh:ValidationResult ;
26 | sh:focusNode 7 ;
27 | sh:resultSeverity sh:Violation ;
28 | sh:sourceConstraintComponent sh:MinInclusiveConstraintComponent ;
29 | sh:sourceShape ex:TestShape ;
30 | sh:value 7 ;
31 | ] ;
32 | ] ;
33 | .
34 | ex:TestShape
35 | rdf:type sh:NodeShape ;
36 | sh:minInclusive 8 ;
37 | sh:targetNode 7 ;
38 | sh:targetNode 8 ;
39 | sh:targetNode 9 ;
40 | .
41 |
--------------------------------------------------------------------------------
/test/data/core/node/minLength-001.test.ttl:
--------------------------------------------------------------------------------
1 | # baseURI: http://datashapes.org/sh/tests/core/node/minLength-001.test
2 | # imports: http://datashapes.org/dash
3 | # prefix: ex
4 |
5 | @prefix dash: .
6 | @prefix ex: .
7 | @prefix owl: .
8 | @prefix rdf: .
9 | @prefix rdfs: .
10 | @prefix sh: .
11 | @prefix xsd: .
12 |
13 |
14 | rdf:type owl:Ontology ;
15 | rdfs:label "Test of sh:minLength at node shape 001" ;
16 | owl:imports ;
17 | .
18 | ex:GraphValidationTestCase
19 | rdf:type dash:GraphValidationTestCase ;
20 | dash:expectedResult [
21 | rdf:type sh:ValidationReport ;
22 | sh:conforms "false"^^xsd:boolean ;
23 | sh:result [
24 | rdf:type sh:ValidationResult ;
25 | sh:focusNode ;
26 | sh:resultSeverity sh:Violation ;
27 | sh:sourceConstraintComponent sh:MinLengthConstraintComponent ;
28 | sh:sourceShape ex:TestShape ;
29 | sh:value ;
30 | ] ;
31 | sh:result [
32 | rdf:type sh:ValidationResult ;
33 | sh:focusNode 123 ;
34 | sh:resultSeverity sh:Violation ;
35 | sh:sourceConstraintComponent sh:MinLengthConstraintComponent ;
36 | sh:sourceShape ex:TestShape ;
37 | sh:value 123 ;
38 | ] ;
39 | sh:result [
40 | rdf:type sh:ValidationResult ;
41 | sh:focusNode "Hel" ;
42 | sh:resultSeverity sh:Violation ;
43 | sh:sourceConstraintComponent sh:MinLengthConstraintComponent ;
44 | sh:sourceShape ex:TestShape ;
45 | sh:value "Hel" ;
46 | ] ;
47 | sh:result [
48 | rdf:type sh:ValidationResult ;
49 | sh:focusNode _:b9649 ;
50 | sh:resultSeverity sh:Violation ;
51 | sh:sourceConstraintComponent sh:MinLengthConstraintComponent ;
52 | sh:sourceShape ex:TestShape ;
53 | sh:value _:b9649 ;
54 | ] ;
55 | ] ;
56 | .
57 | ex:TestShape
58 | rdf:type sh:NodeShape ;
59 | sh:minLength 4 ;
60 | sh:targetNode ;
61 | sh:targetNode ex:John ;
62 | sh:targetNode 123 ;
63 | sh:targetNode 1234 ;
64 | sh:targetNode 12345 ;
65 | sh:targetNode "2017-03-29"^^xsd:date ;
66 | sh:targetNode "Hel" ;
67 | sh:targetNode "Hell" ;
68 | sh:targetNode "Hell"@en ;
69 | sh:targetNode "Hello" ;
70 | sh:targetClass ex:TestClass ;
71 | .
72 | _:b9649
73 | rdf:type ex:TestClass ;
74 | .
75 |
--------------------------------------------------------------------------------
/test/data/core/node/node-001.test.ttl:
--------------------------------------------------------------------------------
1 | # baseURI: http://datashapes.org/sh/tests/core/node/node-001.test
2 | # imports: http://datashapes.org/dash
3 | # prefix: ex
4 |
5 | @prefix dash: .
6 | @prefix ex: .
7 | @prefix owl: .
8 | @prefix rdf: .
9 | @prefix rdfs: .
10 | @prefix sh: .
11 | @prefix xsd: .
12 |
13 |
14 | rdf:type owl:Ontology ;
15 | rdfs:label "Test of sh:node at node shape 001" ;
16 | owl:imports ;
17 | .
18 | ex:GraphValidationTestCase
19 | rdf:type dash:GraphValidationTestCase ;
20 | dash:expectedResult [
21 | rdf:type sh:ValidationReport ;
22 | sh:conforms "false"^^xsd:boolean ;
23 | sh:result [
24 | rdf:type sh:ValidationResult ;
25 | sh:focusNode ex:InvalidInstance ;
26 | sh:resultSeverity sh:Violation ;
27 | sh:sourceConstraintComponent sh:NodeConstraintComponent ;
28 | sh:sourceShape ex:TestClass ;
29 | sh:value ex:InvalidInstance ;
30 | ] ;
31 | ] ;
32 | .
33 | ex:InvalidInstance
34 | rdf:type ex:TestClass ;
35 | rdfs:label "Invalid instance" ;
36 | .
37 | ex:TestClass
38 | rdf:type rdfs:Class ;
39 | rdf:type sh:NodeShape ;
40 | rdfs:label "Test class" ;
41 | rdfs:subClassOf rdfs:Resource ;
42 | sh:node [
43 | sh:class ex:OtherClass ;
44 | ] ;
45 | .
46 | ex:ValidInstance
47 | rdf:type ex:OtherClass ;
48 | rdf:type ex:TestClass ;
49 | rdfs:label "Valid instance" ;
50 | .
51 |
--------------------------------------------------------------------------------
/test/data/core/node/nodeKind-001.test.ttl:
--------------------------------------------------------------------------------
1 | # baseURI: http://datashapes.org/sh/tests/core/node/nodeKind-001.test
2 | # imports: http://datashapes.org/dash
3 | # prefix: ex
4 |
5 | @prefix dash: .
6 | @prefix ex: .
7 | @prefix owl: .
8 | @prefix rdf: .
9 | @prefix rdfs: .
10 | @prefix sh: .
11 | @prefix xsd: .
12 |
13 |
14 | rdf:type owl:Ontology ;
15 | rdfs:label "Test of sh:nodeKind at node shape 001" ;
16 | owl:imports ;
17 | owl:versionInfo "Created with TopBraid Composer" ;
18 | .
19 | ex:GraphValidationTestCase
20 | rdf:type dash:GraphValidationTestCase ;
21 | dash:expectedResult [
22 | rdf:type sh:ValidationReport ;
23 | sh:conforms "false"^^xsd:boolean ;
24 | sh:result [
25 | rdf:type sh:ValidationResult ;
26 | sh:focusNode "true"^^xsd:boolean ;
27 | sh:resultSeverity sh:Violation ;
28 | sh:sourceConstraintComponent sh:NodeKindConstraintComponent ;
29 | sh:sourceShape ex:IRITestShape ;
30 | sh:value "true"^^xsd:boolean ;
31 | ] ;
32 | ] ;
33 | .
34 | ex:IRITestShape
35 | rdf:type sh:NodeShape ;
36 | sh:nodeKind sh:IRI ;
37 | sh:targetNode ex:John ;
38 | sh:targetNode "true"^^xsd:boolean ;
39 | .
40 |
--------------------------------------------------------------------------------
/test/data/core/node/not-001.test.ttl:
--------------------------------------------------------------------------------
1 | # baseURI: http://datashapes.org/sh/tests/core/node/not-001
2 | # imports: http://datashapes.org/dash
3 | # prefix: ex
4 |
5 | @prefix dash: .
6 | @prefix ex: .
7 | @prefix owl: .
8 | @prefix rdf: .
9 | @prefix rdfs: .
10 | @prefix sh: .
11 | @prefix xsd: .
12 |
13 |
14 | rdf:type owl:Ontology ;
15 | rdfs:label "Test of sh:not at node shape 001" ;
16 | owl:imports ;
17 | .
18 | ex:GraphValidationTestCase
19 | rdf:type dash:GraphValidationTestCase ;
20 | dash:expectedResult [
21 | rdf:type sh:ValidationReport ;
22 | sh:conforms "false"^^xsd:boolean ;
23 | sh:result [
24 | rdf:type sh:ValidationResult ;
25 | sh:focusNode ex:InvalidResource1 ;
26 | sh:resultSeverity sh:Violation ;
27 | sh:sourceConstraintComponent sh:NotConstraintComponent ;
28 | sh:sourceShape ex:TestShape ;
29 | sh:value ex:InvalidResource1 ;
30 | ] ;
31 | ] ;
32 | .
33 | ex:InvalidResource1
34 | rdf:type rdfs:Resource ;
35 | ex:property "some value" ;
36 | .
37 | ex:TestShape
38 | rdf:type rdfs:Class ;
39 | rdf:type sh:NodeShape ;
40 | rdfs:label "Test shape" ;
41 | rdfs:subClassOf rdfs:Resource ;
42 | sh:not [
43 | rdf:type sh:NodeShape ;
44 | sh:property [
45 | sh:path ex:property ;
46 | sh:minCount 1 ;
47 | ] ;
48 | ] ;
49 | sh:targetNode ex:InvalidResource1 ;
50 | sh:targetNode ex:ValidResource1 ;
51 | .
52 | ex:ValidResource1
53 | rdf:type rdfs:Resource ;
54 | .
55 |
--------------------------------------------------------------------------------
/test/data/core/node/not-002.test.ttl:
--------------------------------------------------------------------------------
1 | # baseURI: http://datashapes.org/sh/tests/core/node/not-002.test
2 | # imports: http://datashapes.org/dash
3 | # prefix: ex
4 |
5 | @prefix dash: .
6 | @prefix ex: .
7 | @prefix owl: .
8 | @prefix rdf: .
9 | @prefix rdfs: .
10 | @prefix sh: