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/operator.rb,
lib/shacl/algebra/node_shape.rb,
lib/shacl/algebra/property_shape.rb,
lib/shacl/algebra/qualified_value_shape.rb
Overview
Based on the SPARQL Algebra, operators for executing a patch
Defined Under Namespace
Classes: And, NodeShape, Not, Operator, Or, PropertyShape, QualifiedValueShape, Shape, Xone
Class Method Summary collapse
Class Method Details
.from_json(operator, **options) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/shacl/algebra.rb', line 19 def self.from_json(operator, **) raise ArgumentError, "from_json: operator not a Hash: #{operator.inspect}" unless operator.is_a?(Hash) type = operator.fetch('type', []) type << (operator["path"] ? 'PropertyShape' : 'NodeShape') if type.empty? klass = case when type.include?('NodeShape') then NodeShape when type.include?('PropertyShape') then PropertyShape else raise ArgumentError, "from_json: unknown type #{type.inspect}" end klass.from_json(operator, **) end |