Class: ShEx::Algebra::ShapeResult

Inherits:
Object
  • Object
show all
Defined in:
vendor/bundler/ruby/3.3.0/bundler/gems/shex-f64040a493d0/lib/shex/algebra/schema.rb

Overview

A shape result

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(shape) ⇒ ShapeResult

Holds the result of processing a shape

Parameters:



248
249
250
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/shex-f64040a493d0/lib/shex/algebra/schema.rb', line 248

def initialize(shape)
  @shape = shape
end

Instance Attribute Details

#expressionShEx::Algebra::Operator

The annotated Operator indicating processing results



243
244
245
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/shex-f64040a493d0/lib/shex/algebra/schema.rb', line 243

def expression
  @expression
end

#resultBoolean

Does the node conform to the shape

Returns:

  • (Boolean)


239
240
241
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/shex-f64040a493d0/lib/shex/algebra/schema.rb', line 239

def result
  @result
end

#shapeRDF::Resource (readonly)

The label of the shape within the schema, or a URI indicating a start shape

Returns:



235
236
237
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/shex-f64040a493d0/lib/shex/algebra/schema.rb', line 235

def shape
  @shape
end

Instance Method Details

#reasonString

The SXP of #expression

Returns:



254
255
256
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/shex-f64040a493d0/lib/shex/algebra/schema.rb', line 254

def reason
  SXP::Generator.string(expression.to_sxp_bin)
end

#to_sxp_binArray

Returns the binary S-Expression (SXP) representation of this result.



263
264
265
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/shex-f64040a493d0/lib/shex/algebra/schema.rb', line 263

def to_sxp_bin
  [:ShapeResult, shape, result, expression].map(&:to_sxp_bin)
end