cancel
Showing results for 
Search instead for 
Did you mean: 

Mysterious error with Cypher Query: "Type mismatch: expected Map, Node, Relationship,..."

fruitfulapproac
Graph Buddy

 

neo4j.exceptions.CypherSyntaxError: {code: Neo.ClientError.Statement.SyntaxError} {message: Type mismatch: expected Map, Node, Relationship, Point, Duration, Date, Time, LocalTime, LocalDateTime or DateTime but was Path (line 1, column 118 (offset: 117)) "MATCH (x:QuiverNode)-[f:MAPS_TO]->(:QuiverNode), a=(:QuiverArrow) WHERE x.uid='e50144a2b3f24814919f01dd866e3970' AND a.uid=f.uid RETURN a" ^}

 

 

My full query and Django-Neomodel code looks like this:

 

    def all_morphisms(self):
        results, meta = db.cypher_query(
            f"MATCH (x:QuiverNode)-[f:MAPS_TO]->(:QuiverNode), "
            f"a=(:QuiverArrow) "
            f"WHERE x.uid='{self.uid}' AND a.uid=f.uid "
            f"RETURN a")
        return [QuiverArrow.inflate(row[0]) for row in results]

 

It's not very clear to me what is happening.

1 REPLY 1

fruitfulapproac
Graph Buddy
    def all_morphisms(self):
        results, meta = db.cypher_query(
            f"MATCH (X:QuiverNode)-[r:MAPS_TO]->(:QuiverNode)"
            f"MATCH (f:QuiverArrow) "
            f"WHERE X.uid='{self.uid}' AND f.uid=r.uid "
            f"RETURN f")
        return [QuiverArrow.inflate(row[0]) for row in results]
                    
    def delete(self):
        # Delete all the outgoing morphisms first:
        db.cypher_query(f"MATCH (X:QuiverNode)-[r:MAPS_TO]->(:QuiverNode)"
                        f"MATCH (f:QuiverArrow) "
                        f"WHERE X.uid='{self.uid}' AND f.uid=r.uid DELETE f")  
        # TODO: see if we need to also delete r here ("DELETE r,f"), or whether the following automatically deletes it:
        super().delete()
           

That's how you do it: a multi-match statement.