Order by version number

I understand that OrientDB supports Javascript. Is there a way to ORDER BY version number? I’ve tried split(’.’) as my best shot in the dark. In Postgres I’ve seen an example of casting a String as an array of Int:


create table versions (id integer, version string);

insert into versions 

SELECT id, version
FROM   versions
ORDER  BY string_to_array(version, '.')::int[];
id version
1 0.9
3 0.9.1
5 0.9.9
6 0.9.10
2 1.0
4 1.1

For full context, I’m using a QueryBuilder suffix in Sonatype Nexus to try to select the highest version and within the highest version the build that was most recently updated:

qb.suffix("order by component.version desc, last_updated desc limit 1")