polypheny / Polypheny-DB

A self-adaptive Polystore that provides cost- and workload aware access to heterogeneous data.
https://polypheny.org
Apache License 2.0
123 stars 83 forks source link

Clarification and Documentation Request on Cross-Model Queries #463

Open stone-ts15 opened 11 months ago

stone-ts15 commented 11 months ago

Affected Areas

DB

Feature Description

Hello Polypheny Team,

I'm currently exploring the capabilities of Polypheny and am interested in executing cross-model queries, specifically between HSQLDB and Neo4j. However, I've encountered some difficulties as the documentation (Polypheny-documentation) does not clearly indicate whether this feature is supported. It would be immensely helpful if you could confirm whether Polypheny supports cross-model queries and possibly update the documentation to include examples or use cases showcasing this functionality.

Any clarification or assistance with this matter would be greatly appreciated. Thank you for your attention to this issue.

Use Case(s)

To illustrate my point, here's an example scenario involving a cross-model query between HSQLDB and Neo4j:

In Neo4j, with the namespace university, we have graph vertices labeled Student and edges labeled Friend created as follows:

CREATE (n: Student {deptno: 10});
CREATE (m: Student {deptno: 20});
MATCH (n: Student {deptno: 10}), (m: Student {deptno: 20}) CREATE (n)-[r:Friend]-(m);

Additionally, there is a predefined table named depts in the public namespace with a deptno column as its primary key. The query requirement (Q for short) is to find friends of students from the "Sales" department.

The Polypheny Web UI restricts users to one query language—either SQL or Cypher in this case. Therefore, it's unclear how to integrate the two models to satisfy Q. While attempting to write the Cypher query under the university namespace, all my queries failed to execute. For instance, the following statement triggered an org.polypheny.db.languages.NodeParseException:

MATCH (d: public.depts), (n: Student)-[r: Friend]-(m: Student)
WHERE d.name = 'Sales'
  AND d.deptno = n.deptno
RETURN m;

The error persists regardless of whether public.depts is quoted. It seems that the public.depts namespace is not recognized within the Cypher environment. When I replace public.depts with just depts, the query executes but returns an empty result set. Perhaps Polypheny considers depts as a individual vertex label in Neo4j.

Possible Solutions

No response

Possible Alternatives

No response

hennlo commented 11 months ago

Hi @stone-sgy thanks for your interest in Polypheny. Yes indeed I can confirm that we support Cross-Model Queries, this is one of our major goals to provide a semntical layer to enable cross-model queries across your data landscape and even execute queries regardless of the underlying query(e.g. SQL on Docuemnts-Store and vice-versa, etc.).

You've identified the use case and the approach correctly. However, their is currently a major bug we are working on internally in a seperate refactoring branch, that we try having available within the following week. This is also the reason why we temporarily needed to remove the documentation for this part.

I'll update you if the updates are "live".

stone-ts15 commented 11 months ago

@hennlo Thank you for your reply. Look forward to your update!