Class: ShEx::Algebra::ShapeResult

Inherits:
Object
  • Object
show all
Defined in:
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:

  • label (RDF::Resource)


255
256
257
# File 'lib/shex/algebra/schema.rb', line 255

def initialize(shape)
  @shape = shape
end

Instance Attribute Details

#expressionShEx::Algebra::Operator

The annotated Operator indicating processing results



250
251
252
# File 'lib/shex/algebra/schema.rb', line 250

def expression
  @expression
end

#resultBoolean

Does the node conform to the shape

Returns:

  • (Boolean)


246
247
248
# File 'lib/shex/algebra/schema.rb', line 246

def result
  @result
end

#shapeRDF::Resource (readonly)

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

Returns:

  • (RDF::Resource)


242
243
244
# File 'lib/shex/algebra/schema.rb', line 242

def shape
  @shape
end

Instance Method Details

#reasonString

The SXP of #expression

Returns:

  • (String)


261
262
263
# File 'lib/shex/algebra/schema.rb', line 261

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

#to_sxp_binArray

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

Returns:

  • (Array)

See Also:



270
271
272
# File 'lib/shex/algebra/schema.rb', line 270

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