ftsrg / ingraph

Incremental view maintenance for openCypher graph queries.
http://docs.inf.mit.bme.hu/ingraph/
Eclipse Public License 1.0
48 stars 10 forks source link

Support "metaqueries" #53

Open szarnyasg opened 7 years ago

szarnyasg commented 7 years ago

We should definitely support labels() and type(). I am not sure about properties() and keys().

szarnyasg commented 7 years ago

Some thoughts:

Propagating these in the Rete network should be the responsibility of the inferencer classes, the most likely candidate being the ExtraAttributeInferencer. Where should we propagate these?

szarnyasg commented 6 years ago

Also, m:Message-style expressions could also be considered to be metaqueries as they are a special case of 'Message' IN labels(m)-style expressions.

szarnyasg commented 6 years ago

:NodeLabel-style expressions now work, except when there are joins (expands or plain Cartesian products), in which case the schema inferencer just crashes because it does not propagate the variable either way.

MATCH (message2:Message) //, (x:X)
RETURN message2:Comment AS isComment
marci543 commented 6 years ago

Related queries with the following exception:

java.lang.AssertionError: assertion failed: Some properties were not propagated to either side of the join-like operator at scala.Predef$.assert(Predef.scala:170) at ingraph.compiler.plantransformers.NPlanToFPlan$.transform(NPlanToFPlan.scala:94)

LDBC SNB / Interactive / complex / 2

MATCH (:Person {id:19791209300143})-[:KNOWS]-(friend:Person)<-[:HAS_CREATOR]-(message)
WHERE message.creationDate <= 20121128000000000 AND (message:Post OR message:Comment)
RETURN
  friend.id AS personId,
  friend.firstName AS personFirstName,
  friend.lastName AS personLastName,
  message.id AS postOrCommentId,
  CASE exists(message.content)
    WHEN true THEN message.content
    ELSE message.imageFile
  END AS postOrCommentContent,
  message.creationDate AS postOrCommentCreationDate
ORDER BY postOrCommentCreationDate DESC, toInteger(postOrCommentId) ASC
LIMIT 20

TCK "MatchAcceptance2": "Multiple anonymous nodes in a pattern"

MATCH (a)<--()<--(b)-->()-->(c)
WHERE a:A
RETURN c

TCK "OptionalMatchAcceptance": "Return null when no matches due to label predicate in WHERE"

MATCH (n:Single)
OPTIONAL MATCH (n)-[r]-(m)
WHERE m:NonExistent
RETURN r