typhon-project / typhonql

Typhon Query Language
Eclipse Public License 2.0
4 stars 1 forks source link

[BUG] unable to mass delete elements in a graph database #121

Closed barmpis closed 3 years ago

barmpis commented 3 years ago

Describe the bug

Trying to delete all elements in a graph db fails.

Query

{
"query" : "delete CommonReviews cr"
}

Model


customdatatype address {
    street: string[32],
    number: string[8],
    zipcode: string[32],
    city: string[32]
}

entity Customer {
    name : string[32]
    age: int
    payment: string[32]
    address: address
    orders -> Order."Order.customer"[0..*]
    COMMONREVIEWSSOURCE :-> CommonReviews."CommonReviews.source"[1]
    COMMONREVIEWSTARGET :-> CommonReviews."CommonReviews.target"[1]
}

entity Product {
    name : string[32]
    description : string[256]
    orders -> Order."Order.products"[0..*]
    reviews :-> Review."Review.product"[0..*]
}

entity Order {
    created : datetime
    products -> Product."Product.orders"[0..*]
    customer -> Customer."Customer.orders"[1]
}

entity Review {
    content : text 
    product -> Product."Product.reviews"[1]
    author -> Customer[1]
}

//source and target have X common reviews
entity CommonReviews {
    count : int
    source -> Customer[1] 
    target -> Customer[1] 
}

relationaldb ECommerce {
  tables {
    table { OrderTbl : Order }
    table { 
      CustomerTbl : Customer
      index nameIdx { attributes ("name") }
    }
    table { ProductTbl : Product }
  }
}

documentdb Social {
    collections { Reviews : Review }
}

graphdb CommonReviewsDB {
    edges {
        edge CommonReviews {
            from source
            to target
        }
    }
}

Expected behavior

All elements in the graph database (CommonReviews Entity) should be deleted

REST API

typhonql-server_1 | org.neo4j.driver.exceptions.ClientException: Type mismatch: cr defined with conflicting type Node (expected Relationship) (line 1, column 19 (offset: 18)) typhonql-server_1 | "match (cr$from )-[cr:CommonReviews]->(cr$to )" typhonql-server_1 | ^ typhonql-server_1 | (internal error) typhonql-server_1 | at $typhonql$(|main://$typhonql$|) typhonql-server_1 | typhonql-server_1 | org.neo4j.driver.exceptions.ClientException: Type mismatch: cr defined with conflicting type Node (expected Relationship) (line 1, column 19 (offset: 18)) typhonql-server_1 | "match (cr$from )-[cr:CommonReviews]->(cr$to )" typhonql-server_1 | ^ typhonql-server_1 | at org.neo4j.driver.internal.util.Futures.blockingGet(Futures.java:143) typhonql-server_1 | at org.neo4j.driver.internal.InternalResult.blockingGet(InternalResult.java:128) typhonql-server_1 | at org.neo4j.driver.internal.InternalResult.list(InternalResult.java:105) typhonql-server_1 | at nl.cwi.swat.typhonql.backend.neo4j.Neo4JEngine$2.performSelect(Neo4JEngine.java:72) typhonql-server_1 | at nl.cwi.swat.typhonql.backend.QueryExecutor.executeSelect(QueryExecutor.java:141) typhonql-server_1 | at nl.cwi.swat.typhonql.backend.QueryExecutor.lambda$0(QueryExecutor.java:74)