Comments (2)
Hello Marco,
You are a live-safer, this is exactly what I was looking for.
Thanks for the very quick response and good example how to connect this. I never considered that "RDFPropertyConstraint" is used for this.
I do hope that we can contribute further, we will continue to use the library and post questions that we find or oddities that we notice.
Best Regards
Stephan
from rdfsharp.
Hi Stephan,
here is an implementation of the example turtle file showing usage of constraints and targets:
var shapesGraph = new RDFShapesGraph();
var nodeShape = new RDFNodeShape(new RDFResource("ex:PersonShape"));
nodeShape.AddTarget(new RDFTargetClass(new RDFResource("ex:Person")));
nodeShape.AddConstraint(new RDFPropertyConstraint(new RDFResource("ex:PropertyShapeSSN")));
nodeShape.AddConstraint(new RDFPropertyConstraint(new RDFResource("ex:PropertyShapeWorksFor")));
nodeShape.AddConstraint(new RDFClosedConstraint(true).AddIgnoredProperty(RDFVocabulary.RDF.TYPE));
var propertyShapeSSN = new RDFPropertyShape(new RDFResource("ex:PropertyShapeSSN"), new RDFResource("ex:ssn"));
propertyShapeSSN.AddConstraint(new RDFMaxCountConstraint(1));
propertyShapeSSN.AddConstraint(new RDFDatatypeConstraint(RDFModelEnums.RDFDatatypes.XSD_STRING));
propertyShapeSSN.AddConstraint(new RDFPatternConstraint(new Regex("^\\d{3}-\\d{2}-\\d{4}$")));
var PropertyShapeWorksFor = new RDFPropertyShape(new RDFResource("ex:PropertyShapeWorksFor"), new RDFResource("ex:worksFor"));
PropertyShapeWorksFor.AddConstraint(new RDFClassConstraint(new RDFResource("ex:Company")));
PropertyShapeWorksFor.AddConstraint(new RDFNodeKindConstraint(RDFValidationEnums.RDFNodeKinds.IRI));
shapesGraph.AddShape(nodeShape);
shapesGraph.AddShape(propertyShapeSSN);
shapesGraph.AddShape(PropertyShapeWorksFor);
It is of course possible to contribute to the library: posting questions, signalling issues, requesting new capabilities, also submitting PRs for targeting bugs or delivering new features.
Let me know if this coding example clarifies your doubts about usage of the library.
Regards,
marco
from rdfsharp.
Related Issues (20)
- Design bottlenecks in RDFStore due to internals visibility
- [BUG] Validating `sh:path` containing `sh:inversePath` not working. HOT 3
- [BUG] Validation of `sh:path` with `sh:alternativePath` not working per the SHACL spec HOT 4
- Provide support for sh:path in form of sequential property path HOT 1
- [BUG] RDF/XML elements with `rdf:ID` sets subject URI improperly. HOT 2
- Add support for flagging triples coming from inference processes
- IsInference information lost when compressing to IndexedTriple
- Make stores expose QuadruplesCount
- Provide validation for GeoSPARQL typed literals HOT 1
- Generalize semantic metadata of triples HOT 1
- Inequality "rdf:type" and turtle "a" HOT 2
- Add support for SPARQL BNODE() expression
- Add support for SPARQL SERVICE
- Crash in evaluation of DESCRIBE queries having blank terms
- Add ability to POST SPARQL queries to endpoints
- Add ability to give options to SPARQL endpoints in federations
- Add support for language tags with "--ltr" and "--rtl" direction
- Add support for executing expressions as filters
- Extend XSD vocabulary with facet terms
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rdfsharp.