Sha256: aac4f536431fba6b0e93afe8a2f20a95bcdcf9b0e32612dd675feb4c2fab85c2
Contents?: true
Size: 766 Bytes
Versions: 4
Compression:
Stored size: 766 Bytes
Contents
module ShEx::Algebra ## class Annotation < Operator NAME = :annotation ## # Creates an operator instance from a parsed ShExJ representation # @param (see Operator#from_shexj) # @return [Operator] def self.from_shexj(operator, options = {}) raise ArgumentError unless operator.is_a?(Hash) && operator['type'] == "Annotation" raise ArgumentError, "missing predicate in #{operator.inspect}" unless operator.has_key?('predicate') raise ArgumentError, "missing object in #{operator.inspect}" unless operator.has_key?('object') super end def to_h { 'type' => json_type, 'predicate' => operands.first.last.to_s, 'object' => serialize_value(operands.last) } end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
shex-0.5.2 | lib/shex/algebra/annotation.rb |
shex-0.5.1 | lib/shex/algebra/annotation.rb |
shex-0.5.0 | lib/shex/algebra/annotation.rb |
shex-0.4.0 | lib/shex/algebra/annotation.rb |