module SHACL::Algebra

Based on the SPARQL Algebra, operators for executing a patch

Public Class Methods

from_json(operator, **options) click to toggle source
# File lib/shacl/algebra.rb, line 19
def self.from_json(operator, **options)
  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, **options)
end