'How to repair OrientDB broken links from the java API?

I need to repair some broken links in my OrientDB database. Running REPAIR DATABASE --fix-links from the console works, but I would like to be able to run it from java (scala actually) code.

I tried to execute the REPAIR command as a query but it is not accepted. I also tried to "manually" repair the links by executing commands like

UPDATE Comment SET author = NULL WHERE (SELECT expand(author)) is NULL;

or

UPDATE Comment SET author = NULL WHERE (SELECT expand($parent.$current.author)) is NULL;

but they either trigger an error or have no effect.

How can I repair my broken links from the java API?



Solution 1:[1]

I managed to remove the broken links by looking for a property that should be on the linked entity.

UPDATE Comment SET author = NULL WHERE author.id IS NULL;

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 WilQu