shex 0.6.2 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +108 -97
- data/VERSION +1 -1
- data/etc/doap.ttl +1 -1
- data/lib/shex/algebra/and.rb +3 -12
- data/lib/shex/algebra/each_of.rb +2 -12
- data/lib/shex/algebra/import.rb +6 -0
- data/lib/shex/algebra/not.rb +3 -10
- data/lib/shex/algebra/one_of.rb +2 -12
- data/lib/shex/algebra/operator.rb +28 -15
- data/lib/shex/algebra/or.rb +3 -12
- data/lib/shex/algebra/schema.rb +2 -9
- data/lib/shex/algebra/shape.rb +4 -2
- data/lib/shex/algebra/shape_expression.rb +29 -0
- data/lib/shex/algebra/start.rb +2 -10
- data/lib/shex/algebra/stem.rb +5 -1
- data/lib/shex/algebra/stem_range.rb +3 -1
- data/lib/shex/algebra/triple_constraint.rb +1 -1
- data/lib/shex/algebra/triple_expression.rb +18 -0
- data/lib/shex/algebra.rb +0 -1
- data/lib/shex/meta.rb +325 -9859
- data/lib/shex/parser.rb +559 -474
- data/lib/shex/terminals.rb +5 -25
- data/lib/shex.rb +4 -1
- metadata +57 -23
@@ -102,7 +102,9 @@ module ShEx::Algebra
|
|
102
102
|
def match?(value, depth: 0)
|
103
103
|
initial_match = case operands.first
|
104
104
|
when :wildcard then true
|
105
|
-
when RDF::Literal
|
105
|
+
when RDF::Literal
|
106
|
+
value.language? &&
|
107
|
+
(operands.first.to_s.empty? || value.language.to_s.match?(%r(^#{operands.first}((-.*)?)$)))
|
106
108
|
else false
|
107
109
|
end
|
108
110
|
|
@@ -97,7 +97,7 @@ module ShEx::Algebra
|
|
97
97
|
ref.is_a?(ShapeExpression) ||
|
98
98
|
structure_error("#{json_type} must reference a ShapeExpression: #{ref}")
|
99
99
|
else
|
100
|
-
structure_error("#{json_type} must
|
100
|
+
structure_error("#{json_type} must be a ShapeExpression or reference: #{expresson.to_sxp}")
|
101
101
|
end
|
102
102
|
super
|
103
103
|
end
|
@@ -16,6 +16,24 @@ module ShEx::Algebra
|
|
16
16
|
raise NotImplementedError, "#matches Not implemented in #{self.class}"
|
17
17
|
end
|
18
18
|
|
19
|
+
##
|
20
|
+
# expressions must be TripleExpressions or references to TripleExpressions
|
21
|
+
#
|
22
|
+
# @raise [ShEx::StructureError] if the value is invalid
|
23
|
+
def validate_expressions!
|
24
|
+
expressions.each do |op|
|
25
|
+
case op
|
26
|
+
when TripleExpression
|
27
|
+
when RDF::Resource
|
28
|
+
ref = schema.find(op)
|
29
|
+
ref.is_a?(TripleExpression) ||
|
30
|
+
structure_error("#{json_type} must reference a TripleExpression: #{ref}")
|
31
|
+
else
|
32
|
+
structure_error("#{json_type} must be a TripleExpression or reference: #{op.to_sxp}")
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
19
37
|
##
|
20
38
|
# Included TripleConstraints
|
21
39
|
# @return [Array<TripleConstraints>]
|