Orientdb: source record is not a vertex

Created on 19 May 2016  路  6Comments  路  Source: orientechnologies/orientdb

Expected behavior and actual behavior

I am using the script sql command in the console to run a batch query that selects a Person vertex then selects an Email vertex and then creates an edge HAS from person to email. When I run the command I get the following error.

Error: com.orientechnologies.orient.core.exception.OCommandExecutionException: Error on execution of command: sql.create edge has from $user to $email

Error: java.lang.IllegalArgumentException: source record is not a vertex

Steps to reproduce the problem

orientdb {db=test}> script sql
[Started multi-line command. Type just 'end' to finish and execute]
orientdb {db=test}> begin
orientdb {db=test}> let user = select from person where uid = '12345'
orientdb {db=test}> let email = select from email where email = '[email protected]'
orientdb {db=test}> let edge = create edge has from $user to $email
orientdb {db=test}> commit
orientdb {db=test}> return $edge
orientdb {db=test}> end

Important Questions

As far as I know both Person and Email are vertexes in the database. The data and schema was inserted using a .graphml database exported from neo4j. What is source record here ? the person ?
Why is it not being treated as a vertex ? Another thing I would like to point out is for the same records if I directly create an edge using the records' rid's, the edge between the vertexes are successfully created.

Runninng Mode

  • [x] Embedded, using PLOCAL access mode
  • [ ] Embedded, using MEMORY access mode
  • [ ] Remote

    Misc

  • [ ] I have a distributed setup with multiple servers. How many?

  • [ ] I'm using the Enterprise Edition

    OrientDB Version

  • [ ] v2.0.x - Please specify last number:

  • [x] v2.1.17 - Please specify last number:
  • [ ] v2.2.x - Please specify last number:

    Operating System

  • [ ] Linux

  • [x] MacOSX
  • [ ] Windows
  • [ ] Other Unix
  • [ ] Other, name?

    Java Version

  • [ ] 6

  • [x] 7
  • [ ] 8
bug

All 6 comments

Can you check in the schema if Person has V as superclass ?

Vertex

Just checked. Both Email and Person has V as their superclass.

@amyth

i think the problem is the $user variable. It is used in ODB in the context of the batch script to track the current user.

Try to use $person and tell me if it works

I see. If I change the variable name to person, I get the following error:

Error: com.orientechnologies.orient.core.exception.OCommandExecutionException: Error on execution of command: sql.create edge has from $person to $email

Error: java.lang.ClassCastException: java.lang.Integer cannot be cast to com.orientechnologies.orient.core.db.record.OIdentifiable

Error

@amyth

that is because $email is from update.

try with select on email or use

let email= update  email set email = '[email protected]' return after @this where email = '[email protected]' 

@maggiolo00 Yes absolutely. Though I used the following (with upsert) as i needed create or update.

let email = update email set email = '[email protected]' upsert return after @this where email = '[email protected]'

Thanks so much for your quick responses and help.

Was this page helpful?
0 / 5 - 0 ratings