diff --git a/query/linkedql/registry_test.go b/query/linkedql/registry_test.go index eec949a75..a385d4eef 100644 --- a/query/linkedql/registry_test.go +++ b/query/linkedql/registry_test.go @@ -93,7 +93,7 @@ var unmarshalCases = []struct { type TestStep struct { Limit int `json:"limit"` Tags []string `json:"tags"` - From PathStep `json:"from"` + From PathStep `json:"from" minCardinality:"0"` Sub []PathStep `json:"sub"` } diff --git a/query/linkedql/steps/as.go b/query/linkedql/steps/as.go index 63642ccd9..919538d90 100644 --- a/query/linkedql/steps/as.go +++ b/query/linkedql/steps/as.go @@ -17,7 +17,7 @@ var _ linkedql.PathStep = (*As)(nil) // As corresponds to .tag(). type As struct { - From linkedql.PathStep `json:"from"` + From linkedql.PathStep `json:"from" minCardinality:"0"` Name string `json:"name"` } diff --git a/query/linkedql/steps/back.go b/query/linkedql/steps/back.go index ced6360a6..6c5753db2 100644 --- a/query/linkedql/steps/back.go +++ b/query/linkedql/steps/back.go @@ -17,7 +17,7 @@ var _ linkedql.PathStep = (*Back)(nil) // Back corresponds to .back(). type Back struct { - From linkedql.PathStep `json:"from"` + From linkedql.PathStep `json:"from" minCardinality:"0"` Name string `json:"name"` } diff --git a/query/linkedql/steps/both.go b/query/linkedql/steps/both.go index 2d0d33c35..9fe1fb2d5 100644 --- a/query/linkedql/steps/both.go +++ b/query/linkedql/steps/both.go @@ -17,7 +17,7 @@ var _ linkedql.PathStep = (*Both)(nil) // Both corresponds to .both(). type Both struct { - From linkedql.PathStep `json:"from"` + From linkedql.PathStep `json:"from" minCardinality:"0"` Properties linkedql.PropertyPath `json:"properties"` } diff --git a/query/linkedql/steps/context.go b/query/linkedql/steps/context.go index 7384d04b1..02361d709 100644 --- a/query/linkedql/steps/context.go +++ b/query/linkedql/steps/context.go @@ -17,7 +17,7 @@ var _ linkedql.PathStep = (*Context)(nil) // Context corresponds to context(). type Context struct { - From linkedql.PathStep `json:"from"` + From linkedql.PathStep `json:"from" minCardinality:"0"` Rules map[string]string `json:"rules"` } diff --git a/query/linkedql/steps/count.go b/query/linkedql/steps/count.go index 33c378e6e..2cc2efc5f 100644 --- a/query/linkedql/steps/count.go +++ b/query/linkedql/steps/count.go @@ -17,7 +17,7 @@ var _ linkedql.PathStep = (*Count)(nil) // Count corresponds to .count(). type Count struct { - From linkedql.PathStep `json:"from"` + From linkedql.PathStep `json:"from" minCardinality:"0"` } // Description implements Step. diff --git a/query/linkedql/steps/difference.go b/query/linkedql/steps/difference.go index e4d10c14f..3d9811519 100644 --- a/query/linkedql/steps/difference.go +++ b/query/linkedql/steps/difference.go @@ -17,7 +17,7 @@ var _ linkedql.PathStep = (*Difference)(nil) // Difference corresponds to .difference(). type Difference struct { - From linkedql.PathStep `json:"from"` + From linkedql.PathStep `json:"from" minCardinality:"0"` Steps []linkedql.PathStep `json:"steps"` } diff --git a/query/linkedql/steps/filter.go b/query/linkedql/steps/filter.go index 985094f19..9267b6891 100644 --- a/query/linkedql/steps/filter.go +++ b/query/linkedql/steps/filter.go @@ -17,7 +17,7 @@ var _ linkedql.PathStep = (*Filter)(nil) // Filter corresponds to filter(). type Filter struct { - From linkedql.PathStep `json:"from"` + From linkedql.PathStep `json:"from" minCardinality:"0"` Filter linkedql.Operator `json:"filter"` } diff --git a/query/linkedql/steps/follow.go b/query/linkedql/steps/follow.go index 90b27a2de..1a644b9de 100644 --- a/query/linkedql/steps/follow.go +++ b/query/linkedql/steps/follow.go @@ -17,7 +17,7 @@ var _ linkedql.PathStep = (*Follow)(nil) // Follow corresponds to .follow(). type Follow struct { - From linkedql.PathStep `json:"from"` + From linkedql.PathStep `json:"from" minCardinality:"0"` Followed linkedql.PathStep `json:"followed"` } diff --git a/query/linkedql/steps/follow_reverse.go b/query/linkedql/steps/follow_reverse.go index 6e601c0b5..1026d4e1c 100644 --- a/query/linkedql/steps/follow_reverse.go +++ b/query/linkedql/steps/follow_reverse.go @@ -17,7 +17,7 @@ var _ linkedql.PathStep = (*FollowReverse)(nil) // FollowReverse corresponds to .followR(). type FollowReverse struct { - From linkedql.PathStep `json:"from"` + From linkedql.PathStep `json:"from" minCardinality:"0"` Followed linkedql.PathStep `json:"followed"` } diff --git a/query/linkedql/steps/greater_than.go b/query/linkedql/steps/greater_than.go index 20d7e9ecf..f1f69a395 100644 --- a/query/linkedql/steps/greater_than.go +++ b/query/linkedql/steps/greater_than.go @@ -19,7 +19,7 @@ var _ linkedql.PathStep = (*GreaterThan)(nil) // GreaterThan corresponds to gt(). type GreaterThan struct { - From linkedql.PathStep `json:"from"` + From linkedql.PathStep `json:"from" minCardinality:"0"` Value quad.Value `json:"value"` } diff --git a/query/linkedql/steps/greater_than_equals.go b/query/linkedql/steps/greater_than_equals.go index fb81c8c77..c51d540b1 100644 --- a/query/linkedql/steps/greater_than_equals.go +++ b/query/linkedql/steps/greater_than_equals.go @@ -19,7 +19,7 @@ var _ linkedql.PathStep = (*GreaterThanEquals)(nil) // GreaterThanEquals corresponds to gte(). type GreaterThanEquals struct { - From linkedql.PathStep `json:"from"` + From linkedql.PathStep `json:"from" minCardinality:"0"` Value quad.Value `json:"value"` } diff --git a/query/linkedql/steps/has.go b/query/linkedql/steps/has.go index 683889c6f..2066dd47c 100644 --- a/query/linkedql/steps/has.go +++ b/query/linkedql/steps/has.go @@ -18,7 +18,7 @@ var _ linkedql.PathStep = (*Has)(nil) // Has corresponds to .has(). type Has struct { - From linkedql.PathStep `json:"from"` + From linkedql.PathStep `json:"from" minCardinality:"0"` Property linkedql.PropertyPath `json:"property"` Values []quad.Value `json:"values"` } diff --git a/query/linkedql/steps/has_reverse.go b/query/linkedql/steps/has_reverse.go index 5ae1fae48..56fe37dd4 100644 --- a/query/linkedql/steps/has_reverse.go +++ b/query/linkedql/steps/has_reverse.go @@ -18,7 +18,7 @@ var _ linkedql.PathStep = (*HasReverse)(nil) // HasReverse corresponds to .hasR(). type HasReverse struct { - From linkedql.PathStep `json:"from"` + From linkedql.PathStep `json:"from" minCardinality:"0"` Property linkedql.PropertyPath `json:"property"` Values []quad.Value `json:"values"` } diff --git a/query/linkedql/steps/intersect.go b/query/linkedql/steps/intersect.go index 69ad75246..f80dea39b 100644 --- a/query/linkedql/steps/intersect.go +++ b/query/linkedql/steps/intersect.go @@ -17,7 +17,7 @@ var _ linkedql.PathStep = (*Intersect)(nil) // Intersect represents .intersect() and .and(). type Intersect struct { - From linkedql.PathStep `json:"from"` + From linkedql.PathStep `json:"from" minCardinality:"0"` Steps []linkedql.PathStep `json:"steps"` } diff --git a/query/linkedql/steps/is.go b/query/linkedql/steps/is.go index 31ab8f284..c59353adf 100644 --- a/query/linkedql/steps/is.go +++ b/query/linkedql/steps/is.go @@ -18,7 +18,7 @@ var _ linkedql.PathStep = (*Is)(nil) // Is corresponds to .back(). type Is struct { - From linkedql.PathStep `json:"from"` + From linkedql.PathStep `json:"from" minCardinality:"0"` Values []quad.Value `json:"values"` } diff --git a/query/linkedql/steps/labels.go b/query/linkedql/steps/labels.go index 51979ff7b..409b25813 100644 --- a/query/linkedql/steps/labels.go +++ b/query/linkedql/steps/labels.go @@ -17,7 +17,7 @@ var _ linkedql.PathStep = (*Labels)(nil) // Labels corresponds to .labels(). type Labels struct { - From linkedql.PathStep `json:"from"` + From linkedql.PathStep `json:"from" minCardinality:"0"` } // Description implements Step. diff --git a/query/linkedql/steps/less_than.go b/query/linkedql/steps/less_than.go index 395544990..bfbf87d9b 100644 --- a/query/linkedql/steps/less_than.go +++ b/query/linkedql/steps/less_than.go @@ -1,14 +1,13 @@ - package steps import ( "github.com/cayleygraph/cayley/graph" "github.com/cayleygraph/cayley/graph/iterator" "github.com/cayleygraph/cayley/query" + "github.com/cayleygraph/cayley/query/linkedql" "github.com/cayleygraph/cayley/query/path" "github.com/cayleygraph/quad" "github.com/cayleygraph/quad/voc" - "github.com/cayleygraph/cayley/query/linkedql" ) func init() { @@ -20,13 +19,10 @@ var _ linkedql.PathStep = (*LessThan)(nil) // LessThan corresponds to lt(). type LessThan struct { - From linkedql.PathStep `json:"from"` - Value quad.Value `json:"value"` + From linkedql.PathStep `json:"from" minCardinality:"0"` + Value quad.Value `json:"value"` } - - - // Description implements Step. func (s *LessThan) Description() string { return "Less than filters out values that are not less than given value" @@ -45,4 +41,3 @@ func (s *LessThan) BuildPath(qs graph.QuadStore, ns *voc.Namespaces) (*path.Path } return fromPath.Filter(iterator.CompareLT, s.Value), nil } - diff --git a/query/linkedql/steps/less_than_equals.go b/query/linkedql/steps/less_than_equals.go index c994cc8b5..b33d8d8ec 100644 --- a/query/linkedql/steps/less_than_equals.go +++ b/query/linkedql/steps/less_than_equals.go @@ -19,7 +19,7 @@ var _ linkedql.PathStep = (*LessThanEquals)(nil) // LessThanEquals corresponds to lte(). type LessThanEquals struct { - From linkedql.PathStep `json:"from"` + From linkedql.PathStep `json:"from" minCardinality:"0"` Value quad.Value `json:"value"` } diff --git a/query/linkedql/steps/limit.go b/query/linkedql/steps/limit.go index 88b5ec630..e727ae450 100644 --- a/query/linkedql/steps/limit.go +++ b/query/linkedql/steps/limit.go @@ -17,7 +17,7 @@ var _ linkedql.PathStep = (*Limit)(nil) // Limit corresponds to .limit(). type Limit struct { - From linkedql.PathStep `json:"from"` + From linkedql.PathStep `json:"from" minCardinality:"0"` Limit int64 `json:"limit"` } diff --git a/query/linkedql/steps/optional.go b/query/linkedql/steps/optional.go index 0fe2fab8b..460179c8e 100644 --- a/query/linkedql/steps/optional.go +++ b/query/linkedql/steps/optional.go @@ -17,7 +17,7 @@ var _ linkedql.PathStep = (*Optional)(nil) // Optional corresponds to .optional(). type Optional struct { - From linkedql.PathStep `json:"from"` + From linkedql.PathStep `json:"from" minCardinality:"0"` Step linkedql.PathStep `json:"step"` } diff --git a/query/linkedql/steps/order.go b/query/linkedql/steps/order.go index 8e8824036..ce0591a79 100644 --- a/query/linkedql/steps/order.go +++ b/query/linkedql/steps/order.go @@ -17,7 +17,7 @@ var _ linkedql.PathStep = (*Order)(nil) // Order corresponds to .order(). type Order struct { - From linkedql.PathStep `json:"from"` + From linkedql.PathStep `json:"from" minCardinality:"0"` } // Description implements Step. diff --git a/query/linkedql/steps/properties.go b/query/linkedql/steps/properties.go index beb6c0959..ef9a1a469 100644 --- a/query/linkedql/steps/properties.go +++ b/query/linkedql/steps/properties.go @@ -18,7 +18,7 @@ var _ linkedql.PathStep = (*Properties)(nil) // Properties corresponds to .properties(). type Properties struct { - From linkedql.PathStep `json:"from"` + From linkedql.PathStep `json:"from" minCardinality:"0"` // TODO(iddan): Use linkedql.PropertyPath Names []quad.IRI `json:"names"` } diff --git a/query/linkedql/steps/property_names.go b/query/linkedql/steps/property_names.go index f2abce564..5d7667d2c 100644 --- a/query/linkedql/steps/property_names.go +++ b/query/linkedql/steps/property_names.go @@ -17,7 +17,7 @@ var _ linkedql.PathStep = (*PropertyNames)(nil) // PropertyNames corresponds to .propertyNames(). type PropertyNames struct { - From linkedql.PathStep `json:"from"` + From linkedql.PathStep `json:"from" minCardinality:"0"` } // Description implements Step. diff --git a/query/linkedql/steps/property_names_as.go b/query/linkedql/steps/property_names_as.go index 5f30ce40f..505993be2 100644 --- a/query/linkedql/steps/property_names_as.go +++ b/query/linkedql/steps/property_names_as.go @@ -17,7 +17,7 @@ var _ linkedql.PathStep = (*PropertyNamesAs)(nil) // PropertyNamesAs corresponds to .propertyNamesAs(). type PropertyNamesAs struct { - From linkedql.PathStep `json:"from"` + From linkedql.PathStep `json:"from" minCardinality:"0"` Tag string `json:"tag"` } diff --git a/query/linkedql/steps/reverse_properties.go b/query/linkedql/steps/reverse_properties.go index 275b7f72c..c27f84619 100644 --- a/query/linkedql/steps/reverse_properties.go +++ b/query/linkedql/steps/reverse_properties.go @@ -18,7 +18,7 @@ var _ linkedql.PathStep = (*ReverseProperties)(nil) // ReverseProperties corresponds to .reverseProperties(). type ReverseProperties struct { - From linkedql.PathStep `json:"from"` + From linkedql.PathStep `json:"from" minCardinality:"0"` // TODO(iddan): Use property path Names []quad.IRI `json:"names"` } diff --git a/query/linkedql/steps/reverse_property_names.go b/query/linkedql/steps/reverse_property_names.go index d107d0587..11542308c 100644 --- a/query/linkedql/steps/reverse_property_names.go +++ b/query/linkedql/steps/reverse_property_names.go @@ -17,7 +17,7 @@ var _ linkedql.PathStep = (*ReversePropertyNames)(nil) // ReversePropertyNames corresponds to .reversePropertyNames(). type ReversePropertyNames struct { - From linkedql.PathStep `json:"from"` + From linkedql.PathStep `json:"from" minCardinality:"0"` } // Description implements Step. diff --git a/query/linkedql/steps/reverse_property_names_as.go b/query/linkedql/steps/reverse_property_names_as.go index a44a568ce..733982f32 100644 --- a/query/linkedql/steps/reverse_property_names_as.go +++ b/query/linkedql/steps/reverse_property_names_as.go @@ -17,7 +17,7 @@ var _ linkedql.PathStep = (*ReversePropertyNamesAs)(nil) // ReversePropertyNamesAs corresponds to .reversePropertyNamesAs(). type ReversePropertyNamesAs struct { - From linkedql.PathStep `json:"from"` + From linkedql.PathStep `json:"from" minCardinality:"0"` Tag string `json:"tag"` } diff --git a/query/linkedql/steps/skip.go b/query/linkedql/steps/skip.go index 8c47195c9..8cbbf8206 100644 --- a/query/linkedql/steps/skip.go +++ b/query/linkedql/steps/skip.go @@ -17,7 +17,7 @@ var _ linkedql.PathStep = (*Skip)(nil) // Skip corresponds to .skip(). type Skip struct { - From linkedql.PathStep `json:"from"` + From linkedql.PathStep `json:"from" minCardinality:"0"` Offset int64 `json:"offset"` } diff --git a/query/linkedql/steps/steps_final.go b/query/linkedql/steps/steps_final.go index 166600a7d..26f9a6d75 100644 --- a/query/linkedql/steps/steps_final.go +++ b/query/linkedql/steps/steps_final.go @@ -19,7 +19,7 @@ var _ linkedql.IteratorStep = (*Select)(nil) // Select corresponds to .select(). type Select struct { Tags []string `json:"tags"` - From linkedql.PathStep `json:"from"` + From linkedql.PathStep `json:"from" minCardinality:"0"` } // Description implements Step. @@ -41,7 +41,7 @@ var _ linkedql.IteratorStep = (*SelectFirst)(nil) // SelectFirst corresponds to .selectFirst(). type SelectFirst struct { Tags []string `json:"tags"` - From linkedql.PathStep `json:"from"` + From linkedql.PathStep `json:"from" minCardinality:"0"` } // Description implements Step. @@ -70,7 +70,7 @@ var _ linkedql.IteratorStep = (*Value)(nil) // Value corresponds to .value(). type Value struct { - From linkedql.PathStep `json:"from"` + From linkedql.PathStep `json:"from" minCardinality:"0"` } // Description implements Step. @@ -87,7 +87,7 @@ var _ linkedql.IteratorStep = (*Documents)(nil) // Documents corresponds to .documents(). type Documents struct { - From linkedql.PathStep `json:"from"` + From linkedql.PathStep `json:"from" minCardinality:"0"` } // Description implements Step. diff --git a/query/linkedql/steps/union.go b/query/linkedql/steps/union.go index 57286081d..ae917ff9f 100644 --- a/query/linkedql/steps/union.go +++ b/query/linkedql/steps/union.go @@ -17,7 +17,7 @@ var _ linkedql.PathStep = (*Union)(nil) // Union corresponds to .union() and .or(). type Union struct { - From linkedql.PathStep `json:"from"` + From linkedql.PathStep `json:"from" minCardinality:"0"` Steps []linkedql.PathStep `json:"steps"` } diff --git a/query/linkedql/steps/unique.go b/query/linkedql/steps/unique.go index 4d21c72ea..7d25fd188 100644 --- a/query/linkedql/steps/unique.go +++ b/query/linkedql/steps/unique.go @@ -17,7 +17,7 @@ var _ linkedql.PathStep = (*Unique)(nil) // Unique corresponds to .unique(). type Unique struct { - From linkedql.PathStep `json:"from"` + From linkedql.PathStep `json:"from" minCardinality:"0"` } // Description implements Step. diff --git a/query/linkedql/steps/visit.go b/query/linkedql/steps/visit.go index 559213f18..28842f212 100644 --- a/query/linkedql/steps/visit.go +++ b/query/linkedql/steps/visit.go @@ -17,7 +17,7 @@ var _ linkedql.PathStep = (*Visit)(nil) // Visit corresponds to .view(). type Visit struct { - From linkedql.PathStep `json:"from"` + From linkedql.PathStep `json:"from" minCardinality:"0"` Properties linkedql.PropertyPath `json:"properties"` } diff --git a/query/linkedql/steps/visit_reverse.go b/query/linkedql/steps/visit_reverse.go index c42cf4564..a16a224f9 100644 --- a/query/linkedql/steps/visit_reverse.go +++ b/query/linkedql/steps/visit_reverse.go @@ -17,7 +17,7 @@ var _ linkedql.PathStep = (*VisitReverse)(nil) // VisitReverse corresponds to .viewReverse(). type VisitReverse struct { - From linkedql.PathStep `json:"from"` + From linkedql.PathStep `json:"from" minCardinality:"0"` Properties linkedql.PropertyPath `json:"properties"` } diff --git a/query/linkedql/steps/where.go b/query/linkedql/steps/where.go index 646be2f5a..5b8e0403e 100644 --- a/query/linkedql/steps/where.go +++ b/query/linkedql/steps/where.go @@ -17,7 +17,7 @@ var _ linkedql.PathStep = (*Where)(nil) // Where corresponds to .where(). type Where struct { - From linkedql.PathStep `json:"from"` + From linkedql.PathStep `json:"from" minCardinality:"0"` Steps []linkedql.PathStep `json:"steps"` }