Module: SHACL
- Defined in:
- lib/shacl.rb,
lib/shacl/format.rb,
lib/shacl/shapes.rb,
lib/shacl/algebra.rb,
lib/shacl/version.rb,
lib/shacl/validation_report.rb,
lib/shacl/validation_result.rb
Overview
A SHACL runtime for RDF.rb.
Defined Under Namespace
Modules: Algebra, Refinements, VERSION Classes: Error, Format, Shapes, StructureError, ValidationReport, ValidationResult
Class Method Summary collapse
-
.execute(input, queryable = nil, **options) ⇒ Hash{RDF::Term => Array<ValidationResult>}, SHACL::ValidationReport
The _Shapes Graph_, is established similar to the _Data Graph_, but may be ‘nil`.
-
.from_queryable(queryable, **options) ⇒ Object
Retrieve shapes from a sh:shapesGraph reference within queryable.
-
.get_shapes(shape_graph, **options) ⇒ Object
Transform the given _Shapes Graph_ into a set of executable shapes.
-
.open(input, **options) ⇒ Object
Parse a given resource into a _Shapes Graph_.
Class Method Details
.execute(input, queryable = nil, **options) ⇒ Hash{RDF::Term => Array<ValidationResult>}, SHACL::ValidationReport
The _Shapes Graph_, is established similar to the _Data Graph_, but may be ‘nil`. If `nil`, the _Data Graph_ may reference a _Shapes Graph_ thorugh an `sh:shapesGraph` property.
Additionally, a _Shapes Graph_ may contain an ‘owl:imports` property referencing additional _Shapes Graphs_, which are resolved until no more imports are found.
Load and validate the given SHACL ‘expression` string against `queriable`.
64 65 66 67 68 69 70 71 72 73 |
# File 'lib/shacl.rb', line 64 def self.execute(input, queryable = nil, **) queryable = queryable || RDF::Graph.new shapes = if input self.open(input, **) else Shapes.from_queryable(queryable) end shapes.execute(queryable, **) end |
.from_queryable(queryable, **options) ⇒ Object
Retrieve shapes from a sh:shapesGraph reference within queryable
47 48 49 |
# File 'lib/shacl.rb', line 47 def self.from_queryable(queryable, **) Shapes.from_queryable(queryable, **) end |
.get_shapes(shape_graph, **options) ⇒ Object
Transform the given _Shapes Graph_ into a set of executable shapes.
A _Shapes Graph_ may contain an ‘owl:imports` property referencing additional _Shapes Graphs_, which are resolved until no more imports are found.
24 25 26 |
# File 'lib/shacl.rb', line 24 def self.get_shapes(shape_graph, **) Shapes.from_graph(shape_graph, **) end |
.open(input, **options) ⇒ Object
Parse a given resource into a _Shapes Graph_.
35 36 37 38 |
# File 'lib/shacl.rb', line 35 def self.open(input, **) graph = RDF::Graph.load(input, **) self.get_shapes(graph, loaded_graphs: [RDF::URI(input, canonicalize: true)], **) end |