Module: ShEx::Algebra

Defined in:
vendor/bundler/ruby/3.3.0/bundler/gems/shex-f64040a493d0/lib/shex/algebra.rb,
vendor/bundler/ruby/3.3.0/bundler/gems/shex-f64040a493d0/lib/shex/algebra/or.rb,
vendor/bundler/ruby/3.3.0/bundler/gems/shex-f64040a493d0/lib/shex/algebra/and.rb,
vendor/bundler/ruby/3.3.0/bundler/gems/shex-f64040a493d0/lib/shex/algebra/not.rb,
vendor/bundler/ruby/3.3.0/bundler/gems/shex-f64040a493d0/lib/shex/algebra/stem.rb,
vendor/bundler/ruby/3.3.0/bundler/gems/shex-f64040a493d0/lib/shex/algebra/shape.rb,
vendor/bundler/ruby/3.3.0/bundler/gems/shex-f64040a493d0/lib/shex/algebra/start.rb,
vendor/bundler/ruby/3.3.0/bundler/gems/shex-f64040a493d0/lib/shex/algebra/value.rb,
vendor/bundler/ruby/3.3.0/bundler/gems/shex-f64040a493d0/lib/shex/algebra/import.rb,
vendor/bundler/ruby/3.3.0/bundler/gems/shex-f64040a493d0/lib/shex/algebra/one_of.rb,
vendor/bundler/ruby/3.3.0/bundler/gems/shex-f64040a493d0/lib/shex/algebra/schema.rb,
vendor/bundler/ruby/3.3.0/bundler/gems/shex-f64040a493d0/lib/shex/algebra/semact.rb,
vendor/bundler/ruby/3.3.0/bundler/gems/shex-f64040a493d0/lib/shex/algebra/each_of.rb,
vendor/bundler/ruby/3.3.0/bundler/gems/shex-f64040a493d0/lib/shex/algebra/external.rb,
vendor/bundler/ruby/3.3.0/bundler/gems/shex-f64040a493d0/lib/shex/algebra/language.rb,
vendor/bundler/ruby/3.3.0/bundler/gems/shex-f64040a493d0/lib/shex/algebra/operator.rb,
vendor/bundler/ruby/3.3.0/bundler/gems/shex-f64040a493d0/lib/shex/algebra/annotation.rb,
vendor/bundler/ruby/3.3.0/bundler/gems/shex-f64040a493d0/lib/shex/algebra/stem_range.rb,
vendor/bundler/ruby/3.3.0/bundler/gems/shex-f64040a493d0/lib/shex/algebra/node_constraint.rb,
vendor/bundler/ruby/3.3.0/bundler/gems/shex-f64040a493d0/lib/shex/algebra/shape_expression.rb,
vendor/bundler/ruby/3.3.0/bundler/gems/shex-f64040a493d0/lib/shex/algebra/triple_constraint.rb,
vendor/bundler/ruby/3.3.0/bundler/gems/shex-f64040a493d0/lib/shex/algebra/triple_expression.rb

Overview

Based on the SPARQL Algebra, operators for executing a patch

Author:

Defined Under Namespace

Modules: ReferencedStatement, ShapeExpression, TripleExpression Classes: And, Annotation, EachOf, External, Import, IriStem, IriStemRange, Language, LanguageStem, LanguageStemRange, LiteralStem, LiteralStemRange, NodeConstraint, Not, OneOf, Operator, Or, Schema, SemAct, Shape, ShapeResult, Start, Stem, StemRange, TripleConstraint, Value

Class Method Summary collapse

Class Method Details

.from_shexj(operator, **options) ⇒ Operator

Creates an operator instance from a parsed ShExJ representation

Examples:

Simple TripleConstraint

rep = JSON.parse(%({
        "type": "TripleConstraint",
        "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
      }
))
TripleConstraint.from(rep) #=> (tripleConstraint a)

Parameters:

  • operator (Hash)
  • options (Hash)

    ({})

Options Hash (**options):

Returns:

Raises:

  • (ArgumentError)


52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/shex-f64040a493d0/lib/shex/algebra.rb', line 52

def self.from_shexj(operator, **options)
  raise ArgumentError unless operator.is_a?(Hash)
  klass = case operator['type']
  when 'Annotation'         then Annotation
  when 'EachOf'             then EachOf
  when 'IriStem'            then IriStem
  when 'IriStemRange'       then IriStemRange
  when 'Language'           then Language
  when 'LanguageStem'       then LanguageStem
  when 'LanguageStemRange'  then LanguageStemRange
  when 'LiteralStem'        then LiteralStem
  when 'LiteralStemRange'   then LiteralStemRange
  when 'NodeConstraint'     then NodeConstraint
  when 'OneOf'              then OneOf
  when 'Schema'             then Schema
  when 'SemAct'             then SemAct
  when 'Shape'              then Shape
  when 'ShapeAnd'           then And
  when 'ShapeExternal'      then External
  when 'ShapeNot'           then Not
  when 'ShapeOr'            then Or
  when 'TripleConstraint'   then TripleConstraint
  when 'Wildcard'           then StemRange
  else raise ArgumentError, "unknown type #{operator['type'].inspect}"
  end

  klass.from_shexj(operator, **options)
end