├── .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 [![Build Status](https://travis-ci.org/TopQuadrant/shacl-js.svg?branch=master)](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: . 11 | @prefix xsd: . 12 | 13 | 14 | rdf:type owl:Ontology ; 15 | rdfs:label "Test of sh:not 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:resultSeverity sh:Violation ; 28 | sh:sourceConstraintComponent sh:NotConstraintComponent ; 29 | sh:sourceShape ex:NotExampleShape ; 30 | sh:value ex:InvalidInstance1 ; 31 | ] ; 32 | ] ; 33 | . 34 | ex:InvalidInstance1 35 | ex:property "Some value" ; 36 | . 37 | ex:NotExampleShape 38 | rdf:type sh:NodeShape ; 39 | sh:not [ 40 | rdf:type sh:NodeShape ; 41 | sh:property [ 42 | sh:path ex:property ; 43 | sh:minCount 1 ; 44 | ] ; 45 | ] ; 46 | sh:targetNode ex:InvalidInstance1 ; 47 | sh:targetNode ex:ValidInstance1 ; 48 | . 49 | -------------------------------------------------------------------------------- /test/data/core/node/or-001.test.ttl: -------------------------------------------------------------------------------- 1 | # baseURI: http://datashapes.org/sh/tests/core/node/or-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:or 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:InvalidRectangle1 ; 27 | sh:resultSeverity sh:Violation ; 28 | sh:sourceConstraintComponent sh:OrConstraintComponent ; 29 | sh:sourceShape ex:RectangleWithArea ; 30 | sh:value ex:InvalidRectangle1 ; 31 | ] ; 32 | sh:result [ 33 | rdf:type sh:ValidationResult ; 34 | sh:focusNode ex:InvalidRectangle2 ; 35 | sh:resultSeverity sh:Violation ; 36 | sh:sourceConstraintComponent sh:OrConstraintComponent ; 37 | sh:sourceShape ex:RectangleWithArea ; 38 | sh:value ex:InvalidRectangle2 ; 39 | ] ; 40 | ] ; 41 | . 42 | ex:InvalidRectangle1 43 | rdf:type ex:RectangleWithArea ; 44 | ex:height 3 ; 45 | . 46 | ex:InvalidRectangle2 47 | rdf:type ex:RectangleWithArea ; 48 | . 49 | ex:RectangleWithArea 50 | rdf:type rdfs:Class ; 51 | rdf:type sh:NodeShape ; 52 | rdfs:subClassOf rdfs:Resource ; 53 | sh:or ( 54 | [ 55 | sh:property [ 56 | sh:path ex:height ; 57 | sh:minCount 1 ; 58 | ] ; 59 | sh:property [ 60 | sh:path ex:width ; 61 | sh:minCount 1 ; 62 | ] ; 63 | ] 64 | [ 65 | sh:property [ 66 | sh:path ex:area ; 67 | sh:minCount 1 ; 68 | ] ; 69 | ] 70 | ) ; 71 | . 72 | ex:ValidRectangle1 73 | rdf:type ex:RectangleWithArea ; 74 | ex:height 3 ; 75 | ex:width 2 ; 76 | . 77 | ex:ValidRectangle2 78 | rdf:type ex:RectangleWithArea ; 79 | ex:area 6 ; 80 | ex:height 3 ; 81 | ex:width 2 ; 82 | . 83 | ex:ValidRectangle3 84 | rdf:type ex:RectangleWithArea ; 85 | ex:area 6 ; 86 | ex:height 3 ; 87 | . 88 | -------------------------------------------------------------------------------- /test/data/core/node/pattern-001.test.ttl: -------------------------------------------------------------------------------- 1 | # baseURI: http://datashapes.org/sh/tests/core/node/pattern-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:pattern 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:Test ; 26 | sh:resultSeverity sh:Violation ; 27 | sh:sourceConstraintComponent sh:PatternConstraintComponent ; 28 | sh:sourceShape ex:TestShape ; 29 | sh:value ex:Test ; 30 | ] ; 31 | sh:result [ 32 | rdf:type sh:ValidationResult ; 33 | sh:focusNode 9 ; 34 | sh:resultSeverity sh:Violation ; 35 | sh:sourceConstraintComponent sh:PatternConstraintComponent ; 36 | sh:sourceShape ex:TestShape ; 37 | sh:value 9 ; 38 | ] ; 39 | sh:result [ 40 | rdf:type sh:ValidationResult ; 41 | sh:focusNode "John" ; 42 | sh:resultSeverity sh:Violation ; 43 | sh:sourceConstraintComponent sh:PatternConstraintComponent ; 44 | sh:sourceShape ex:TestShape ; 45 | sh:value "John" ; 46 | ] ; 47 | sh:result [ 48 | rdf:type sh:ValidationResult ; 49 | sh:focusNode _:b9649 ; 50 | sh:resultSeverity sh:Violation ; 51 | sh:sourceConstraintComponent sh:PatternConstraintComponent ; 52 | sh:sourceShape ex:TestShape ; 53 | sh:value _:b9649 ; 54 | ] ; 55 | ] ; 56 | . 57 | ex:TestShape 58 | rdf:type sh:NodeShape ; 59 | sh:pattern "^[2-8][0-9]*$" ; 60 | sh:targetNode ex:Test ; 61 | sh:targetNode 20000123 ; 62 | sh:targetNode "3456" ; 63 | sh:targetNode 39 ; 64 | sh:targetNode "777777"@mi ; 65 | sh:targetNode 9 ; 66 | sh:targetNode "John" ; 67 | sh:targetClass ex:TestClass ; 68 | . 69 | _:b9649 70 | rdf:type ex:TestClass ; 71 | . 72 | -------------------------------------------------------------------------------- /test/data/core/node/pattern-002.test.ttl: -------------------------------------------------------------------------------- 1 | # baseURI: http://datashapes.org/sh/tests/core/node/pattern-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:pattern 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 "Alti" ; 27 | sh:resultSeverity sh:Violation ; 28 | sh:sourceConstraintComponent sh:PatternConstraintComponent ; 29 | sh:sourceShape ex:TestShape ; 30 | sh:value "Alti" ; 31 | ] ; 32 | ] ; 33 | . 34 | ex:TestShape 35 | rdf:type sh:NodeShape ; 36 | sh:flags "i" ; 37 | sh:pattern "Aldi" ; 38 | sh:targetNode "Aldi" ; 39 | sh:targetNode "Alti" ; 40 | sh:targetNode "aLdI" ; 41 | . 42 | -------------------------------------------------------------------------------- /test/data/core/node/xone-001.test.ttl: -------------------------------------------------------------------------------- 1 | # baseURI: http://datashapes.org/sh/tests/core/node/xone-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:xone at node shape 001" ; 16 | owl:imports ; 17 | . 18 | ex:Bob 19 | rdf:type ex:Person ; 20 | ex:firstName "Robert" ; 21 | ex:lastName "Coin" ; 22 | . 23 | ex:Carla 24 | rdf:type ex:Person ; 25 | ex:fullName "Carla Miller" ; 26 | . 27 | ex:Dory 28 | rdf:type ex:Person ; 29 | ex:firstName "Dory" ; 30 | ex:fullName "Dory Dunce" ; 31 | ex:lastName "Dunce" ; 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:Dory ; 41 | sh:resultSeverity sh:Violation ; 42 | sh:sourceConstraintComponent sh:XoneConstraintComponent ; 43 | sh:sourceShape ex:XoneConstraintExampleShape ; 44 | sh:value ex:Dory ; 45 | ] ; 46 | ] ; 47 | . 48 | ex:XoneConstraintExampleShape 49 | rdf:type sh:NodeShape ; 50 | sh:targetClass ex:Person ; 51 | sh:xone ( 52 | [ 53 | sh:property [ 54 | sh:path ex:fullName ; 55 | sh:minCount 1 ; 56 | ] ; 57 | ] 58 | [ 59 | sh:property [ 60 | sh:path ex:firstName ; 61 | sh:minCount 1 ; 62 | ] ; 63 | sh:property [ 64 | sh:path ex:lastName ; 65 | sh:minCount 1 ; 66 | ] ; 67 | ] 68 | ) ; 69 | . 70 | -------------------------------------------------------------------------------- /test/data/core/path/path-alternative-001.test.ttl: -------------------------------------------------------------------------------- 1 | # baseURI: http://datashapes.org/sh/tests/core/path/path-alternative-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 path sh:alternativePath 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:resultPath [ 27 | sh:alternativePath ( 28 | ex:property1 29 | ex:property2 30 | ) ; 31 | ] ; 32 | sh:resultSeverity sh:Violation ; 33 | sh:sourceConstraintComponent sh:MinCountConstraintComponent ; 34 | sh:sourceShape ex:TestShape ; 35 | ] ; 36 | sh:result [ 37 | rdf:type sh:ValidationResult ; 38 | sh:focusNode ex:InvalidResource2 ; 39 | sh:resultPath [ 40 | sh:alternativePath ( 41 | ex:property1 42 | ex:property2 43 | ) ; 44 | ] ; 45 | sh:resultSeverity sh:Violation ; 46 | sh:sourceConstraintComponent sh:MinCountConstraintComponent ; 47 | sh:sourceShape ex:TestShape ; 48 | ] ; 49 | ] ; 50 | . 51 | ex:InvalidResource1 52 | ex:property1 "One" ; 53 | ex:property3 "Three" ; 54 | . 55 | ex:TestShape 56 | rdf:type sh:PropertyShape ; 57 | sh:path [ 58 | sh:alternativePath ( 59 | ex:property1 60 | ex:property2 61 | ) ; 62 | ] ; 63 | sh:minCount 2 ; 64 | sh:targetNode ex:InvalidResource1 ; 65 | sh:targetNode ex:InvalidResource2 ; 66 | sh:targetNode ex:ValidResource1 ; 67 | sh:targetNode ex:ValidResource2 ; 68 | sh:targetNode ex:ValidResource3 ; 69 | . 70 | ex:ValidResource1 71 | ex:property1 "One" ; 72 | ex:property1 "Two" ; 73 | . 74 | ex:ValidResource2 75 | ex:property1 "One" ; 76 | ex:property2 "Two" ; 77 | . 78 | ex:ValidResource3 79 | ex:property2 "One" ; 80 | ex:property2 "Two" ; 81 | . 82 | -------------------------------------------------------------------------------- /test/data/core/path/path-complex-001.test.ttl: -------------------------------------------------------------------------------- 1 | # baseURI: http://datashapes.org/sh/tests/core/path/path-complex-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 path complex (rdf:type/rdfs:subClassOf*) 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:resultPath ( 27 | rdf:type 28 | [ 29 | sh:zeroOrMorePath rdfs:subClassOf ; 30 | ] 31 | ) ; 32 | sh:resultSeverity sh:Violation ; 33 | sh:sourceConstraintComponent sh:HasValueConstraintComponent ; 34 | sh:sourceShape ex:TestShape ; 35 | ] ; 36 | sh:result [ 37 | rdf:type sh:ValidationResult ; 38 | sh:focusNode ex:InvalidResource2 ; 39 | sh:resultPath ( 40 | rdf:type 41 | [ 42 | sh:zeroOrMorePath rdfs:subClassOf ; 43 | ] 44 | ) ; 45 | sh:resultSeverity sh:Violation ; 46 | sh:sourceConstraintComponent sh:HasValueConstraintComponent ; 47 | sh:sourceShape ex:TestShape ; 48 | ] ; 49 | ] ; 50 | . 51 | ex:InvalidResource 52 | rdf:type ex:Animal ; 53 | rdfs:label "Invalid" ; 54 | . 55 | ex:MalePerson 56 | rdf:type rdfs:Class ; 57 | rdfs:subClassOf ex:Person ; 58 | . 59 | ex:Person 60 | rdf:type rdfs:Class ; 61 | . 62 | ex:TestShape 63 | rdf:type sh:PropertyShape ; 64 | sh:path ( 65 | rdf:type 66 | [ 67 | sh:zeroOrMorePath rdfs:subClassOf ; 68 | ] 69 | ) ; 70 | sh:hasValue ex:Person ; 71 | sh:targetNode ex:InvalidResource1 ; 72 | sh:targetNode ex:InvalidResource2 ; 73 | sh:targetNode ex:ValidResource1 ; 74 | sh:targetNode ex:ValidResource2 ; 75 | sh:targetNode ex:ValidResource3 ; 76 | . 77 | ex:ValidResource1 78 | rdf:type ex:Person ; 79 | . 80 | ex:ValidResource2 81 | rdf:type ex:MalePerson ; 82 | . 83 | ex:ValidResource3 84 | rdf:type ex:Animal ; 85 | rdf:type ex:MalePerson ; 86 | . 87 | -------------------------------------------------------------------------------- /test/data/core/path/path-inverse-001.test.ttl: -------------------------------------------------------------------------------- 1 | # baseURI: http://datashapes.org/sh/tests/core/path/path-inverse-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 path sh:inversePath 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:resultPath [ 27 | sh:inversePath ex:child ; 28 | ] ; 29 | sh:resultSeverity sh:Violation ; 30 | sh:sourceConstraintComponent sh:MinCountConstraintComponent ; 31 | sh:sourceShape ex:TestShape-P ; 32 | ] ; 33 | sh:result [ 34 | rdf:type sh:ValidationResult ; 35 | sh:focusNode ex:InvalidResource2 ; 36 | sh:resultPath [ 37 | sh:inversePath ex:child ; 38 | ] ; 39 | sh:resultSeverity sh:Violation ; 40 | sh:sourceConstraintComponent sh:MaxCountConstraintComponent ; 41 | sh:sourceShape ex:TestShape-P ; 42 | ] ; 43 | ] ; 44 | . 45 | ex:InvalidResource1 46 | rdf:type ex:Person ; 47 | . 48 | ex:InvalidResource2 49 | rdf:type ex:Person ; 50 | . 51 | ex:Parent1 52 | ex:child ex:InvalidResource1 ; 53 | ex:child ex:InvalidResource2 ; 54 | ex:child ex:ValidResource1 ; 55 | . 56 | ex:Parent2 57 | ex:child ex:InvalidResource2 ; 58 | ex:child ex:ValidResource1 ; 59 | . 60 | ex:Parent3 61 | ex:child ex:InvalidResource2 ; 62 | . 63 | ex:Person 64 | rdf:type rdfs:Class ; 65 | rdf:type sh:NodeShape ; 66 | rdfs:label "Person" ; 67 | rdfs:subClassOf rdfs:Resource ; 68 | . 69 | ex:TestShape 70 | rdf:type sh:NodeShape ; 71 | rdfs:label "Test shape" ; 72 | sh:property ex:TestShape-P ; 73 | sh:targetClass ex:Person ; 74 | . 75 | ex:TestShape-P 76 | a sh:PropertyShape ; 77 | sh:maxCount 2 ; 78 | sh:minCount 2 ; 79 | sh:path [ 80 | sh:inversePath ex:child ; 81 | ] ; 82 | . 83 | ex:ValidResource1 84 | rdf:type ex:Person ; 85 | . 86 | -------------------------------------------------------------------------------- /test/data/core/path/path-oneOrMore-001.test.ttl: -------------------------------------------------------------------------------- 1 | # baseURI: http://datashapes.org/sh/tests/core/path/path-oneOrMore-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 path sh:oneOrMorePath 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:resultPath [ 27 | sh:oneOrMorePath ex:child ; 28 | ] ; 29 | sh:resultSeverity sh:Violation ; 30 | sh:sourceConstraintComponent sh:MinCountConstraintComponent ; 31 | sh:sourceShape ex:TestShape ; 32 | ] ; 33 | sh:result [ 34 | rdf:type sh:ValidationResult ; 35 | sh:focusNode ex:InvalidResource2 ; 36 | sh:resultPath [ 37 | sh:oneOrMorePath ex:child ; 38 | ] ; 39 | sh:resultSeverity sh:Violation ; 40 | sh:sourceConstraintComponent sh:MinCountConstraintComponent ; 41 | sh:sourceShape ex:TestShape ; 42 | ] ; 43 | ] ; 44 | . 45 | ex:InvalidResource1 46 | rdf:type rdfs:Resource ; 47 | . 48 | ex:InvalidResource2 49 | ex:child ex:Person2 ; 50 | . 51 | ex:Person1 52 | ex:child ex:Person2 ; 53 | . 54 | ex:TestShape 55 | rdf:type sh:PropertyShape ; 56 | sh:path [ 57 | sh:oneOrMorePath ex:child ; 58 | ] ; 59 | sh:minCount 2 ; 60 | sh:targetNode ex:InvalidResource1 ; 61 | sh:targetNode ex:InvalidResource2 ; 62 | sh:targetNode ex:ValidResource1 ; 63 | . 64 | ex:ValidResource1 65 | ex:child ex:Person1 ; 66 | . 67 | -------------------------------------------------------------------------------- /test/data/core/path/path-sequence-001.test.ttl: -------------------------------------------------------------------------------- 1 | # baseURI: http://datashapes.org/sh/tests/core/path/path-sequence-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 path sequence 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:resultPath ( 27 | ex:property1 28 | ex:property2 29 | ) ; 30 | sh:resultSeverity sh:Violation ; 31 | sh:sourceConstraintComponent sh:MinCountConstraintComponent ; 32 | sh:sourceShape ex:TestShape ; 33 | ] ; 34 | sh:result [ 35 | rdf:type sh:ValidationResult ; 36 | sh:focusNode ex:InvalidResource2 ; 37 | sh:resultPath ( 38 | ex:property1 39 | ex:property2 40 | ) ; 41 | sh:resultSeverity sh:Violation ; 42 | sh:sourceConstraintComponent sh:MinCountConstraintComponent ; 43 | sh:sourceShape ex:TestShape ; 44 | ] ; 45 | ] ; 46 | . 47 | ex:InvalidResource1 48 | ex:property1 ex:Node3 ; 49 | ex:property2 ex:Node4 ; 50 | . 51 | ex:Node1 52 | ex:property2 "One" ; 53 | . 54 | ex:Node2 55 | ex:property2 "Two" ; 56 | . 57 | ex:TestShape 58 | rdf:type sh:PropertyShape ; 59 | sh:path ( 60 | ex:property1 61 | ex:property2 62 | ) ; 63 | sh:minCount 1 ; 64 | sh:targetNode ex:InvalidResource1 ; 65 | sh:targetNode ex:InvalidResource2 ; 66 | sh:targetNode ex:ValidResource1 ; 67 | sh:targetNode ex:ValidResource2 ; 68 | . 69 | ex:ValidResource1 70 | ex:property1 ex:Node1 ; 71 | . 72 | ex:ValidResource2 73 | ex:property1 ex:Node1 ; 74 | ex:property1 ex:Node2 ; 75 | . 76 | -------------------------------------------------------------------------------- /test/data/core/path/path-sequence-002.test.ttl: -------------------------------------------------------------------------------- 1 | # baseURI: http://datashapes.org/sh/tests/core/path/path-sequence-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 path sequence 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 ( 27 | ex:property1 28 | ex:property2 29 | ex:property3 30 | ) ; 31 | sh:resultSeverity sh:Violation ; 32 | sh:sourceConstraintComponent sh:MinCountConstraintComponent ; 33 | sh:sourceShape ex:TestShape ; 34 | ] ; 35 | sh:result [ 36 | rdf:type sh:ValidationResult ; 37 | sh:focusNode ex:InvalidResource2 ; 38 | sh:resultPath ( 39 | ex:property1 40 | ex:property2 41 | ex:property3 42 | ) ; 43 | sh:resultSeverity sh:Violation ; 44 | sh:sourceConstraintComponent sh:MinCountConstraintComponent ; 45 | sh:sourceShape ex:TestShape ; 46 | ] ; 47 | ] ; 48 | . 49 | ex:InvalidResource1 50 | ex:property1 ex:Node3 ; 51 | ex:property2 ex:Node4 ; 52 | . 53 | ex:Node1 54 | ex:property2 ex:Node2 ; 55 | . 56 | ex:Node2 57 | ex:property3 "Value" ; 58 | . 59 | ex:TestShape 60 | rdf:type sh:PropertyShape ; 61 | sh:path ( 62 | ex:property1 63 | ex:property2 64 | ex:property3 65 | ) ; 66 | sh:minCount 1 ; 67 | sh:targetNode ex:InvalidResource1 ; 68 | sh:targetNode ex:InvalidResource2 ; 69 | sh:targetNode ex:ValidResource1 ; 70 | sh:targetNode ex:ValidResource2 ; 71 | . 72 | ex:ValidResource1 73 | ex:property1 ex:Node1 ; 74 | . 75 | ex:ValidResource2 76 | ex:property1 ex:Node1 ; 77 | ex:property1 ex:Node2 ; 78 | . 79 | -------------------------------------------------------------------------------- /test/data/core/path/path-sequence-duplicate-001.test.ttl: -------------------------------------------------------------------------------- 1 | # baseURI: http://datashapes.org/sh/tests/core/path/path-sequence-duplicate-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 path sequence with duplicate 001" ; 16 | owl:imports ; 17 | . 18 | ex:A 19 | ex:p1 [ 20 | ex:p2 "value" ; 21 | ] ; 22 | ex:p1 [ 23 | ex:p2 "value" ; 24 | ] ; 25 | . 26 | ex:GraphValidationTestCase 27 | rdf:type dash:GraphValidationTestCase ; 28 | dash:expectedResult [ 29 | rdf:type sh:ValidationReport ; 30 | sh:conforms "false"^^xsd:boolean ; 31 | sh:result [ 32 | rdf:type sh:ValidationResult ; 33 | sh:focusNode ex:A ; 34 | sh:resultPath ( 35 | ex:p1 36 | ex:p2 37 | ) ; 38 | sh:resultSeverity sh:Violation ; 39 | sh:sourceConstraintComponent sh:NodeKindConstraintComponent ; 40 | sh:sourceShape ex:SP ; 41 | sh:value "value" ; 42 | ] ; 43 | ] ; 44 | . 45 | ex:S 46 | rdf:type sh:NodeShape ; 47 | sh:property ex:SP ; 48 | sh:targetNode ex:A ; 49 | . 50 | ex:SP 51 | a sh:PropertyShape ; 52 | sh:maxCount 1 ; 53 | sh:nodeKind sh:IRI ; 54 | sh:path ( 55 | ex:p1 56 | ex:p2 57 | ) ; 58 | . 59 | -------------------------------------------------------------------------------- /test/data/core/path/path-zeroOrMore-001.test.ttl: -------------------------------------------------------------------------------- 1 | # baseURI: http://datashapes.org/sh/tests/core/path/path-zeroOrMore-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 path sh:zeroOrMorePath 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:resultPath [ 27 | sh:zeroOrMorePath ex:child ; 28 | ] ; 29 | sh:resultSeverity sh:Violation ; 30 | sh:sourceConstraintComponent sh:MinCountConstraintComponent ; 31 | sh:sourceShape ex:TestShape ; 32 | ] ; 33 | ] ; 34 | . 35 | ex:InvalidResource1 36 | rdf:type rdfs:Resource ; 37 | . 38 | ex:Person2 39 | ex:child ex:Person3 ; 40 | . 41 | ex:TestShape 42 | rdf:type sh:PropertyShape ; 43 | sh:path [ 44 | sh:zeroOrMorePath ex:child ; 45 | ] ; 46 | sh:minCount 2 ; 47 | sh:targetNode ex:InvalidResource1 ; 48 | sh:targetNode ex:ValidResource1 ; 49 | sh:targetNode ex:ValidResource2 ; 50 | . 51 | ex:ValidResource1 52 | ex:child ex:Person1 ; 53 | . 54 | ex:ValidResource2 55 | ex:child ex:Person2 ; 56 | . 57 | -------------------------------------------------------------------------------- /test/data/core/path/path-zeroOrOne-001.test.ttl: -------------------------------------------------------------------------------- 1 | # baseURI: http://datashapes.org/sh/tests/core/path/path-zeroOrOne-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 path sh:zeroOrOnePath 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:resultPath [ 27 | sh:zeroOrOnePath ex:child ; 28 | ] ; 29 | sh:resultSeverity sh:Violation ; 30 | sh:sourceConstraintComponent sh:MinCountConstraintComponent ; 31 | sh:sourceShape ex:TestShape ; 32 | ] ; 33 | ] ; 34 | . 35 | ex:InvalidResource1 36 | rdf:type rdfs:Resource ; 37 | . 38 | ex:Person2 39 | ex:child ex:Person3 ; 40 | . 41 | ex:TestShape 42 | rdf:type sh:PropertyShape ; 43 | sh:path [ 44 | sh:zeroOrOnePath ex:child ; 45 | ] ; 46 | sh:minCount 2 ; 47 | sh:targetNode ex:InvalidResource1 ; 48 | sh:targetNode ex:ValidResource1 ; 49 | sh:targetNode ex:ValidResource2 ; 50 | . 51 | ex:ValidResource1 52 | ex:child ex:Person1 ; 53 | . 54 | ex:ValidResource2 55 | ex:child ex:Person2 ; 56 | . 57 | -------------------------------------------------------------------------------- /test/data/core/property/and-001.test.ttl: -------------------------------------------------------------------------------- 1 | # baseURI: http://datashapes.org/sh/tests/core/property/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 property shape 001" ; 16 | owl:imports ; 17 | . 18 | ex:AddressShape 19 | rdf:type sh:NodeShape ; 20 | rdfs:label "Address shape" ; 21 | sh:property ex:AddressShape-address ; 22 | sh:targetNode ex:InvalidResource1 ; 23 | sh:targetNode ex:InvalidResource2 ; 24 | sh:targetNode ex:InvalidResource3 ; 25 | sh:targetNode ex:ValidResource1 ; 26 | . 27 | ex:AddressShape-address 28 | sh:path ex:address ; 29 | sh:and ( 30 | [ 31 | sh:property [ 32 | sh:path ex:suburb ; 33 | sh:minCount 1 ; 34 | ] ; 35 | ] 36 | [ 37 | sh:property [ 38 | sh:path ex:postalCode ; 39 | sh:minCount 1 ; 40 | ] ; 41 | ] 42 | ) ; 43 | . 44 | ex:GraphValidationTestCase 45 | rdf:type dash:GraphValidationTestCase ; 46 | dash:expectedResult [ 47 | rdf:type sh:ValidationReport ; 48 | sh:conforms "false"^^xsd:boolean ; 49 | sh:result [ 50 | rdf:type sh:ValidationResult ; 51 | sh:focusNode ex:InvalidResource1 ; 52 | sh:resultPath ex:address ; 53 | sh:resultSeverity sh:Violation ; 54 | sh:sourceConstraintComponent sh:AndConstraintComponent ; 55 | sh:sourceShape ex:AddressShape-address ; 56 | sh:value _:b61065 ; 57 | ] ; 58 | sh:result [ 59 | rdf:type sh:ValidationResult ; 60 | sh:focusNode ex:InvalidResource2 ; 61 | sh:resultPath ex:address ; 62 | sh:resultSeverity sh:Violation ; 63 | sh:sourceConstraintComponent sh:AndConstraintComponent ; 64 | sh:sourceShape ex:AddressShape-address ; 65 | sh:value _:b31477 ; 66 | ] ; 67 | sh:result [ 68 | rdf:type sh:ValidationResult ; 69 | sh:focusNode ex:InvalidResource3 ; 70 | sh:resultPath ex:address ; 71 | sh:resultSeverity sh:Violation ; 72 | sh:sourceConstraintComponent sh:AndConstraintComponent ; 73 | sh:sourceShape ex:AddressShape-address ; 74 | sh:value _:b94057 ; 75 | ] ; 76 | ] ; 77 | . 78 | ex:InvalidResource1 79 | rdf:type rdfs:Resource ; 80 | ex:address _:b61065 ; 81 | . 82 | ex:InvalidResource2 83 | rdf:type rdfs:Resource ; 84 | ex:address _:b31477 ; 85 | . 86 | ex:InvalidResource3 87 | rdf:type rdfs:Resource ; 88 | ex:address _:b94057 ; 89 | . 90 | ex:ValidResource1 91 | rdf:type rdfs:Resource ; 92 | ex:address [ 93 | ex:postalCode 4879 ; 94 | ex:suburb ex:KewarraBeach ; 95 | ] ; 96 | . 97 | _:b31477 98 | ex:suburb ex:KewarraBeach ; 99 | . 100 | _:b61065 101 | ex:postalCode 4879 ; 102 | . 103 | -------------------------------------------------------------------------------- /test/data/core/property/class-001.test.ttl: -------------------------------------------------------------------------------- 1 | # baseURI: http://datashapes.org/sh/tests/core/property/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 property 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:resultPath ex:testProperty ; 27 | sh:resultSeverity sh:Violation ; 28 | sh:sourceConstraintComponent sh:ClassConstraintComponent ; 29 | sh:sourceShape ex:TestShape-testProperty ; 30 | sh:value ex:InvalidResource1 ; 31 | ] ; 32 | sh:result [ 33 | rdf:type sh:ValidationResult ; 34 | sh:focusNode ex:InvalidResource1 ; 35 | sh:resultPath ex:testProperty ; 36 | sh:resultSeverity sh:Violation ; 37 | sh:sourceConstraintComponent sh:ClassConstraintComponent ; 38 | sh:sourceShape ex:TestShape-testProperty ; 39 | sh:value "A string" ; 40 | ] ; 41 | ] ; 42 | . 43 | ex:InvalidResource1 44 | rdf:type rdfs:Resource ; 45 | ex:testProperty ex:InvalidResource1 ; 46 | ex:testProperty "A string" ; 47 | . 48 | ex:SubClass 49 | rdf:type rdfs:Class ; 50 | rdfs:subClassOf ex:SuperClass ; 51 | . 52 | ex:SubClassInstance 53 | rdf:type ex:SubClass ; 54 | . 55 | ex:SuperClass 56 | rdf:type rdfs:Class ; 57 | . 58 | ex:SuperClassInstance 59 | rdf:type ex:SuperClass ; 60 | . 61 | ex:TestShape 62 | rdf:type sh:NodeShape ; 63 | sh:property ex:TestShape-testProperty ; 64 | sh:targetNode ex:InvalidResource1 ; 65 | sh:targetNode ex:ValidResource1 ; 66 | sh:targetNode ex:ValidResource2 ; 67 | . 68 | ex:TestShape-testProperty 69 | sh:path ex:testProperty ; 70 | rdfs:label "test property" ; 71 | sh:class ex:SuperClass ; 72 | . 73 | ex:ValidResource1 74 | rdf:type rdfs:Resource ; 75 | ex:testProperty ex:SubClassInstance ; 76 | ex:testProperty ex:SuperClassInstance ; 77 | . 78 | ex:ValidResource2 79 | rdf:type rdfs:Resource ; 80 | ex:testProperty [ 81 | rdf:type ex:SubClass ; 82 | ] ; 83 | ex:testProperty [ 84 | rdf:type ex:SuperClass ; 85 | ] ; 86 | . 87 | -------------------------------------------------------------------------------- /test/data/core/property/datatype-001.test.ttl: -------------------------------------------------------------------------------- 1 | # baseURI: http://datashapes.org/sh/tests/core/property/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 property 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:resultPath ex:dateProperty ; 28 | sh:resultSeverity sh:Violation ; 29 | sh:sourceConstraintComponent sh:DatatypeConstraintComponent ; 30 | sh:sourceShape ex:TestShape-dateProperty ; 31 | sh:value "2011-01-01"^^xsd:dateTime ; 32 | ] ; 33 | sh:result [ 34 | rdf:type sh:ValidationResult ; 35 | sh:focusNode ex:InvalidResource1 ; 36 | sh:resultPath ex:integerProperty ; 37 | sh:resultSeverity sh:Violation ; 38 | sh:sourceConstraintComponent sh:DatatypeConstraintComponent ; 39 | sh:sourceShape ex:TestShape-integerProperty ; 40 | sh:value 11.1 ; 41 | ] ; 42 | ] ; 43 | . 44 | ex:InvalidResource1 45 | rdf:type ex:TestShape ; 46 | ex:dateProperty "2011-01-01"^^xsd:dateTime ; 47 | ex:integerProperty 11.1 ; 48 | . 49 | ex:TestShape 50 | rdf:type rdfs:Class ; 51 | rdf:type sh:NodeShape ; 52 | rdfs:label "Test shape" ; 53 | sh:property ex:TestShape-dateProperty ; 54 | sh:property ex:TestShape-integerProperty ; 55 | . 56 | ex:TestShape-dateProperty 57 | sh:path ex:dateProperty ; 58 | rdfs:label "date property" ; 59 | sh:datatype xsd:date ; 60 | . 61 | ex:TestShape-integerProperty 62 | sh:path ex:integerProperty ; 63 | rdfs:label "integer property" ; 64 | sh:datatype xsd:integer ; 65 | . 66 | ex:ValidResource 67 | rdf:type ex:TestShape ; 68 | ex:dateProperty "2014-09-01"^^xsd:date ; 69 | ex:integerProperty 0 ; 70 | ex:integerProperty 1234 ; 71 | rdfs:label "Valid resource" ; 72 | . 73 | -------------------------------------------------------------------------------- /test/data/core/property/datatype-002.test.ttl: -------------------------------------------------------------------------------- 1 | # baseURI: http://datashapes.org/sh/tests/core/property/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 property 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:value ; 28 | sh:resultSeverity sh:Violation ; 29 | sh:sourceConstraintComponent sh:DatatypeConstraintComponent ; 30 | sh:sourceShape ex:TestShape-value ; 31 | sh:value "A"@en ; 32 | ] ; 33 | sh:result [ 34 | rdf:type sh:ValidationResult ; 35 | sh:focusNode ex:InvalidInstance2 ; 36 | sh:resultPath ex:value ; 37 | sh:resultSeverity sh:Violation ; 38 | sh:sourceConstraintComponent sh:DatatypeConstraintComponent ; 39 | sh:sourceShape ex:TestShape-value ; 40 | sh:value 42 ; 41 | ] ; 42 | ] ; 43 | . 44 | ex:InvalidInstance1 45 | ex:value "A"@en ; 46 | . 47 | ex:InvalidInstance2 48 | ex:value 42 ; 49 | . 50 | ex:TestShape 51 | rdf:type sh:NodeShape ; 52 | sh:property ex:TestShape-value ; 53 | sh:targetNode ex:InvalidInstance1 ; 54 | sh:targetNode ex:InvalidInstance2 ; 55 | sh:targetNode ex:ValidInstance1 ; 56 | sh:targetNode ex:ValidInstance2 ; 57 | . 58 | ex:TestShape-value 59 | sh:path ex:value ; 60 | sh:datatype xsd:string ; 61 | . 62 | ex:ValidInstance1 63 | ex:value "A" ; 64 | . 65 | ex:ValidInstance2 66 | ex:value "A" ; 67 | . 68 | -------------------------------------------------------------------------------- /test/data/core/property/datatype-003.test.ttl: -------------------------------------------------------------------------------- 1 | # baseURI: http://datashapes.org/sh/tests/core/property/datatype-003.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 property shape 003" ; 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:value ; 28 | sh:resultSeverity sh:Violation ; 29 | sh:sourceConstraintComponent sh:OrConstraintComponent ; 30 | sh:sourceShape ex:TestShape-value ; 31 | sh:value 42 ; 32 | ] ; 33 | ] ; 34 | . 35 | ex:InvalidInstance1 36 | ex:value 42 ; 37 | . 38 | ex:TestShape 39 | rdf:type sh:NodeShape ; 40 | sh:property ex:TestShape-value ; 41 | sh:targetNode ex:InvalidInstance1 ; 42 | sh:targetNode ex:ValidInstance1 ; 43 | sh:targetNode ex:ValidInstance2 ; 44 | sh:targetNode ex:ValidInstance3 ; 45 | . 46 | ex:TestShape-value 47 | sh:path ex:value ; 48 | sh:or ( 49 | [ 50 | sh:datatype xsd:string ; 51 | ] 52 | [ 53 | sh:datatype rdf:langString ; 54 | ] 55 | ) ; 56 | . 57 | ex:ValidInstance1 58 | ex:value "A" ; 59 | . 60 | ex:ValidInstance2 61 | ex:value "A" ; 62 | . 63 | ex:ValidInstance3 64 | ex:value "A"@en ; 65 | . 66 | -------------------------------------------------------------------------------- /test/data/core/property/disjoint-001.test.ttl: -------------------------------------------------------------------------------- 1 | # baseURI: http://datashapes.org/sh/tests/core/property/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 property 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:resultPath ex:property1 ; 28 | sh:resultSeverity sh:Violation ; 29 | sh:sourceConstraintComponent sh:DisjointConstraintComponent ; 30 | sh:sourceShape ex:TestShape-property1 ; 31 | sh:value "A" ; 32 | ] ; 33 | sh:result [ 34 | rdf:type sh:ValidationResult ; 35 | sh:focusNode ex:InvalidResource2 ; 36 | sh:resultPath ex:property1 ; 37 | sh:resultSeverity sh:Violation ; 38 | sh:sourceConstraintComponent sh:DisjointConstraintComponent ; 39 | sh:sourceShape ex:TestShape-property1 ; 40 | sh:value "A" ; 41 | ] ; 42 | ] ; 43 | . 44 | ex:InvalidResource1 45 | ex:property1 "A" ; 46 | ex:property2 "A" ; 47 | . 48 | ex:InvalidResource2 49 | ex:property1 "A" ; 50 | ex:property1 "B" ; 51 | ex:property2 "A" ; 52 | . 53 | ex:TestShape 54 | rdf:type sh:NodeShape ; 55 | sh:property ex:TestShape-property1 ; 56 | sh:targetNode ex:InvalidResource1 ; 57 | sh:targetNode ex:InvalidResource2 ; 58 | sh:targetNode ex:ValidResource1 ; 59 | sh:targetNode ex:ValidResource2 ; 60 | . 61 | ex:TestShape-property1 62 | sh:path ex:property1 ; 63 | sh:disjoint ex:property2 ; 64 | . 65 | ex:ValidResource1 66 | ex:property1 "A" ; 67 | ex:property2 "B" ; 68 | . 69 | ex:ValidResource2 70 | ex:property1 "A" ; 71 | ex:property1 "B" ; 72 | ex:property2 "C" ; 73 | ex:property2 "D" ; 74 | . 75 | ex:property1 76 | rdf:type rdf:Property ; 77 | . 78 | ex:property2 79 | rdf:type rdf:Property ; 80 | . 81 | -------------------------------------------------------------------------------- /test/data/core/property/equals-001.test.ttl: -------------------------------------------------------------------------------- 1 | # baseURI: http://datashapes.org/sh/tests/core/property/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 property 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:resultPath ex:property1 ; 27 | sh:resultSeverity sh:Violation ; 28 | sh:sourceConstraintComponent sh:EqualsConstraintComponent ; 29 | sh:sourceShape ex:TestShape-property1 ; 30 | sh:value "A" ; 31 | ] ; 32 | sh:result [ 33 | rdf:type sh:ValidationResult ; 34 | sh:focusNode ex:InvalidResource1 ; 35 | sh:resultPath ex:property1 ; 36 | sh:resultSeverity sh:Violation ; 37 | sh:sourceConstraintComponent sh:EqualsConstraintComponent ; 38 | sh:sourceShape ex:TestShape-property1 ; 39 | sh:value "B" ; 40 | ] ; 41 | sh:result [ 42 | rdf:type sh:ValidationResult ; 43 | sh:focusNode ex:InvalidResource2 ; 44 | sh:resultPath ex:property1 ; 45 | sh:resultSeverity sh:Violation ; 46 | sh:sourceConstraintComponent sh:EqualsConstraintComponent ; 47 | sh:sourceShape ex:TestShape-property1 ; 48 | sh:value "A" ; 49 | ] ; 50 | sh:result [ 51 | rdf:type sh:ValidationResult ; 52 | sh:focusNode ex:InvalidResource3 ; 53 | sh:resultPath ex:property1 ; 54 | sh:resultSeverity sh:Violation ; 55 | sh:sourceConstraintComponent sh:EqualsConstraintComponent ; 56 | sh:sourceShape ex:TestShape-property1 ; 57 | sh:value "A" ; 58 | ] ; 59 | sh:result [ 60 | rdf:type sh:ValidationResult ; 61 | sh:focusNode ex:InvalidResource4 ; 62 | sh:resultPath ex:property1 ; 63 | sh:resultSeverity sh:Violation ; 64 | sh:sourceConstraintComponent sh:EqualsConstraintComponent ; 65 | sh:sourceShape ex:TestShape-property1 ; 66 | sh:value "B" ; 67 | ] ; 68 | ] ; 69 | . 70 | ex:InvalidResource1 71 | ex:property1 "A" ; 72 | ex:property2 "B" ; 73 | . 74 | ex:InvalidResource2 75 | ex:property1 "A" ; 76 | . 77 | ex:InvalidResource3 78 | ex:property2 "A" ; 79 | . 80 | ex:InvalidResource4 81 | ex:property1 "A" ; 82 | ex:property1 "B" ; 83 | ex:property2 "A" ; 84 | . 85 | ex:TestShape 86 | rdf:type sh:NodeShape ; 87 | sh:property ex:TestShape-property1 ; 88 | sh:targetNode ex:InvalidResource1 ; 89 | sh:targetNode ex:InvalidResource2 ; 90 | sh:targetNode ex:InvalidResource3 ; 91 | sh:targetNode ex:InvalidResource4 ; 92 | sh:targetNode ex:ValidResource1 ; 93 | sh:targetNode ex:ValidResource2 ; 94 | . 95 | ex:TestShape-property1 96 | sh:path ex:property1 ; 97 | sh:equals ex:property2 ; 98 | . 99 | ex:ValidResource1 100 | ex:property1 "A" ; 101 | ex:property2 "A" ; 102 | . 103 | ex:ValidResource2 104 | ex:property1 "A" ; 105 | ex:property1 "B" ; 106 | ex:property2 "A" ; 107 | ex:property2 "B" ; 108 | . 109 | ex:property1 110 | rdf:type rdf:Property ; 111 | . 112 | ex:property2 113 | rdf:type rdf:Property ; 114 | . 115 | -------------------------------------------------------------------------------- /test/data/core/property/hasValue-001.test.ttl: -------------------------------------------------------------------------------- 1 | # baseURI: http://datashapes.org/sh/tests/core/property/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 property 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:InvalidMalePerson ; 26 | sh:resultPath ex:gender ; 27 | sh:resultSeverity sh:Violation ; 28 | sh:sourceConstraintComponent sh:HasValueConstraintComponent ; 29 | sh:sourceShape ex:PersonShape-gender ; 30 | ] ; 31 | ] ; 32 | . 33 | ex:InvalidMalePerson 34 | rdf:type ex:MalePerson ; 35 | ex:gender "female" ; 36 | rdfs:label "Invalid male person" ; 37 | . 38 | ex:MalePerson 39 | rdf:type rdfs:Class ; 40 | rdfs:label "Male person" ; 41 | rdfs:subClassOf rdfs:Resource ; 42 | . 43 | ex:PersonShape 44 | rdf:type sh:NodeShape ; 45 | rdfs:label "Person shape" ; 46 | sh:property ex:PersonShape-gender ; 47 | sh:targetClass ex:MalePerson ; 48 | . 49 | ex:PersonShape-gender 50 | sh:path ex:gender ; 51 | rdfs:label "gender" ; 52 | sh:datatype xsd:string ; 53 | sh:hasValue "male" ; 54 | . 55 | ex:ValidMalePerson1 56 | rdf:type ex:MalePerson ; 57 | ex:gender "male" ; 58 | . 59 | ex:ValidMalePerson2 60 | rdf:type ex:MalePerson ; 61 | ex:gender "female" ; 62 | ex:gender "male" ; 63 | . 64 | -------------------------------------------------------------------------------- /test/data/core/property/in-001.test.ttl: -------------------------------------------------------------------------------- 1 | # baseURI: http://datashapes.org/sh/tests/core/property/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 property 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:InvalidInstance1 ; 26 | sh:resultPath ex:property ; 27 | sh:resultSeverity sh:Violation ; 28 | sh:sourceConstraintComponent sh:InConstraintComponent ; 29 | sh:sourceShape ex:ShapeClass-property ; 30 | sh:value "D" ; 31 | ] ; 32 | ] ; 33 | . 34 | ex:InvalidInstance1 35 | rdf:type ex:ShapeClass ; 36 | ex:property "D" ; 37 | rdfs:label "Invalid instance1" ; 38 | . 39 | ex:ShapeClass 40 | rdf:type rdfs:Class ; 41 | rdf:type sh:NodeShape ; 42 | sh:property ex:ShapeClass-property ; 43 | . 44 | ex:ShapeClass-property 45 | sh:path ex:property ; 46 | sh:datatype xsd:string ; 47 | sh:in ( 48 | "A" 49 | "B" 50 | "C" 51 | ) ; 52 | . 53 | ex:ValidInstance1 54 | rdf:type ex:ShapeClass ; 55 | ex:property "A" ; 56 | rdfs:label "Valid instance1" ; 57 | . 58 | ex:ValidInstance2 59 | rdf:type ex:ShapeClass ; 60 | ex:property "A" ; 61 | ex:property "B" ; 62 | ex:property "C" ; 63 | rdfs:label "Valid instance2" ; 64 | . 65 | -------------------------------------------------------------------------------- /test/data/core/property/languageIn-001.test.ttl: -------------------------------------------------------------------------------- 1 | # baseURI: http://datashapes.org/sh/tests/core/property/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 property shape 001" ; 16 | owl:imports ; 17 | . 18 | ex:Berg 19 | ex:prefLabel ex:BergLabel ; 20 | ex:prefLabel "Berg" ; 21 | ex:prefLabel "Berg"@de ; 22 | . 23 | ex:GraphValidationTestCase 24 | rdf:type dash:GraphValidationTestCase ; 25 | dash:expectedResult [ 26 | rdf:type sh:ValidationReport ; 27 | sh:conforms "false"^^xsd:boolean ; 28 | sh:result [ 29 | rdf:type sh:ValidationResult ; 30 | sh:focusNode ex:Berg ; 31 | sh:resultPath ex:prefLabel ; 32 | sh:resultSeverity sh:Violation ; 33 | sh:sourceConstraintComponent sh:LanguageInConstraintComponent ; 34 | sh:sourceShape ex:NewZealandLanguagesShape-prefLabel ; 35 | sh:value ex:BergLabel ; 36 | ] ; 37 | sh:result [ 38 | rdf:type sh:ValidationResult ; 39 | sh:focusNode ex:Berg ; 40 | sh:resultPath ex:prefLabel ; 41 | sh:resultSeverity sh:Violation ; 42 | sh:sourceConstraintComponent sh:LanguageInConstraintComponent ; 43 | sh:sourceShape ex:NewZealandLanguagesShape-prefLabel ; 44 | sh:value "Berg" ; 45 | ] ; 46 | sh:result [ 47 | rdf:type sh:ValidationResult ; 48 | sh:focusNode ex:Berg ; 49 | sh:resultPath ex:prefLabel ; 50 | sh:resultSeverity sh:Violation ; 51 | sh:sourceConstraintComponent sh:LanguageInConstraintComponent ; 52 | sh:sourceShape ex:NewZealandLanguagesShape-prefLabel ; 53 | sh:value "Berg"@de ; 54 | ] ; 55 | ] ; 56 | . 57 | ex:Mountain 58 | ex:prefLabel "Hill"@en-NZ ; 59 | ex:prefLabel "Maunga"@mi ; 60 | ex:prefLabel "Mountain"@en ; 61 | . 62 | ex:NewZealandLanguagesShape 63 | rdf:type sh:NodeShape ; 64 | sh:property ex:NewZealandLanguagesShape-prefLabel ; 65 | sh:targetNode ex:Berg ; 66 | sh:targetNode ex:Mountain ; 67 | . 68 | ex:NewZealandLanguagesShape-prefLabel 69 | sh:path ex:prefLabel ; 70 | sh:languageIn ( 71 | "en" 72 | "mi" 73 | ) ; 74 | . 75 | -------------------------------------------------------------------------------- /test/data/core/property/lessThan-001.test.ttl: -------------------------------------------------------------------------------- 1 | # baseURI: http://datashapes.org/sh/tests/core/property/lessThan-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:lessThan at property 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:resultPath ex:property1 ; 27 | sh:resultSeverity sh:Violation ; 28 | sh:sourceConstraintComponent sh:LessThanConstraintComponent ; 29 | sh:sourceShape ex:TestShape-property1 ; 30 | sh:value 4 ; 31 | ] ; 32 | sh:result [ 33 | rdf:type sh:ValidationResult ; 34 | sh:focusNode ex:InvalidResource2 ; 35 | sh:resultPath ex:property1 ; 36 | sh:resultSeverity sh:Violation ; 37 | sh:sourceConstraintComponent sh:LessThanConstraintComponent ; 38 | sh:sourceShape ex:TestShape-property1 ; 39 | sh:value 6 ; 40 | ] ; 41 | sh:result [ 42 | rdf:type sh:ValidationResult ; 43 | sh:focusNode ex:InvalidResource3 ; 44 | sh:resultPath ex:property1 ; 45 | sh:resultSeverity sh:Violation ; 46 | sh:sourceConstraintComponent sh:LessThanConstraintComponent ; 47 | sh:sourceShape ex:TestShape-property1 ; 48 | sh:value 5 ; 49 | ] ; 50 | ] ; 51 | . 52 | ex:InvalidResource1 53 | ex:property1 4 ; 54 | ex:property2 4 ; 55 | . 56 | ex:InvalidResource2 57 | ex:property1 4 ; 58 | ex:property1 6 ; 59 | ex:property2 5 ; 60 | . 61 | ex:InvalidResource3 62 | ex:property1 5 ; 63 | ex:property2 4 ; 64 | . 65 | ex:TestShape 66 | rdf:type sh:NodeShape ; 67 | sh:property ex:TestShape-property1 ; 68 | sh:targetNode ex:InvalidResource1 ; 69 | sh:targetNode ex:InvalidResource2 ; 70 | sh:targetNode ex:InvalidResource3 ; 71 | sh:targetNode ex:ValidResource1 ; 72 | sh:targetNode ex:ValidResource2 ; 73 | . 74 | ex:TestShape-property1 75 | sh:path ex:property1 ; 76 | sh:lessThan ex:property2 ; 77 | . 78 | ex:ValidResource1 79 | ex:property1 4 ; 80 | ex:property2 6 ; 81 | . 82 | ex:ValidResource2 83 | ex:property1 3.1 ; 84 | ex:property1 3.2 ; 85 | . 86 | ex:property1 87 | rdf:type rdf:Property ; 88 | . 89 | ex:property2 90 | rdf:type rdf:Property ; 91 | . 92 | -------------------------------------------------------------------------------- /test/data/core/property/lessThan-002.test.ttl: -------------------------------------------------------------------------------- 1 | # baseURI: http://datashapes.org/sh/tests/core/property/lessThan-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:lessThan at property 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:first ; 28 | sh:resultSeverity sh:Violation ; 29 | sh:sourceConstraintComponent sh:LessThanConstraintComponent ; 30 | sh:sourceShape ex:TestShape-first ; 31 | sh:value 1 ; 32 | ] ; 33 | sh:result [ 34 | rdf:type sh:ValidationResult ; 35 | sh:focusNode ex:InvalidInstance1 ; 36 | sh:resultPath ex:first ; 37 | sh:resultSeverity sh:Violation ; 38 | sh:sourceConstraintComponent sh:LessThanConstraintComponent ; 39 | sh:sourceShape ex:TestShape-first ; 40 | sh:value 1 ; 41 | ] ; 42 | sh:result [ 43 | rdf:type sh:ValidationResult ; 44 | sh:focusNode ex:InvalidInstance1 ; 45 | sh:resultPath ex:first ; 46 | sh:resultSeverity sh:Violation ; 47 | sh:sourceConstraintComponent sh:LessThanConstraintComponent ; 48 | sh:sourceShape ex:TestShape-first ; 49 | sh:value 2 ; 50 | ] ; 51 | sh:result [ 52 | rdf:type sh:ValidationResult ; 53 | sh:focusNode ex:InvalidInstance1 ; 54 | sh:resultPath ex:first ; 55 | sh:resultSeverity sh:Violation ; 56 | sh:sourceConstraintComponent sh:LessThanConstraintComponent ; 57 | sh:sourceShape ex:TestShape-first ; 58 | sh:value 2 ; 59 | ] ; 60 | ] ; 61 | . 62 | ex:InvalidInstance1 63 | ex:first 1 ; 64 | ex:first 2 ; 65 | ex:second "a" ; 66 | ex:second "b" ; 67 | . 68 | ex:TestShape 69 | rdf:type sh:NodeShape ; 70 | rdfs:label "Test shape" ; 71 | sh:property ex:TestShape-first ; 72 | sh:targetNode ex:InvalidInstance1 ; 73 | . 74 | ex:TestShape-first 75 | sh:path ex:first ; 76 | sh:lessThan ex:second ; 77 | . -------------------------------------------------------------------------------- /test/data/core/property/lessThanOrEquals-001.test.ttl: -------------------------------------------------------------------------------- 1 | # baseURI: http://datashapes.org/sh/tests/core/property/lessThanOrEquals-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:lessThanOrEquals at property 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:resultPath ex:property1 ; 27 | sh:resultSeverity sh:Violation ; 28 | sh:sourceConstraintComponent sh:LessThanOrEqualsConstraintComponent ; 29 | sh:sourceShape ex:TestShape-property1 ; 30 | sh:value 5 ; 31 | ] ; 32 | sh:result [ 33 | rdf:type sh:ValidationResult ; 34 | sh:focusNode ex:InvalidResource2 ; 35 | sh:resultPath ex:property1 ; 36 | sh:resultSeverity sh:Violation ; 37 | sh:sourceConstraintComponent sh:LessThanOrEqualsConstraintComponent ; 38 | sh:sourceShape ex:TestShape-property1 ; 39 | sh:value 6 ; 40 | ] ; 41 | ] ; 42 | . 43 | ex:InvalidResource1 44 | ex:property1 5 ; 45 | ex:property2 4 ; 46 | . 47 | ex:InvalidResource2 48 | ex:property1 4 ; 49 | ex:property1 6 ; 50 | ex:property2 5 ; 51 | . 52 | ex:TestShape 53 | rdf:type sh:NodeShape ; 54 | sh:property ex:TestShape-property1 ; 55 | sh:targetNode ex:InvalidResource1 ; 56 | sh:targetNode ex:InvalidResource2 ; 57 | sh:targetNode ex:ValidResource1 ; 58 | sh:targetNode ex:ValidResource2 ; 59 | sh:targetNode ex:ValidResource3 ; 60 | . 61 | ex:TestShape-property1 62 | sh:path ex:property1 ; 63 | sh:lessThanOrEquals ex:property2 ; 64 | . 65 | ex:ValidResource1 66 | ex:property1 4 ; 67 | ex:property2 6 ; 68 | . 69 | ex:ValidResource2 70 | ex:property1 3.1 ; 71 | ex:property1 3.2 ; 72 | . 73 | ex:ValidResource3 74 | ex:property1 5 ; 75 | ex:property2 5 ; 76 | . 77 | ex:property1 78 | rdf:type rdf:Property ; 79 | . 80 | ex:property2 81 | rdf:type rdf:Property ; 82 | . 83 | -------------------------------------------------------------------------------- /test/data/core/property/maxCount-001.test.ttl: -------------------------------------------------------------------------------- 1 | # baseURI: http://datashapes.org/sh/tests/core/property/maxCount-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:maxCount at property 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:InvalidPerson ; 26 | sh:resultPath ex:firstName ; 27 | sh:resultSeverity sh:Violation ; 28 | sh:sourceConstraintComponent sh:MaxCountConstraintComponent ; 29 | sh:sourceShape ex:PersonShape-firstName ; 30 | ] ; 31 | ] ; 32 | . 33 | ex:InvalidPerson 34 | rdf:type ex:Person ; 35 | ex:firstName "George" ; 36 | ex:firstName "John" ; 37 | rdfs:label "Invalid person" ; 38 | . 39 | ex:Person 40 | rdf:type rdfs:Class ; 41 | rdfs:label "Person" ; 42 | rdfs:subClassOf rdfs:Resource ; 43 | . 44 | ex:PersonShape 45 | rdf:type sh:NodeShape ; 46 | sh:property ex:PersonShape-firstName ; 47 | sh:targetClass ex:Person ; 48 | sh:targetNode ex:ValidResource ; 49 | . 50 | ex:PersonShape-firstName 51 | sh:path ex:firstName ; 52 | sh:datatype xsd:string ; 53 | sh:maxCount 1 ; 54 | . 55 | ex:ValidResource 56 | rdf:type ex:Person ; 57 | ex:firstName "John" ; 58 | rdfs:label "Valid resource" ; 59 | . 60 | -------------------------------------------------------------------------------- /test/data/core/property/maxCount-002.test.ttl: -------------------------------------------------------------------------------- 1 | # baseURI: http://datashapes.org/sh/tests/core/property/maxCount-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:maxCount at property 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 ex:InvalidResource ; 26 | sh:resultPath owl:versionInfo ; 27 | sh:resultSeverity sh:Violation ; 28 | sh:sourceConstraintComponent sh:MaxCountConstraintComponent ; 29 | sh:sourceShape ex:TestShape-versionInfo ; 30 | ] ; 31 | ] ; 32 | . 33 | ex:InvalidResource 34 | rdf:type rdfs:Resource ; 35 | rdfs:label "Invalid resource" ; 36 | owl:versionInfo "1.0" ; 37 | . 38 | ex:TestShape 39 | rdf:type sh:NodeShape ; 40 | rdfs:label "Test shape" ; 41 | sh:property ex:TestShape-versionInfo ; 42 | sh:targetNode ex:InvalidResource ; 43 | sh:targetNode ex:ValidResource ; 44 | . 45 | ex:TestShape-versionInfo 46 | sh:path owl:versionInfo ; 47 | sh:maxCount 0 ; 48 | . 49 | ex:ValidResource 50 | rdf:type rdfs:Resource ; 51 | rdfs:label "Valid resource" ; 52 | . 53 | -------------------------------------------------------------------------------- /test/data/core/property/maxExclusive-001.test.ttl: -------------------------------------------------------------------------------- 1 | # baseURI: http://datashapes.org/sh/tests/core/property/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 property 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:resultPath ex:property ; 27 | sh:resultSeverity sh:Violation ; 28 | sh:sourceConstraintComponent sh:MaxExclusiveConstraintComponent ; 29 | sh:sourceShape ex:TestShape-property ; 30 | sh:value 1 ; 31 | ] ; 32 | sh:result [ 33 | rdf:type sh:ValidationResult ; 34 | sh:focusNode ex:InvalidResource2 ; 35 | sh:resultPath ex:property ; 36 | sh:resultSeverity sh:Violation ; 37 | sh:sourceConstraintComponent sh:MaxExclusiveConstraintComponent ; 38 | sh:sourceShape ex:TestShape-property ; 39 | sh:value 2 ; 40 | ] ; 41 | sh:result [ 42 | rdf:type sh:ValidationResult ; 43 | sh:focusNode ex:InvalidResource3 ; 44 | sh:resultPath ex:property ; 45 | sh:resultSeverity sh:Violation ; 46 | sh:sourceConstraintComponent sh:MaxExclusiveConstraintComponent ; 47 | sh:sourceShape ex:TestShape-property ; 48 | sh:value "a" ; 49 | ] ; 50 | ] ; 51 | . 52 | ex:InvalidResource1 53 | ex:property 1 ; 54 | . 55 | ex:InvalidResource2 56 | ex:property 2 ; 57 | . 58 | ex:InvalidResource3 59 | ex:property "a" ; 60 | . 61 | ex:TestShape 62 | rdf:type sh:NodeShape ; 63 | sh:property ex:TestShape-property ; 64 | sh:targetNode ex:InvalidResource1 ; 65 | sh:targetNode ex:InvalidResource2 ; 66 | sh:targetNode ex:InvalidResource3 ; 67 | sh:targetNode ex:ValidResource1 ; 68 | sh:targetNode ex:ValidResource2 ; 69 | . 70 | ex:TestShape-property 71 | sh:path ex:property ; 72 | sh:maxExclusive 1 ; 73 | . 74 | ex:ValidResource1 75 | ex:property 0 ; 76 | . 77 | ex:ValidResource2 78 | ex:property -1 ; 79 | . 80 | -------------------------------------------------------------------------------- /test/data/core/property/maxInclusive-001.test.ttl: -------------------------------------------------------------------------------- 1 | # baseURI: http://datashapes.org/sh/tests/core/property/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 property 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:resultPath ex:property ; 27 | sh:resultSeverity sh:Violation ; 28 | sh:sourceConstraintComponent sh:MaxInclusiveConstraintComponent ; 29 | sh:sourceShape ex:TestShape-property ; 30 | sh:value 2 ; 31 | ] ; 32 | sh:result [ 33 | rdf:type sh:ValidationResult ; 34 | sh:focusNode ex:InvalidResource2 ; 35 | sh:resultPath ex:property ; 36 | sh:resultSeverity sh:Violation ; 37 | sh:sourceConstraintComponent sh:MaxInclusiveConstraintComponent ; 38 | sh:sourceShape ex:TestShape-property ; 39 | sh:value "a" ; 40 | ] ; 41 | ] ; 42 | . 43 | ex:InvalidResource1 44 | ex:property 2 ; 45 | . 46 | ex:InvalidResource2 47 | ex:property "a" ; 48 | . 49 | ex:TestShape 50 | rdf:type sh:NodeShape ; 51 | sh:property ex:TestShape-property ; 52 | sh:targetNode ex:InvalidResource1 ; 53 | sh:targetNode ex:InvalidResource2 ; 54 | sh:targetNode ex:ValidResource1 ; 55 | sh:targetNode ex:ValidResource2 ; 56 | . 57 | ex:TestShape-property 58 | sh:path ex:property ; 59 | sh:maxInclusive 1 ; 60 | . 61 | ex:ValidResource1 62 | ex:property 0 ; 63 | . 64 | ex:ValidResource2 65 | ex:property 1 ; 66 | . 67 | -------------------------------------------------------------------------------- /test/data/core/property/maxLength-001.test.ttl: -------------------------------------------------------------------------------- 1 | # baseURI: http://datashapes.org/sh/tests/core/property/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 property 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 ex:testProperty ; 28 | sh:resultSeverity sh:Violation ; 29 | sh:sourceConstraintComponent sh:MaxLengthConstraintComponent ; 30 | sh:sourceShape ex:TestShape-testProperty ; 31 | sh:value "ABC" ; 32 | ] ; 33 | ] ; 34 | . 35 | ex:InvalidInstance1 36 | rdf:type ex:TestShape ; 37 | ex:testProperty "ABC" ; 38 | . 39 | ex:TestShape 40 | rdf:type rdfs:Class ; 41 | rdf:type sh:NodeShape ; 42 | rdfs:label "Test shape" ; 43 | sh:property ex:TestShape-testProperty ; 44 | . 45 | ex:TestShape-testProperty 46 | sh:path ex:testProperty ; 47 | sh:datatype xsd:string ; 48 | sh:maxLength 2 ; 49 | . 50 | ex:ValidInstance1 51 | rdf:type ex:TestShape ; 52 | ex:testProperty "A" ; 53 | ex:testProperty "AB" ; 54 | . 55 | ex:ValidInstance2 56 | rdf:type ex:TestShape ; 57 | . 58 | -------------------------------------------------------------------------------- /test/data/core/property/minCount-001.test.ttl: -------------------------------------------------------------------------------- 1 | # baseURI: http://datashapes.org/sh/tests/core/property/minCount-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:minCount at property 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:InvalidPerson ; 26 | sh:resultPath ex:firstName ; 27 | sh:resultSeverity sh:Violation ; 28 | sh:sourceConstraintComponent sh:MinCountConstraintComponent ; 29 | sh:sourceShape ex:PersonShape-firstName ; 30 | ] ; 31 | ] ; 32 | . 33 | ex:InvalidPerson 34 | rdf:type ex:Person ; 35 | rdfs:label "Invalid person" ; 36 | . 37 | ex:Person 38 | rdf:type rdfs:Class ; 39 | rdfs:label "Person" ; 40 | rdfs:subClassOf rdfs:Resource ; 41 | . 42 | ex:PersonShape 43 | rdf:type sh:NodeShape ; 44 | sh:property ex:PersonShape-firstName ; 45 | sh:targetClass ex:Person ; 46 | sh:targetNode ex:ValidResource ; 47 | . 48 | ex:PersonShape-firstName 49 | sh:path ex:firstName ; 50 | sh:datatype xsd:string ; 51 | sh:minCount 1 ; 52 | . 53 | ex:ValidResource 54 | rdf:type ex:Person ; 55 | ex:firstName "John" ; 56 | rdfs:label "Valid resource" ; 57 | . 58 | -------------------------------------------------------------------------------- /test/data/core/property/minCount-002.test.ttl: -------------------------------------------------------------------------------- 1 | # baseURI: http://datashapes.org/sh/tests/core/property/minCount-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:minCount at property 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 "true"^^xsd:boolean ; 23 | ] ; 24 | . 25 | ex:TestShape 26 | rdf:type sh:NodeShape ; 27 | sh:property [ 28 | sh:path ex:property ; 29 | sh:minCount 0 ; 30 | sh:name "property" ; 31 | ] ; 32 | sh:targetNode ex:ValidResource1 ; 33 | . 34 | ex:ValidResource1 35 | rdf:type rdfs:Resource ; 36 | . 37 | -------------------------------------------------------------------------------- /test/data/core/property/minExclusive-001.test.ttl: -------------------------------------------------------------------------------- 1 | # baseURI: http://datashapes.org/sh/tests/core/property/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 property 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:InvalidInstance1 ; 26 | sh:resultPath ex:testProperty ; 27 | sh:resultSeverity sh:Violation ; 28 | sh:sourceConstraintComponent sh:MinExclusiveConstraintComponent ; 29 | sh:sourceShape ex:TestShape-testProperty ; 30 | sh:value 40 ; 31 | ] ; 32 | sh:result [ 33 | rdf:type sh:ValidationResult ; 34 | sh:focusNode ex:InvalidInstance2 ; 35 | sh:resultPath ex:testProperty ; 36 | sh:resultSeverity sh:Violation ; 37 | sh:sourceConstraintComponent sh:MinExclusiveConstraintComponent ; 38 | sh:sourceShape ex:TestShape-testProperty ; 39 | sh:value 39 ; 40 | ] ; 41 | ] ; 42 | . 43 | ex:InvalidInstance1 44 | rdf:type ex:TestShape ; 45 | ex:testProperty 40 ; 46 | . 47 | ex:InvalidInstance2 48 | rdf:type ex:TestShape ; 49 | ex:testProperty 39 ; 50 | . 51 | ex:TestShape 52 | rdf:type rdfs:Class ; 53 | rdf:type sh:NodeShape ; 54 | rdfs:label "Test shape" ; 55 | sh:property ex:TestShape-testProperty ; 56 | . 57 | ex:TestShape-testProperty 58 | sh:path ex:testProperty ; 59 | sh:minExclusive 40 ; 60 | . 61 | ex:ValidInstance1 62 | rdf:type ex:TestShape ; 63 | ex:testProperty 42 ; 64 | . 65 | -------------------------------------------------------------------------------- /test/data/core/property/minExclusive-002.test.ttl: -------------------------------------------------------------------------------- 1 | # baseURI: http://datashapes.org/sh/tests/core/property/minExclusive-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:minExclusive at property 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 ex:InvalidInstance1 ; 26 | sh:resultPath ex:testProperty ; 27 | sh:resultSeverity sh:Violation ; 28 | sh:sourceConstraintComponent sh:MinExclusiveConstraintComponent ; 29 | sh:sourceShape ex:TestShape-testProperty ; 30 | sh:value "A string" ; 31 | ] ; 32 | sh:result [ 33 | rdf:type sh:ValidationResult ; 34 | sh:focusNode ex:InvalidInstance2 ; 35 | sh:resultPath ex:testProperty ; 36 | sh:resultSeverity sh:Violation ; 37 | sh:sourceConstraintComponent sh:MinExclusiveConstraintComponent ; 38 | sh:sourceShape ex:TestShape-testProperty ; 39 | sh:value rdfs:Resource ; 40 | ] ; 41 | ] ; 42 | . 43 | ex:InvalidInstance1 44 | rdf:type ex:TestShape ; 45 | ex:testProperty "A string" ; 46 | . 47 | ex:InvalidInstance2 48 | rdf:type ex:TestShape ; 49 | ex:testProperty rdfs:Resource ; 50 | . 51 | ex:TestShape 52 | rdf:type rdfs:Class ; 53 | rdf:type sh:NodeShape ; 54 | rdfs:label "Test shape" ; 55 | sh:property ex:TestShape-testProperty ; 56 | . 57 | ex:TestShape-testProperty 58 | sh:path ex:testProperty ; 59 | sh:minExclusive 40 ; 60 | . -------------------------------------------------------------------------------- /test/data/core/property/minLength-001.test.ttl: -------------------------------------------------------------------------------- 1 | # baseURI: http://datashapes.org/sh/tests/core/property/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 property 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:InvalidInstance1 ; 26 | sh:resultPath ex:testProperty ; 27 | sh:resultSeverity sh:Violation ; 28 | sh:sourceConstraintComponent sh:MinLengthConstraintComponent ; 29 | sh:sourceShape ex:TestShape-testProperty ; 30 | sh:value "A" ; 31 | ] ; 32 | ] ; 33 | . 34 | ex:InvalidInstance1 35 | rdf:type ex:TestShape ; 36 | ex:testProperty "A" ; 37 | . 38 | ex:TestShape 39 | rdf:type rdfs:Class ; 40 | rdf:type sh:NodeShape ; 41 | rdfs:label "Test shape" ; 42 | sh:property ex:TestShape-testProperty ; 43 | . 44 | ex:TestShape-testProperty 45 | sh:path ex:testProperty ; 46 | sh:datatype xsd:string ; 47 | sh:minLength 2 ; 48 | . 49 | ex:ValidInstance1 50 | rdf:type ex:TestShape ; 51 | ex:testProperty "AB" ; 52 | ex:testProperty "ABC" ; 53 | . 54 | ex:ValidInstance2 55 | rdf:type ex:TestShape ; 56 | . 57 | -------------------------------------------------------------------------------- /test/data/core/property/node-001.test.ttl: -------------------------------------------------------------------------------- 1 | # baseURI: http://datashapes.org/sh/tests/core/property/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 property shape 001" ; 16 | owl:imports ; 17 | . 18 | ex:Anon 19 | rdf:type ex:Person ; 20 | ex:firstName "Anon" ; 21 | . 22 | ex:GraphValidationTestCase 23 | rdf:type dash:GraphValidationTestCase ; 24 | dash:expectedResult [ 25 | rdf:type sh:ValidationReport ; 26 | sh:conforms "false"^^xsd:boolean ; 27 | sh:result [ 28 | rdf:type sh:ValidationResult ; 29 | sh:focusNode ex:Issue_1 ; 30 | sh:resultPath ex:assignedTo ; 31 | sh:resultSeverity sh:Violation ; 32 | sh:sourceConstraintComponent sh:NodeConstraintComponent ; 33 | sh:sourceShape ex:Issue-assignedTo ; 34 | sh:value ex:Anon ; 35 | ] ; 36 | ] ; 37 | . 38 | ex:Issue 39 | rdf:type rdfs:Class ; 40 | rdf:type sh:NodeShape ; 41 | rdfs:label "Issue" ; 42 | rdfs:subClassOf rdfs:Resource ; 43 | sh:property ex:Issue-assignedTo ; 44 | sh:property ex:Issue-submittedBy ; 45 | . 46 | ex:Issue-assignedTo 47 | sh:path ex:assignedTo ; 48 | sh:node [ 49 | rdfs:comment "All assignees must have an email and a last name." ; 50 | sh:property [ 51 | sh:path ex:email ; 52 | sh:maxCount 1 ; 53 | sh:minCount 1 ; 54 | ] ; 55 | sh:property [ 56 | sh:path ex:lastName ; 57 | sh:maxCount 1 ; 58 | sh:minCount 1 ; 59 | ] ; 60 | ] ; 61 | sh:class ex:Person ; 62 | . 63 | ex:Issue-submittedBy 64 | sh:path ex:submittedBy ; 65 | sh:class ex:Person ; 66 | sh:minCount 1 ; 67 | . 68 | ex:Issue_1 69 | rdf:type ex:Issue ; 70 | ex:assignedTo ex:Anon ; 71 | ex:submittedBy ex:Anon ; 72 | rdfs:label "Issue 1" ; 73 | . 74 | ex:Issue_2 75 | rdf:type ex:Issue ; 76 | ex:assignedTo ex:JohnDoeWithEmail ; 77 | ex:submittedBy ex:Anon ; 78 | rdfs:label "Issue 2" ; 79 | . 80 | ex:JohnDoeWithEmail 81 | rdf:type ex:Person ; 82 | ex:email "john@doe.com" ; 83 | ex:firstName "John" ; 84 | ex:lastName "Doe" ; 85 | . 86 | ex:Person 87 | rdf:type rdfs:Class ; 88 | rdf:type sh:NodeShape ; 89 | rdfs:label "Person" ; 90 | rdfs:subClassOf rdfs:Resource ; 91 | sh:property [ 92 | sh:path ex:email ; 93 | ex:datatype xsd:string ; 94 | rdfs:label "email" ; 95 | ] ; 96 | sh:property [ 97 | sh:path ex:firstName ; 98 | rdfs:label "first name" ; 99 | sh:datatype xsd:string ; 100 | sh:maxCount 1 ; 101 | sh:minCount 1 ; 102 | ] ; 103 | sh:property [ 104 | sh:path ex:lastName ; 105 | rdfs:label "last name" ; 106 | sh:datatype xsd:string ; 107 | ] ; 108 | . 109 | -------------------------------------------------------------------------------- /test/data/core/property/node-002.test.ttl: -------------------------------------------------------------------------------- 1 | # baseURI: http://datashapes.org/sh/tests/core/property/node-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:node at property shape 002" ; 16 | owl:imports ; 17 | . 18 | ex:AddressShape 19 | rdf:type sh:NodeShape ; 20 | sh:property ex:AddressShape-postalCode ; 21 | . 22 | ex:AddressShape-postalCode 23 | sh:path ex:postalCode ; 24 | sh:datatype xsd:string ; 25 | sh:maxCount 1 ; 26 | . 27 | ex:Bob 28 | rdf:type ex:Person ; 29 | ex:address ex:BobsAddress ; 30 | . 31 | ex:BobsAddress 32 | ex:postalCode "1234" ; 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:Reto ; 42 | sh:resultPath ex:address ; 43 | sh:resultSeverity sh:Violation ; 44 | sh:sourceConstraintComponent sh:NodeConstraintComponent ; 45 | sh:sourceShape ex:PersonShape-address ; 46 | sh:value ex:RetosAddress ; 47 | ] ; 48 | ] ; 49 | . 50 | ex:Person 51 | rdf:type rdfs:Class ; 52 | rdfs:label "Person" ; 53 | . 54 | ex:PersonShape 55 | rdf:type sh:NodeShape ; 56 | sh:property ex:PersonShape-address ; 57 | sh:targetClass ex:Person ; 58 | . 59 | ex:PersonShape-address 60 | sh:path ex:address ; 61 | sh:minCount 1 ; 62 | sh:node ex:AddressShape ; 63 | . 64 | ex:Reto 65 | rdf:type ex:Person ; 66 | ex:address ex:RetosAddress ; 67 | . 68 | ex:RetosAddress 69 | ex:postalCode 5678 ; 70 | . 71 | -------------------------------------------------------------------------------- /test/data/core/property/not-001.test.ttl: -------------------------------------------------------------------------------- 1 | # baseURI: http://datashapes.org/sh/tests/core/property/not-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:not at property 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:resultPath ex:property ; 28 | sh:resultSeverity sh:Violation ; 29 | sh:sourceConstraintComponent sh:NotConstraintComponent ; 30 | sh:sourceShape ex:TestShape-property ; 31 | sh:value 42 ; 32 | ] ; 33 | ] ; 34 | . 35 | ex:InvalidResource1 36 | rdf:type rdfs:Resource ; 37 | ex:property 42 ; 38 | ex:property "Test Valid" ; 39 | rdfs:label "Invalid resource1" ; 40 | . 41 | ex:TestShape 42 | rdf:type sh:NodeShape ; 43 | rdfs:label "Test shape" ; 44 | sh:property ex:TestShape-property ; 45 | sh:targetNode ex:InvalidResource1 ; 46 | sh:targetNode ex:ValidResource1 ; 47 | sh:targetNode ex:ValidResource2 ; 48 | . 49 | ex:TestShape-property 50 | sh:path ex:property ; 51 | sh:not [ 52 | sh:datatype xsd:integer ; 53 | ] ; 54 | . 55 | ex:ValidResource1 56 | rdf:type rdfs:Resource ; 57 | rdfs:label "Valid resource1" ; 58 | . 59 | ex:ValidResource2 60 | rdf:type rdfs:Resource ; 61 | ex:property 1.5 ; 62 | ex:property "String" ; 63 | rdfs:label "Valid resource2" ; 64 | . 65 | -------------------------------------------------------------------------------- /test/data/core/property/or-001.test.ttl: -------------------------------------------------------------------------------- 1 | # baseURI: http://datashapes.org/sh/tests/core/property/or-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:or at property shape 001" ; 16 | owl:imports ; 17 | . 18 | ex:Address 19 | rdf:type rdfs:Class ; 20 | rdfs:label "Address" ; 21 | rdfs:subClassOf rdfs:Resource ; 22 | . 23 | ex:AddressShape 24 | rdf:type sh:NodeShape ; 25 | rdfs:label "Address shape" ; 26 | sh:property ex:AddressShape-address ; 27 | sh:targetNode ex:InvalidResource1 ; 28 | sh:targetNode ex:ValidResource1 ; 29 | sh:targetNode ex:ValidResource2 ; 30 | . 31 | ex:AddressShape-address 32 | sh:path ex:address ; 33 | sh:or ( 34 | [ 35 | sh:datatype xsd:string ; 36 | ] 37 | [ 38 | sh:class ex:Address ; 39 | ] 40 | ) ; 41 | . 42 | ex:GraphValidationTestCase 43 | rdf:type dash:GraphValidationTestCase ; 44 | dash:expectedResult [ 45 | rdf:type sh:ValidationReport ; 46 | sh:conforms "false"^^xsd:boolean ; 47 | sh:result [ 48 | rdf:type sh:ValidationResult ; 49 | sh:focusNode ex:InvalidResource1 ; 50 | sh:resultPath ex:address ; 51 | sh:resultSeverity sh:Violation ; 52 | sh:sourceConstraintComponent sh:OrConstraintComponent ; 53 | sh:sourceShape ex:AddressShape-address ; 54 | sh:value "true"^^xsd:boolean ; 55 | ] ; 56 | ] ; 57 | . 58 | ex:InvalidResource1 59 | rdf:type rdfs:Resource ; 60 | ex:address "true"^^xsd:boolean ; 61 | . 62 | ex:ValidResource1 63 | rdf:type rdfs:Resource ; 64 | ex:address "Home" ; 65 | . 66 | ex:ValidResource2 67 | rdf:type rdfs:Resource ; 68 | ex:address [ 69 | rdf:type ex:Address ; 70 | ] ; 71 | . 72 | -------------------------------------------------------------------------------- /test/data/core/property/or-datatypes-001.test.ttl: -------------------------------------------------------------------------------- 1 | # baseURI: http://datashapes.org/sh/tests/core/property/or-datatypes-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:or of sh:datatypes at property 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:resultPath rdfs:comment ; 27 | sh:resultSeverity sh:Violation ; 28 | sh:sourceConstraintComponent sh:OrConstraintComponent ; 29 | sh:sourceShape ex:TestShape-comment ; 30 | sh:value owl:Thing ; 31 | ] ; 32 | sh:result [ 33 | rdf:type sh:ValidationResult ; 34 | sh:focusNode ex:InvalidResource1 ; 35 | sh:resultPath rdfs:comment ; 36 | sh:resultSeverity sh:Violation ; 37 | sh:sourceConstraintComponent sh:OrConstraintComponent ; 38 | sh:sourceShape ex:TestShape-comment ; 39 | sh:value 42 ; 40 | ] ; 41 | sh:result [ 42 | rdf:type sh:ValidationResult ; 43 | sh:focusNode ex:InvalidResource1 ; 44 | sh:resultPath rdfs:comment ; 45 | sh:resultSeverity sh:Violation ; 46 | sh:sourceConstraintComponent sh:OrConstraintComponent ; 47 | sh:sourceShape ex:TestShape-comment ; 48 | sh:value "none"^^xsd:boolean ; 49 | ] ; 50 | ] ; 51 | . 52 | ex:InvalidResource1 53 | rdf:type rdfs:Resource ; 54 | rdfs:comment owl:Thing ; 55 | rdfs:comment 42 ; 56 | rdfs:comment "A string" ; 57 | rdfs:comment "none"^^xsd:boolean ; 58 | rdfs:label "Invalid resource1" ; 59 | . 60 | ex:TestShape 61 | rdf:type sh:NodeShape ; 62 | rdfs:label "Test shape" ; 63 | sh:property ex:TestShape-comment ; 64 | sh:targetNode ex:InvalidResource1 ; 65 | sh:targetNode ex:ValidResource1 ; 66 | . 67 | ex:TestShape-comment 68 | sh:path rdfs:comment ; 69 | sh:or ( 70 | [ 71 | sh:datatype xsd:string ; 72 | ] 73 | [ 74 | sh:datatype rdf:HTML ; 75 | ] 76 | [ 77 | sh:datatype rdf:langString ; 78 | ] 79 | [ 80 | sh:datatype xsd:boolean ; 81 | ] 82 | ) ; 83 | . 84 | ex:ValidResource1 85 | rdf:type rdfs:Resource ; 86 | rdfs:comment "
HTML
"^^rdf:HTML ; 87 | rdfs:comment "A language string"@en ; 88 | rdfs:comment "A string" ; 89 | rdfs:label "Valid resource1" ; 90 | . 91 | -------------------------------------------------------------------------------- /test/data/core/property/pattern-001.test.ttl: -------------------------------------------------------------------------------- 1 | # baseURI: http://datashapes.org/sh/tests/core/property/pattern-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:pattern at property 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:InvalidInstance1 ; 26 | sh:resultPath ex:property ; 27 | sh:resultSeverity sh:Violation ; 28 | sh:sourceConstraintComponent sh:PatternConstraintComponent ; 29 | sh:sourceShape ex:TestShape-property ; 30 | sh:value "Maria" ; 31 | ] ; 32 | sh:result [ 33 | rdf:type sh:ValidationResult ; 34 | sh:focusNode ex:InvalidInstance2 ; 35 | sh:resultPath ex:property ; 36 | sh:resultSeverity sh:Violation ; 37 | sh:sourceConstraintComponent sh:PatternConstraintComponent ; 38 | sh:sourceShape ex:TestShape-property ; 39 | sh:value "john" ; 40 | ] ; 41 | ] ; 42 | . 43 | ex:InvalidInstance1 44 | rdf:type ex:TestShape ; 45 | ex:property "Maria" ; 46 | rdfs:label "Invalid instance1" ; 47 | . 48 | ex:InvalidInstance2 49 | rdf:type ex:TestShape ; 50 | ex:property "john" ; 51 | rdfs:label "Invalid instance2" ; 52 | . 53 | ex:TestShape 54 | rdf:type rdfs:Class ; 55 | rdf:type sh:NodeShape ; 56 | rdfs:label "Test shape" ; 57 | sh:property ex:TestShape-property ; 58 | . 59 | ex:TestShape-property 60 | sh:path ex:property ; 61 | sh:datatype xsd:string ; 62 | sh:pattern "Joh" ; 63 | . 64 | ex:ValidInstance1 65 | rdf:type ex:TestShape ; 66 | ex:property "Hi Joh" ; 67 | ex:property "John" ; 68 | rdfs:label "Valid instance1" ; 69 | . 70 | -------------------------------------------------------------------------------- /test/data/core/property/pattern-002.test.ttl: -------------------------------------------------------------------------------- 1 | # baseURI: http://datashapes.org/sh/tests/core/property/pattern-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:pattern at property 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 ex:InvalidInstance1 ; 26 | sh:resultPath ex:property ; 27 | sh:resultSeverity sh:Violation ; 28 | sh:sourceConstraintComponent sh:PatternConstraintComponent ; 29 | sh:sourceShape ex:TestShape-property ; 30 | sh:value "Maria" ; 31 | ] ; 32 | ] ; 33 | . 34 | ex:InvalidInstance1 35 | rdf:type ex:TestShape ; 36 | ex:property "Maria" ; 37 | rdfs:label "Invalid instance1" ; 38 | . 39 | ex:TestShape 40 | rdf:type rdfs:Class ; 41 | rdf:type sh:NodeShape ; 42 | rdfs:label "Test shape" ; 43 | sh:property ex:TestShape-property ; 44 | . 45 | ex:TestShape-property 46 | sh:path ex:property ; 47 | rdfs:label "property" ; 48 | sh:datatype xsd:string ; 49 | sh:flags "i" ; 50 | sh:pattern "joh" ; 51 | . 52 | ex:ValidInstance1 53 | rdf:type ex:TestShape ; 54 | ex:property "Hi Joh" ; 55 | ex:property "John" ; 56 | rdfs:label "Valid instance1" ; 57 | . 58 | ex:ValidInstance2 59 | rdf:type ex:TestShape ; 60 | ex:property "john" ; 61 | . 62 | -------------------------------------------------------------------------------- /test/data/core/property/property-001.test.ttl: -------------------------------------------------------------------------------- 1 | # baseURI: http://datashapes.org/sh/tests/core/property/property-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:property at property shape 001" ; 16 | owl:imports ; 17 | . 18 | ex:Address 19 | rdf:type rdfs:Class ; 20 | rdfs:label "Address" ; 21 | rdfs:subClassOf rdfs:Resource ; 22 | . 23 | ex:City 24 | rdf:type rdfs:Class ; 25 | rdfs:label "City" ; 26 | rdfs:subClassOf rdfs:Resource ; 27 | . 28 | ex:GraphValidationTestCase 29 | rdf:type dash:GraphValidationTestCase ; 30 | dash:expectedResult [ 31 | rdf:type sh:ValidationReport ; 32 | sh:conforms "false"^^xsd:boolean ; 33 | sh:result [ 34 | rdf:type sh:ValidationResult ; 35 | sh:focusNode ex:InvalidAddress ; 36 | sh:resultPath ex:city ; 37 | sh:resultSeverity sh:Violation ; 38 | sh:sourceConstraintComponent sh:ClassConstraintComponent ; 39 | sh:sourceShape ex:PersonShape-address-city ; 40 | sh:value ex:InvalidCity ; 41 | ] ; 42 | sh:result [ 43 | rdf:type sh:ValidationResult ; 44 | sh:focusNode ex:InvalidAddress ; 45 | sh:resultPath ex:city ; 46 | sh:resultSeverity sh:Violation ; 47 | sh:sourceConstraintComponent sh:ClassConstraintComponent ; 48 | sh:sourceShape ex:PersonShape-address-city ; 49 | sh:value ex:InvalidCity ; 50 | ] ; 51 | ] ; 52 | . 53 | ex:InvalidAddress 54 | rdf:type ex:Address ; 55 | ex:city ex:InvalidCity ; 56 | . 57 | ex:InvalidPerson1 58 | rdf:type ex:Person ; 59 | ex:address ex:InvalidAddress ; 60 | . 61 | ex:InvalidPerson2 62 | rdf:type ex:Person ; 63 | ex:address ex:InvalidAddress ; 64 | ex:address ex:ValidAddress ; 65 | . 66 | ex:Person 67 | rdf:type rdfs:Class ; 68 | rdfs:label "Person" ; 69 | rdfs:subClassOf rdfs:Resource ; 70 | . 71 | ex:PersonShape 72 | rdf:type sh:NodeShape ; 73 | rdfs:label "Person shape" ; 74 | sh:property [ 75 | sh:path ex:address ; 76 | sh:property ex:PersonShape-address-city ; 77 | ] ; 78 | sh:targetClass ex:Person ; 79 | . 80 | ex:PersonShape-address-city 81 | sh:path ex:city ; 82 | sh:class ex:City ; 83 | . 84 | ex:ProperCity 85 | rdf:type ex:City ; 86 | rdfs:label "Proper city" ; 87 | . 88 | ex:ValidAddress 89 | rdf:type ex:Address ; 90 | ex:city ex:ProperCity ; 91 | . 92 | ex:ValidPerson1 93 | rdf:type ex:Person ; 94 | ex:address ex:ValidAddress ; 95 | . 96 | -------------------------------------------------------------------------------- /test/data/core/property/qualifiedMinCountDisjoint-001.test.ttl: -------------------------------------------------------------------------------- 1 | # baseURI: http://datashapes.org/sh/tests/core/property/qualifiedMinCountDisjoint-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:qualifiedMinCount with disjoint shapes at property shape 001" ; 16 | owl:imports ; 17 | . 18 | ex:Digit 19 | rdf:type rdfs:Class ; 20 | rdfs:label "Digit" ; 21 | . 22 | ex:Finger 23 | rdf:type rdfs:Class ; 24 | rdfs:label "Finger" ; 25 | rdfs:subClassOf ex:Digit ; 26 | . 27 | ex:FingerAndThumb 28 | rdf:type ex:Finger ; 29 | rdf:type ex:Thumb ; 30 | rdfs:label "Finger and thumb" ; 31 | . 32 | ex:FingerShape 33 | rdf:type sh:NodeShape ; 34 | rdfs:label "Finger shape" ; 35 | sh:class ex:Finger ; 36 | . 37 | ex:Finger_1 38 | rdf:type ex:Finger ; 39 | rdfs:label "Finger 1" ; 40 | . 41 | ex:GraphValidationTestCase 42 | rdf:type dash:GraphValidationTestCase ; 43 | dash:expectedResult [ 44 | rdf:type sh:ValidationReport ; 45 | sh:conforms "false"^^xsd:boolean ; 46 | sh:result [ 47 | rdf:type sh:ValidationResult ; 48 | sh:focusNode ex:InvalidHand1 ; 49 | sh:resultPath ex:digit ; 50 | sh:resultSeverity sh:Violation ; 51 | sh:sourceConstraintComponent sh:QualifiedMinCountConstraintComponent ; 52 | sh:sourceShape ex:HandShape-digit-minCount1 ; 53 | ] ; 54 | ] ; 55 | . 56 | ex:Hand 57 | rdf:type rdfs:Class ; 58 | rdfs:label "Hand" ; 59 | . 60 | ex:HandShape 61 | rdf:type sh:NodeShape ; 62 | rdfs:label "Hand shape" ; 63 | sh:property ex:HandShape-digit-maxCount4 ; 64 | sh:property ex:HandShape-digit-minCount1 ; 65 | sh:targetClass ex:Hand ; 66 | . 67 | ex:HandShape-digit-maxCount4 68 | rdf:type sh:PropertyShape ; 69 | sh:path ex:digit ; 70 | sh:qualifiedMaxCount 4 ; 71 | sh:qualifiedValueShapesDisjoint true ; 72 | sh:qualifiedValueShape ex:FingerShape ; 73 | . 74 | ex:HandShape-digit-minCount1 75 | rdf:type sh:PropertyShape ; 76 | sh:path ex:digit ; 77 | sh:qualifiedMinCount 1 ; 78 | sh:qualifiedValueShapesDisjoint true ; 79 | sh:qualifiedValueShape ex:ThumbShape ; 80 | . 81 | ex:InvalidHand1 82 | rdf:type ex:Hand ; 83 | ex:digit ex:FingerAndThumb ; 84 | rdfs:label "Invalid hand1" ; 85 | . 86 | ex:Thumb 87 | rdf:type rdfs:Class ; 88 | rdfs:label "Thumb" ; 89 | rdfs:subClassOf ex:Digit ; 90 | . 91 | ex:ThumbShape 92 | rdf:type sh:NodeShape ; 93 | rdfs:label "Thumb shape" ; 94 | sh:class ex:Thumb ; 95 | . 96 | ex:Thumb_1 97 | rdf:type ex:Thumb ; 98 | rdfs:label "Thumb 1" ; 99 | . 100 | ex:ValidHand1 101 | rdf:type ex:Hand ; 102 | ex:digit ex:Finger_1 ; 103 | ex:digit ex:Thumb_1 ; 104 | rdfs:label "Valid hand1" ; 105 | . 106 | ex:digit 107 | rdf:type rdf:Property ; 108 | rdfs:domain ex:Hand ; 109 | rdfs:label "digit" ; 110 | rdfs:range ex:Digit ; 111 | . 112 | -------------------------------------------------------------------------------- /test/data/core/property/qualifiedValueShape-001.test.ttl: -------------------------------------------------------------------------------- 1 | # baseURI: http://datashapes.org/sh/tests/core/property/qualifiedValueShape-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:qualifiedValueShape at property shape 001" ; 16 | owl:imports ; 17 | . 18 | ex:APGARObservationShape 19 | rdf:type sh:NodeShape ; 20 | sh:property ex:APGARObservationShape-related ; 21 | sh:targetNode ex:Observation1 ; 22 | . 23 | ex:APGARObservationShape-related 24 | sh:path ex:related ; 25 | sh:qualifiedMaxCount 3 ; 26 | sh:qualifiedMinCount 3 ; 27 | sh:qualifiedValueShape [ 28 | sh:property [ 29 | sh:path ex:related_target ; 30 | sh:node [ 31 | sh:property [ 32 | sh:path ex:reference ; 33 | sh:hasValue ex:something ; 34 | ] ; 35 | ] ; 36 | ] ; 37 | ] ; 38 | . 39 | ex:GraphValidationTestCase 40 | rdf:type dash:GraphValidationTestCase ; 41 | dash:expectedResult [ 42 | rdf:type sh:ValidationReport ; 43 | sh:conforms "false"^^xsd:boolean ; 44 | sh:result [ 45 | rdf:type sh:ValidationResult ; 46 | sh:focusNode ex:Observation1 ; 47 | sh:resultPath ex:related ; 48 | sh:resultSeverity sh:Violation ; 49 | sh:sourceConstraintComponent sh:QualifiedMinCountConstraintComponent ; 50 | sh:sourceShape ex:APGARObservationShape-related ; 51 | ] ; 52 | ] ; 53 | . 54 | ex:Observation1 55 | rdf:type ex:Observation ; 56 | ex:related [ 57 | ex:related_target [ 58 | ex:reference ex:something ; 59 | ] ; 60 | ex:related_type "has-component"^^ex:code ; 61 | ] ; 62 | ex:related [ 63 | ex:related_target [ 64 | ex:reference ex:something ; 65 | ] ; 66 | ex:related_type "has-component"^^ex:code ; 67 | ] ; 68 | ex:related [ 69 | ex:related_target [ 70 | ex:reference ex:unrelated ; 71 | ] ; 72 | ex:related_type "has-component"^^ex:code ; 73 | ] ; 74 | sh:nodeShape ex:APGARObservationShape ; 75 | . 76 | -------------------------------------------------------------------------------- /test/data/core/property/qualifiedValueShapesDisjoint-001.test.ttl: -------------------------------------------------------------------------------- 1 | # baseURI: http://datashapes.org/sh/tests/core/property/qualifiedValueShapesDisjoint-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:qualifiedValueShapesDisjoint at property shape 001" ; 16 | owl:imports ; 17 | . 18 | ex:Finger 19 | rdf:type rdfs:Class ; 20 | rdf:type sh:NodeShape ; 21 | rdfs:label "Finger" ; 22 | rdfs:subClassOf rdfs:Resource ; 23 | . 24 | ex:Finger1 25 | rdf:type ex:Finger ; 26 | rdfs:label "Finger1" ; 27 | . 28 | ex:Finger2 29 | rdf:type ex:Finger ; 30 | rdfs:label "Finger2" ; 31 | . 32 | ex:Finger3 33 | rdf:type ex:Finger ; 34 | rdfs:label "Finger3" ; 35 | . 36 | ex:Finger4 37 | rdf:type ex:Finger ; 38 | rdfs:label "Finger4" ; 39 | . 40 | ex:FingerAndThumb 41 | rdf:type ex:Finger ; 42 | rdf:type ex:Thumb ; 43 | rdfs:label "Finger and thumb" ; 44 | . 45 | ex:GraphValidationTestCase 46 | rdf:type dash:GraphValidationTestCase ; 47 | dash:expectedResult [ 48 | rdf:type sh:ValidationReport ; 49 | sh:conforms "false"^^xsd:boolean ; 50 | sh:result [ 51 | rdf:type sh:ValidationResult ; 52 | sh:focusNode ex:InvalidHand1 ; 53 | sh:resultPath ex:digit ; 54 | sh:resultSeverity sh:Violation ; 55 | sh:sourceConstraintComponent sh:QualifiedMinCountConstraintComponent ; 56 | sh:sourceShape ex:HandShape-digit1 ; 57 | ] ; 58 | sh:result [ 59 | rdf:type sh:ValidationResult ; 60 | sh:focusNode ex:InvalidHand1 ; 61 | sh:resultPath ex:digit ; 62 | sh:resultSeverity sh:Violation ; 63 | sh:sourceConstraintComponent sh:QualifiedMinCountConstraintComponent ; 64 | sh:sourceShape ex:HandShape-digit4 ; 65 | ] ; 66 | ] ; 67 | . 68 | ex:Hand 69 | rdf:type rdfs:Class ; 70 | rdf:type sh:NodeShape ; 71 | rdfs:label "Hand" ; 72 | rdfs:subClassOf rdfs:Resource ; 73 | . 74 | ex:HandShape 75 | rdf:type sh:NodeShape ; 76 | sh:property ex:HandShape-digit1 ; 77 | sh:property ex:HandShape-digit4 ; 78 | sh:targetClass ex:Hand ; 79 | . 80 | ex:HandShape-digit1 81 | sh:path ex:digit ; 82 | sh:qualifiedMaxCount 1 ; 83 | sh:qualifiedMinCount 1 ; 84 | sh:qualifiedValueShape [ 85 | sh:class ex:Thumb ; 86 | ] ; 87 | sh:qualifiedValueShapesDisjoint true ; 88 | . 89 | ex:HandShape-digit4 90 | sh:path ex:digit ; 91 | sh:qualifiedMaxCount 4 ; 92 | sh:qualifiedMinCount 4 ; 93 | sh:qualifiedValueShape [ 94 | sh:class ex:Finger ; 95 | ] ; 96 | sh:qualifiedValueShapesDisjoint true ; 97 | . 98 | ex:InvalidHand1 99 | rdf:type ex:Hand ; 100 | ex:digit ex:Finger1 ; 101 | ex:digit ex:Finger2 ; 102 | ex:digit ex:Finger3 ; 103 | ex:digit ex:FingerAndThumb ; 104 | . 105 | ex:Thumb 106 | rdf:type rdfs:Class ; 107 | rdf:type sh:NodeShape ; 108 | rdfs:label "Thumb" ; 109 | rdfs:subClassOf rdfs:Resource ; 110 | . 111 | ex:Thumb1 112 | rdf:type ex:Thumb ; 113 | rdfs:label "Thumb1" ; 114 | . 115 | ex:ValidHand 116 | rdf:type ex:Hand ; 117 | ex:digit ex:Finger1 ; 118 | ex:digit ex:Finger2 ; 119 | ex:digit ex:Finger3 ; 120 | ex:digit ex:Finger4 ; 121 | ex:digit ex:Thumb1 ; 122 | rdfs:label "Valid hand" ; 123 | . 124 | -------------------------------------------------------------------------------- /test/data/core/property/uniqueLang-001.test.ttl: -------------------------------------------------------------------------------- 1 | # baseURI: http://datashapes.org/sh/tests/core/property/uniqueLang-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:uniqueLang at property 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:InvalidInstance1 ; 26 | sh:resultPath ex:testProperty ; 27 | sh:resultSeverity sh:Violation ; 28 | sh:sourceConstraintComponent sh:UniqueLangConstraintComponent ; 29 | sh:sourceShape ex:TestShape-testProperty ; 30 | ] ; 31 | sh:result [ 32 | rdf:type sh:ValidationResult ; 33 | sh:focusNode ex:InvalidInstance2 ; 34 | sh:resultPath ex:testProperty ; 35 | sh:resultSeverity sh:Violation ; 36 | sh:sourceConstraintComponent sh:UniqueLangConstraintComponent ; 37 | sh:sourceShape ex:TestShape-testProperty ; 38 | ] ; 39 | sh:result [ 40 | rdf:type sh:ValidationResult ; 41 | sh:focusNode ex:InvalidInstance2 ; 42 | sh:resultPath ex:testProperty ; 43 | sh:resultSeverity sh:Violation ; 44 | sh:sourceConstraintComponent sh:UniqueLangConstraintComponent ; 45 | sh:sourceShape ex:TestShape-testProperty ; 46 | ] ; 47 | ] ; 48 | . 49 | ex:InvalidInstance1 50 | rdf:type ex:TestShape ; 51 | ex:testProperty "Me" ; 52 | ex:testProperty "Me"@en ; 53 | ex:testProperty "Moi"@fr ; 54 | ex:testProperty "Myself"@en ; 55 | . 56 | ex:InvalidInstance2 57 | rdf:type ex:TestShape ; 58 | ex:testProperty "I"@en ; 59 | ex:testProperty "Ich"@de ; 60 | ex:testProperty "Me"@en ; 61 | ex:testProperty "Mich"@de ; 62 | ex:testProperty "Myself"@en ; 63 | . 64 | ex:TestShape 65 | rdf:type rdfs:Class ; 66 | rdf:type sh:NodeShape ; 67 | rdfs:label "Test shape" ; 68 | sh:property ex:TestShape-testProperty ; 69 | . 70 | ex:TestShape-testProperty 71 | sh:path ex:testProperty ; 72 | rdfs:label "test property" ; 73 | sh:uniqueLang "true"^^xsd:boolean ; 74 | . 75 | ex:ValidInstance1 76 | rdf:type ex:TestShape ; 77 | ex:testProperty "Me" ; 78 | ex:testProperty "Me"@en ; 79 | ex:testProperty "Moi"@fr ; 80 | ex:testProperty "Myself" ; 81 | . 82 | -------------------------------------------------------------------------------- /test/data/core/targets/multipleTargets-001.test.ttl: -------------------------------------------------------------------------------- 1 | # baseURI: http://datashapes.org/sh/tests/core/targets/multipleTargets-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 multiple targets 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:InConstraintComponent ; 29 | sh:sourceShape ex:TestShape ; 30 | sh:value ex:InvalidResource1 ; 31 | ] ; 32 | ] ; 33 | . 34 | ex:InvalidResource1 35 | ex:property1 "Also a value" ; 36 | . 37 | ex:TestShape 38 | rdf:type sh:NodeShape ; 39 | rdfs:label "Test shape" ; 40 | sh:in ( 41 | ex:ValidResource1 42 | ex:ValidResource2 43 | ) ; 44 | sh:targetSubjectsOf ex:property1 ; 45 | sh:targetSubjectsOf ex:property2 ; 46 | . 47 | ex:ValidResource1 48 | ex:property1 "Some value" ; 49 | . 50 | ex:ValidResource2 51 | ex:property2 "Other value" ; 52 | . 53 | -------------------------------------------------------------------------------- /test/data/core/targets/targetClass-001.test.ttl: -------------------------------------------------------------------------------- 1 | # baseURI: http://datashapes.org/sh/tests/core/targets/targetClass-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:targetClass 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:InvalidInstance1 ; 26 | sh:resultPath ex:myProperty ; 27 | sh:resultSeverity sh:Violation ; 28 | sh:sourceConstraintComponent sh:MaxCountConstraintComponent ; 29 | sh:sourceShape ex:MyShape-myProperty ; 30 | ] ; 31 | ] ; 32 | . 33 | ex:InvalidInstance1 34 | rdf:type ex:MyClass ; 35 | ex:myProperty "A" ; 36 | ex:myProperty "B" ; 37 | . 38 | ex:MyClass 39 | rdf:type rdfs:Class ; 40 | . 41 | ex:MyShape 42 | rdf:type sh:NodeShape ; 43 | sh:property ex:MyShape-myProperty ; 44 | sh:targetClass ex:MyClass ; 45 | . 46 | ex:MyShape-myProperty 47 | sh:path ex:myProperty ; 48 | sh:maxCount 1 ; 49 | . 50 | ex:ValidInstance1 51 | rdf:type ex:MyClass ; 52 | ex:myProperty "A" ; 53 | . 54 | ex:ValidInstance2 55 | ex:myProperty "A" ; 56 | ex:myProperty "B" ; 57 | . 58 | -------------------------------------------------------------------------------- /test/data/core/targets/targetClassImplicit-001.test.ttl: -------------------------------------------------------------------------------- 1 | # baseURI: http://datashapes.org/sh/tests/core/targets/targetClassImplicit-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 implicit sh:targetClass 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:SuperClass ; 30 | sh:value ex:InvalidInstance ; 31 | ] ; 32 | ] ; 33 | . 34 | ex:InvalidInstance 35 | rdf:type ex:SubClass ; 36 | rdfs:label "Invalid instance" ; 37 | . 38 | ex:SubClass 39 | rdf:type rdfs:Class ; 40 | rdfs:label "Sub class" ; 41 | rdfs:subClassOf ex:SuperClass ; 42 | . 43 | ex:SuperClass 44 | rdf:type rdfs:Class ; 45 | rdf:type sh:NodeShape ; 46 | rdfs:label "Super class" ; 47 | sh:in ( 48 | ex:ValidInstance 49 | ) ; 50 | . 51 | ex:ValidInstance 52 | rdf:type ex:SubClass ; 53 | rdfs:label "Valid instance" ; 54 | . 55 | -------------------------------------------------------------------------------- /test/data/core/targets/targetNode-001.test.ttl: -------------------------------------------------------------------------------- 1 | # baseURI: http://datashapes.org/sh/tests/core/targets/targetNode-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:targetNode 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:resultPath rdfs:label ; 27 | sh:resultSeverity sh:Violation ; 28 | sh:sourceConstraintComponent sh:MaxCountConstraintComponent ; 29 | sh:sourceShape ex:TestShape-label ; 30 | ] ; 31 | ] ; 32 | . 33 | ex:InvalidResource1 34 | rdf:type rdfs:Resource ; 35 | rdfs:label "Invalid resource 1" ; 36 | . 37 | ex:TestShape 38 | rdf:type sh:NodeShape ; 39 | rdfs:label "Test shape" ; 40 | sh:property ex:TestShape-label ; 41 | sh:targetNode ex:InvalidResource1 ; 42 | sh:targetNode ex:ValidResource1 ; 43 | . 44 | ex:TestShape-label 45 | sh:path rdfs:label ; 46 | rdfs:label "label" ; 47 | sh:datatype xsd:string ; 48 | sh:maxCount 0 ; 49 | . 50 | ex:ValidResource1 51 | rdf:type rdfs:Resource ; 52 | . 53 | -------------------------------------------------------------------------------- /test/data/core/targets/targetObjectsOf-001.test.ttl: -------------------------------------------------------------------------------- 1 | # baseURI: http://datashapes.org/sh/tests/core/targets/targetObjectsOf-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:targetObjectsOf 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:DatatypeConstraintComponent ; 28 | sh:sourceShape ex:TestShape ; 29 | sh:value rdfs:Resource ; 30 | ] ; 31 | sh:result [ 32 | rdf:type sh:ValidationResult ; 33 | sh:focusNode "String" ; 34 | sh:resultSeverity sh:Violation ; 35 | sh:sourceConstraintComponent sh:DatatypeConstraintComponent ; 36 | sh:sourceShape ex:TestShape ; 37 | sh:value "String" ; 38 | ] ; 39 | ] ; 40 | . 41 | ex:InvalidResource1 42 | ex:testProperty "String" ; 43 | . 44 | ex:InvalidResource2 45 | ex:testProperty rdfs:Resource ; 46 | . 47 | ex:TestShape 48 | rdf:type sh:NodeShape ; 49 | rdfs:label "Test shape" ; 50 | sh:datatype xsd:integer ; 51 | sh:targetObjectsOf ex:testProperty ; 52 | . 53 | ex:ValidResource1 54 | ex:testProperty 100 ; 55 | ex:testProperty 42 ; 56 | . 57 | ex:testProperty 58 | rdf:type rdf:Property ; 59 | rdfs:label "test property" ; 60 | . 61 | -------------------------------------------------------------------------------- /test/data/core/targets/targetSubjectsOf-001.test.ttl: -------------------------------------------------------------------------------- 1 | # baseURI: http://datashapes.org/sh/tests/core/targets/targetSubjectsOf-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 | ex:InvalidInstance1 14 | ex:myProperty "A" ; 15 | ex:myProperty "B" ; 16 | . 17 | ex:ValidInstance1 18 | ex:myProperty "A" ; 19 | . 20 | 21 | rdf:type owl:Ontology ; 22 | rdfs:label "Test of sh:targetSubjectsOf 001" ; 23 | owl:imports ; 24 | . 25 | ex:GraphValidationTestCase 26 | rdf:type dash:GraphValidationTestCase ; 27 | dash:expectedResult [ 28 | rdf:type sh:ValidationReport ; 29 | sh:conforms "false"^^xsd:boolean ; 30 | sh:result [ 31 | rdf:type sh:ValidationResult ; 32 | sh:focusNode ex:InvalidInstance1 ; 33 | sh:resultPath ex:myProperty ; 34 | sh:resultSeverity sh:Violation ; 35 | sh:sourceConstraintComponent sh:MaxCountConstraintComponent ; 36 | sh:sourceShape ex:TestShape-myProperty ; 37 | ] ; 38 | ] ; 39 | . 40 | ex:MyClass 41 | rdf:type rdfs:Class ; 42 | . 43 | ex:TestShape 44 | rdf:type sh:NodeShape ; 45 | sh:property ex:TestShape-myProperty ; 46 | sh:targetSubjectsOf ex:myProperty ; 47 | . 48 | ex:TestShape-myProperty 49 | a sh:PropertyShape ; 50 | sh:path ex:myProperty ; 51 | sh:maxCount 1 ; 52 | . 53 | -------------------------------------------------------------------------------- /test/data/core/targets/targetSubjectsOf-002.test.ttl: -------------------------------------------------------------------------------- 1 | # baseURI: http://datashapes.org/sh/tests/core/targets/targetSubjectsOf-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:targetSubjectsOf 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:InvalidInstance1 ; 26 | sh:resultPath ex:myProperty ; 27 | sh:resultSeverity sh:Violation ; 28 | sh:sourceConstraintComponent sh:MaxCountConstraintComponent ; 29 | sh:sourceShape ex:TestShape-myProperty ; 30 | ] ; 31 | sh:result [ 32 | rdf:type sh:ValidationResult ; 33 | sh:focusNode ex:InvalidInstance2 ; 34 | sh:resultPath ex:myProperty ; 35 | sh:resultSeverity sh:Violation ; 36 | sh:sourceConstraintComponent sh:MaxCountConstraintComponent ; 37 | sh:sourceShape ex:TestShape-myProperty ; 38 | ] ; 39 | ] ; 40 | . 41 | ex:InvalidInstance1 42 | rdf:type ex:MyClass ; 43 | ex:myProperty "A" ; 44 | ex:myProperty "B" ; 45 | . 46 | ex:InvalidInstance2 47 | ex:myProperty "A" ; 48 | ex:myProperty "B" ; 49 | . 50 | ex:MyClass 51 | rdf:type rdfs:Class ; 52 | . 53 | ex:TestShape 54 | rdf:type sh:NodeShape ; 55 | sh:property ex:TestShape-myProperty ; 56 | sh:targetClass ex:MyClass ; 57 | sh:targetSubjectsOf ex:myProperty ; 58 | . 59 | ex:TestShape-myProperty 60 | sh:path ex:myProperty ; 61 | sh:maxCount 1 ; 62 | . 63 | ex:ValidInstance1 64 | rdf:type ex:MyClass ; 65 | ex:myProperty "A" ; 66 | . 67 | ex:ValidInstance2 68 | ex:myProperty "A" ; 69 | . 70 | -------------------------------------------------------------------------------- /test/data/functionregistry/jsconstraintcomponent/data.ttl: -------------------------------------------------------------------------------- 1 | @prefix sh: . 2 | @prefix ex: . 3 | @prefix xsd: . 4 | @prefix rdfs: . 5 | 6 | ex:PropertyLengthShape 7 | a sh:NodeShape ; 8 | sh:targetClass ex:Data ; 9 | sh:property [ 10 | sh:path ex:prop ; 11 | ex:customMaxLength 3 12 | ] . 13 | 14 | ex:AlwaysValidShape 15 | a sh:NodeShape ; 16 | sh:targetClass ex:AlwaysValidData ; 17 | ex:constantValidation true . 18 | 19 | ex:AlwaysInvalidShape 20 | a sh:NodeShape ; 21 | sh:targetClass ex:AlwaysInvalidData ; 22 | ex:constantValidation false . 23 | 24 | 25 | 26 | ex:InvalidExample a ex:Data ; 27 | ex:prop "Wadus". 28 | 29 | ex:ValidExample a ex:Data ; 30 | ex:prop "foo" . 31 | 32 | ex:hey ex:p "now" . 33 | 34 | ex:InvalidExampleShape a ex:AlwaysInvalidData . 35 | 36 | ex:ValidExampleShape a ex:AlwaysValidData . 37 | 38 | 39 | 40 | ex:MaxLengthConstraintComponent 41 | a sh:ConstraintComponent ; 42 | sh:parameter [ 43 | sh:path ex:customMaxLength ; 44 | sh:datatype xsd:integer ; 45 | ] ; 46 | sh:validator ex:hasMaxLength . 47 | 48 | 49 | ex:ConstantValidConstraintComponent 50 | a sh:ConstraintComponent ; 51 | sh:parameter [ 52 | sh:path ex:constantValidation ; 53 | sh:datatype xsd:boolean ; 54 | ] ; 55 | sh:validator ex:constantValidator . 56 | 57 | ex:hasMaxLength 58 | a sh:JSValidator ; 59 | sh:message "Value has more than {$customMaxLength} characters" ; 60 | rdfs:comment """ 61 | Note that $value and $customMaxLength are RDF nodes expressed in JavaScript Objects. 62 | Their string value is accessed via the .lex and .uri attributes. 63 | The function returns true if no violation has been found. 64 | """ ; 65 | sh:jsLibrary [ sh:jsLibraryURL "http://example.org/ns/shapesConstraints.js"^^xsd:anyURI ] ; 66 | sh:jsFunctionName "hasMaxLength" . 67 | 68 | 69 | ex:constantValidator 70 | a sh:JSValidator ; 71 | sh:message "Shape is constantly valid {$constantValidation}" ; 72 | sh:jsLibrary [ sh:jsLibraryURL "http://example.org/ns/shapesConstraints.js"^^xsd:anyURI ] ; 73 | sh:jsFunctionName "constantValid" . 74 | -------------------------------------------------------------------------------- /test/data/functionregistry/jsconstraintcomponent/library.js: -------------------------------------------------------------------------------- 1 | function hasMaxLength($value, $customMaxLength) { 2 | if($value.isLiteral()) { 3 | return $value.lex.length <= $customMaxLength.lex; 4 | } 5 | else if($value.isURI()) { 6 | return $value.uri.length <= $customMaxLength.lex; 7 | } 8 | else { // Blank node 9 | return false; 10 | } 11 | } 12 | 13 | 14 | function constantValid($focusNode, $constantValidation) { 15 | return $constantValidation.lex === "true"; 16 | } 17 | -------------------------------------------------------------------------------- /test/function_registration_tests.js: -------------------------------------------------------------------------------- 1 | var SHACLValidator = require("../index"); 2 | var fs = require("fs"); 3 | 4 | var results = { 5 | "http://datashapes.org/sh/tests/functionregistry/jsconstraintcomponent/data#InvalidExample": { 6 | "path": "http://datashapes.org/sh/tests/functionregistry/jsconstraintcomponent/data#prop", 7 | "message": "Value has more than 3 characters" 8 | }, 9 | "http://datashapes.org/sh/tests/functionregistry/jsconstraintcomponent/data#InvalidExampleShape": { 10 | "message": "Shape is constantly valid false" 11 | } 12 | }; 13 | 14 | exports.functionRegistrationTest = function(test) { 15 | var validator = new SHACLValidator(); 16 | 17 | var url = "http://example.org/ns/shapesConstraints.js"; 18 | var localFile = __dirname + "/data/functionregistry/jsconstraintcomponent/library.js"; 19 | var data = fs.readFileSync(__dirname + "/data/functionregistry/jsconstraintcomponent/data.ttl").toString(); 20 | 21 | validator.registerJSLibrary(url, localFile, function(e) { 22 | test.ok(e == null); 23 | 24 | validator.validate(data, "text/turtle", data, "text/turtle", function (e, report) { 25 | test.ok(report.conforms() === false); 26 | test.ok(report.results().length === 2); 27 | report.results().forEach(function(result) { 28 | var expected = results[result.focusNode()]; 29 | test.ok(expected != null); 30 | test.ok(result.path() === expected.path); 31 | test.ok(result.message() === expected.message); 32 | }); 33 | test.done(); 34 | }); 35 | }); 36 | }; 37 | 38 | 39 | exports.functionCodeRegistrationTest = function(test) { 40 | var validator = new SHACLValidator(); 41 | 42 | var url = "http://example.org/ns/shapesConstraints.js"; 43 | var jsCode = fs.readFileSync(__dirname + "/data/functionregistry/jsconstraintcomponent/library.js").toString(); 44 | var data = fs.readFileSync(__dirname + "/data/functionregistry/jsconstraintcomponent/data.ttl").toString(); 45 | 46 | validator.registerJSCode(url, jsCode); 47 | validator.validate(data, "text/turtle", data, "text/turtle", function (e, report) { 48 | test.ok(report.conforms() === false); 49 | test.ok(report.results().length === 2); 50 | report.results().forEach(function(result) { 51 | var expected = results[result.focusNode()]; 52 | test.ok(expected != null); 53 | test.ok(result.path() === expected.path); 54 | test.ok(result.message() === expected.message); 55 | }); 56 | test.done(); 57 | }); 58 | }; -------------------------------------------------------------------------------- /test/inmemory_model_tests.js: -------------------------------------------------------------------------------- 1 | var SHACLValidator = require("../index"); 2 | var fs = require("fs"); 3 | 4 | var results = { 5 | "http://datashapes.org/sh/tests/functionregistry/jsconstraintcomponent/data#InvalidExample": { 6 | "path": "http://datashapes.org/sh/tests/functionregistry/jsconstraintcomponent/data#prop", 7 | "message": "Value has more than 3 characters" 8 | }, 9 | "http://datashapes.org/sh/tests/functionregistry/jsconstraintcomponent/data#InvalidExampleShape": { 10 | "message": "Shape is constantly valid false" 11 | } 12 | }; 13 | 14 | exports.loadFromMemoryModelTest = function(test) { 15 | var validator = new SHACLValidator(); 16 | 17 | 18 | var url = "http://example.org/ns/shapesConstraints.js"; 19 | var localFile = __dirname + "/data/functionregistry/jsconstraintcomponent/library.js"; 20 | var data = fs.readFileSync(__dirname + "/data/functionregistry/jsconstraintcomponent/data.ttl").toString(); 21 | 22 | var dataGraph = SHACLValidator.$rdf.graph(); 23 | var shapesGraph = SHACLValidator.$rdf.graph(); 24 | 25 | SHACLValidator.$rdf.parse(data, dataGraph, "test:graph", "text/turtle", function(e) { 26 | test.ok(e == null); 27 | SHACLValidator.$rdf.parse(data, shapesGraph, "test:graph", "text/turtle", function(e) { 28 | test.ok(e == null); 29 | validator.registerJSLibrary(url, localFile, function(e) { 30 | test.ok(e == null); 31 | validator.validateFromModels(dataGraph, shapesGraph, function (e, report) { 32 | test.ok(report.conforms() === false); 33 | test.ok(report.results().length === 2); 34 | report.results().forEach(function(result) { 35 | var expected = results[result.focusNode()]; 36 | test.ok(expected != null); 37 | test.ok(result.path() === expected.path); 38 | test.ok(result.message() === expected.message); 39 | }); 40 | test.done(); 41 | }); 42 | }); 43 | }); 44 | }); 45 | }; -------------------------------------------------------------------------------- /test/integration_tests.js: -------------------------------------------------------------------------------- 1 | var SHACLValidator = require("../index"); 2 | var fs = require("fs"); 3 | // expected result 4 | var $rdf = require("rdflib"); 5 | var rdflibgraph = require("../src/rdflib-graph"); 6 | var RDFLibGraph = rdflibgraph.RDFLibGraph; 7 | 8 | 9 | var ExpectedValidationResult = function(solution) { 10 | this._id = solution["report"].value; 11 | 12 | this._focusNode = solution["focusNode"].termType === "BlankNode" ? "_:" + solution["focusNode"].id : solution["focusNode"].value; 13 | this._severity = solution["severity"].value; 14 | this._constraint = solution["constraint"].value; 15 | this._shape = solution["shape"].value; 16 | }; 17 | 18 | ExpectedValidationResult.prototype.id = function() { 19 | return this._id; 20 | } 21 | 22 | ExpectedValidationResult.prototype.focusNode = function() { 23 | return this._focusNode; 24 | }; 25 | 26 | ExpectedValidationResult.prototype.severity = function() { 27 | if (this._severity != null) { 28 | return this._severity.split("#")[1]; 29 | } 30 | }; 31 | 32 | ExpectedValidationResult.prototype.sourceConstraintComponent = function() { 33 | return this._constraint; 34 | }; 35 | 36 | ExpectedValidationResult.prototype.sourceShape = function() { 37 | return this._shape 38 | }; 39 | 40 | 41 | var ExpectedValidationReport = function(graph) { 42 | this.graph = graph; 43 | }; 44 | 45 | ExpectedValidationReport.prototype.conforms = function() { 46 | var conforms = this.graph.query() 47 | .match("?report", "rdf:type", "sh:ValidationReport") 48 | .match("?report", "sh:conforms", "?conforms") 49 | .getNode("?conforms"); 50 | return conforms != null && conforms.value === "true" 51 | }; 52 | 53 | ExpectedValidationReport.prototype.results = function() { 54 | var acc = []; 55 | var query = this.graph.query() 56 | .match("?report", "sh:result", "?result") 57 | .match("?result", "sh:focusNode", "?focusNode") 58 | .match("?result", "sh:resultSeverity", "?severity") 59 | .match("?result", "sh:sourceConstraintComponent", "?constraint") 60 | .match("?result", "sh:sourceShape", "?shape"); 61 | var solution = query.nextSolution(); 62 | while (solution != null) { 63 | acc.push(new ExpectedValidationResult(solution)); 64 | solution = query.nextSolution(); 65 | } 66 | return acc; 67 | }; 68 | 69 | var expectedResult = function(data, mediaType, cb) { 70 | var graph = new RDFLibGraph(); 71 | graph.loadGraph(data, "http://test.com/example", mediaType, function() { 72 | var expectedValidationReport = new ExpectedValidationReport(graph); 73 | expectedValidationReport.results(); 74 | cb(expectedValidationReport, null); 75 | }, function(e) { 76 | cb(null, e); 77 | }); 78 | }; 79 | 80 | var isBlank = function(s) { 81 | return s != null && (s.indexOf("_:") === 0 || s.indexOf("_g_") > -1); 82 | } 83 | 84 | var validateReports = function(test, input) { 85 | var data = fs.readFileSync(input).toString(); 86 | 87 | expectedResult(data, "text/turtle", function(expectedReport, e) { 88 | if (e != null) { 89 | console.log(e); 90 | test.ok(e == null); 91 | test.done(); 92 | } else { 93 | new SHACLValidator().validate(data, "text/turtle", data, "text/turtle", function (e, report) { 94 | if (e != null) { 95 | console.log(e); 96 | test.ok(e == null); 97 | test.done(); 98 | } else { 99 | test.ok(report.conforms() === expectedReport.conforms()); 100 | test.ok(report.results().length === expectedReport.results().length); 101 | var results = report.results() || []; 102 | var expectedResults = expectedReport.results(); 103 | for (var i=0; i