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:

  • shape (RDF::Resource)


248
249
250
# File '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 '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 '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:

  • (RDF::Resource)


235
236
237
# File 'lib/shex/algebra/schema.rb', line 235

def shape
  @shape
end

Instance Method Details

#reasonString

The SXP of #expression

Returns:

  • (String)


254
255
256
# File '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.

Returns:

  • (Array)

See Also:



263
264
265
# File 'lib/shex/algebra/schema.rb', line 263

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