Module: SHACL::Algebra
- Defined in:
- lib/shacl/algebra.rb,
lib/shacl/algebra/or.rb,
lib/shacl/algebra/and.rb,
lib/shacl/algebra/not.rb,
lib/shacl/algebra/xone.rb,
lib/shacl/algebra/shape.rb,
lib/shacl/algebra/pattern.rb,
lib/shacl/algebra/operator.rb,
lib/shacl/algebra/node_shape.rb,
lib/shacl/algebra/property_shape.rb,
lib/shacl/algebra/qualified_value.rb,
lib/shacl/algebra/sparql_constraint.rb,
lib/shacl/algebra/constraint_component.rb
Overview
Based on the SPARQL Algebra, operators for executing a patch
Defined Under Namespace
Classes: AndConstraintComponent, ConstraintComponent, NodeShape, NotConstraintComponent, Operator, OrConstraintComponent, PatternConstraintComponent, PropertyShape, QualifiedValueConstraintComponent, SPARQLConstraintComponent, Shape, XoneConstraintComponent
Class Method Summary collapse
Class Method Details
.from_json(operator, **options) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/shacl/algebra.rb', line 22 def self.from_json(operator, **) raise SHACL::Error, "from_json: operator not a Hash: #{operator.inspect}" unless operator.is_a?(Hash) # If operator is a hash containing @list, it is a single array value. # Note: context does not use @container: @list on this terms to preserve cardinality expectations return operator['@list'].map {|e| from_json(e, **)} if operator.key?('@list') type = operator.fetch('type', []) if type.empty? type << if operator["path"] 'PropertyShape' elsif operator['nodeValidator'] || operator['propertyValidator'] || operator['validator'] 'ConstraintComponent' else 'NodeShape' end end klass = case when type.include?('NodeShape') then NodeShape when type.include?('PropertyShape') then PropertyShape when type.include?('ConstraintComponent') then ConstraintComponent else raise SHACL::Error, "from_json: unknown type #{type.inspect}" end klass.from_json(operator, **) end |