Skip to content

Commit

Permalink
Merge 42d6853 into 43f15ac
Browse files Browse the repository at this point in the history
  • Loading branch information
pmantica1 committed Mar 4, 2019
2 parents 43f15ac + 42d6853 commit 12da621
Show file tree
Hide file tree
Showing 11 changed files with 368 additions and 323 deletions.
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -757,8 +757,8 @@ Type coercions are represented with GraphQL inline fragments.
}
}
```
Here, the `out_Species_Eats` vertex field is of the `FoodOrSpecies` union type. To proceed
with the query, the user must choose which of the types in the `FoodOrSpecies` union to use.
Here, the `out_Species_Eats` vertex field is of the `Union__Food__FoodOrSpecies__Species` union type. To proceed
with the query, the user must choose which of the types in the `Union__Food__FoodOrSpecies__Species` union to use.
In this example, `... on Food` indicates that the `Food` type was chosen, and any vertices
at that scope that are not of type `Food` are filtered out and discarded.

Expand Down

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions graphql_compiler/tests/test_compiler.py
Expand Up @@ -2794,7 +2794,7 @@ def test_gremlin_type_hints(self):
}
}'''
type_equivalence_hints = {
'Event': 'EventOrBirthEvent'
'Event': 'Union__BirthEvent__Event__FeedingEvent'
}

expected_match = '''
Expand All @@ -2815,7 +2815,7 @@ def test_gremlin_type_hints(self):
g.V('@class', 'Animal')
.as('Animal___1')
.out('Entity_Related')
.filter{it, m -> ['BirthEvent', 'Event'].contains(it['@class'])}
.filter{it, m -> ['BirthEvent', 'Event', 'FeedingEvent'].contains(it['@class'])}
.as('Animal__out_Entity_Related___1')
.back('Animal___1')
.transform{it, m -> new com.orientechnologies.orient.core.record.impl.ODocument([
Expand Down Expand Up @@ -3458,7 +3458,7 @@ def test_fold_date_and_datetime_fields(self):
check_test_data(self, test_data, expected_match, expected_gremlin, expected_sql)

def test_coercion_to_union_base_type_inside_fold(self):
# Given type_equivalence_hints = { Event: EventOrBirthEvent },
# Given type_equivalence_hints = { Event: Union__BirthEvent__Event__FeedingEvent },
# the coercion should be optimized away as a no-op.
test_data = test_input_data.coercion_to_union_base_type_inside_fold()

Expand Down Expand Up @@ -4772,7 +4772,7 @@ def test_filter_on_optional_traversal_equality(self):
class: Animal,
as: Animal__out_Animal_ParentOf__out_Animal_ParentOf___1
}}.out('Animal_FedAt') {{
class: Event,
class: FeedingEvent,
as: Animal__out_Animal_ParentOf__out_Animal_ParentOf
__out_Animal_FedAt___1
}} ,
Expand Down Expand Up @@ -5269,7 +5269,7 @@ def test_multiple_traverse_within_optional(self):
class: Animal,
as: Animal__in_Animal_ParentOf___1
}}.out('Animal_FedAt') {{
class: Event,
class: FeedingEvent,
as: Animal__in_Animal_ParentOf__out_Animal_FedAt___1
}}
RETURN $matches
Expand Down
28 changes: 21 additions & 7 deletions graphql_compiler/tests/test_data_tools/schema.sql
@@ -1,10 +1,7 @@
### UUIDs ###
CREATE CLASS UniquelyIdentifiable
CREATE CLASS UniquelyIdentifiable ABSTRACT
CREATE PROPERTY UniquelyIdentifiable.uuid String
# make uuid default to '' and insert such a record on purpose
# this will ensure that no UniquelyIdentifiable is added without a valid uuid field
ALTER PROPERTY UniquelyIdentifiable.uuid DEFAULT ''
INSERT INTO UniquelyIdentifiable SET uuid = ''
ALTER PROPERTY UniquelyIdentifiable.uuid MANDATORY TRUE
CREATE INDEX UniquelyIdentifiable.uuid UNIQUE_HASH_INDEX
###############

Expand Down Expand Up @@ -32,13 +29,25 @@ CREATE CLASS Event EXTENDS Entity

CREATE PROPERTY Event.event_date Date
CREATE INDEX Event.event_date NOTUNIQUE

CREATE CLASS Event_RelatedEvent EXTENDS E
CREATE PROPERTY Event_RelatedEvent.in LINK Event
CREATE PROPERTY Event_RelatedEvent.out LINK Event
CREATE INDEX Event_RelatedEvent ON Event_RelatedEvent (in, out) UNIQUE_HASH_INDEX
###############


### BirthEvent ###
CREATE CLASS BirthEvent EXTENDS Event
###############

### FeedingEvent ###
CREATE CLASS FeedingEvent EXTENDS Event
###############

### Location ###
CREATE CLASS Location EXTENDS Entity
###############

### Animal ###
CREATE CLASS Animal EXTENDS Entity
Expand All @@ -58,7 +67,7 @@ CREATE PROPERTY Animal_ParentOf.out LINK Animal
CREATE INDEX Animal_ParentOf ON Animal_ParentOf (in, out) UNIQUE_HASH_INDEX

CREATE CLASS Animal_FedAt EXTENDS E
CREATE PROPERTY Animal_FedAt.in LINK Event
CREATE PROPERTY Animal_FedAt.in LINK FeedingEvent
CREATE PROPERTY Animal_FedAt.out LINK Animal
CREATE INDEX Animal_FedAt ON Animal_FedAt (in, out) UNIQUE_HASH_INDEX

Expand All @@ -68,9 +77,14 @@ CREATE PROPERTY Animal_ImportantEvent.out LINK Animal
CREATE INDEX Animal_ImportantEvent ON Animal_ImportantEvent (in, out) UNIQUE_HASH_INDEX

CREATE CLASS Animal_BornAt EXTENDS E
CREATE PROPERTY Animal_BornAt.in LINK Event
CREATE PROPERTY Animal_BornAt.in LINK BirthEvent
CREATE PROPERTY Animal_BornAt.out LINK Animal
CREATE INDEX Animal_BornAt ON Animal_BornAt (in, out) UNIQUE_HASH_INDEX

CREATE CLASS Animal_LivesIn EXTENDS E
CREATE PROPERTY Animal_LivesIn.in LINK Location
CREATE PROPERTY Animal_LivesIn.out LINK Animal
CREATE INDEX Animal_LivesIn ON Animal_LivesIn (in, out) UNIQUE_HASH_INDEX
###############


Expand Down

0 comments on commit 12da621

Please sign in to comment.