orient-db , Saving to new cluster returns error


Saving to new cluster returns error

Question:

Tag: orient-db

I'm creating cluster dynamically in xtend/Java

for (int i : 0 ..< DistributorClusters.length) {
    val clusterName = classnames.get(i) + clusterSuffix;
    database.command(
                new OCommandSQL('''ALTER CLASS «classnames.get(i)» ADDCLUSTER «clusterName»''')).execute();
        }

Then I create I add the oRole and Grant the security to the new oRole

val queryOroleCreation = '''INSERT INTO orole SET name = '«clusterSuffix»', mode = 0, inheritedRole = (SELECT FROM orole WHERE name = 'Default')''';
        val ODocument result = database.command(new OCommandSQL(queryOroleCreation)).execute();
        for (int i : 0 ..< classnames.length) {
            database.command(
                new OCommandSQL(
                    '''GRANT ALL ON database.cluster.«classnames.get(i)»«clusterSuffix» TO «clusterSuffix»''')).
                execute();
        }

Finally I try to save a JsonObject to one of the newly created cluster. I checked in the database and the cluster exists.

        val doc = new ODocument();
        doc.fromJSON(jsonToSave.toString());

        val savedDoc = database.save(doc, "ClassName"+clusterSuffix);
        database.commit();

But Orient returns the following error :

SEVERE: java.lang.IllegalArgumentException: Cluster name 'cluster:ClassNameclusterSuffix' is not configured

My Question : What causes that exception? And can you add values to new cluster created?

Edit

The doc object contains reference to other classes. i.e:

{
    @class:"Customer",
    @version:0,
    name:"Kwik-E-Mart",
    user : {
        @class:"User",
        @version:0,
        username: "Apu",
        firstName:"Apu",
        lastName:"Nahasapeemapetilon"
    }
}

The user gets created in the default cluster, but the customer throws the exception.


Answer:

I find out that using a query works fine source.

The following code worked on the first try:

val query = '''INSERT INTO ClassNameCLUSTER «"ClassName"+clusterSuffix» CONTENT «jsonToSave.toString()»'''
val ODocument savedDoc = database.command(new OCommandSQL(query)).execute();

Related:


Different results for select and traverse?


orient-db
I'm experimenting with OrientDb with the sample vehicle history database and have executed these two SQL queries, which I (would have thought) would be identical. I am trying to find all of the females who sold a vehicle to a male. SELECT expand(out('Bought').in('Sold')[gender="Female"]) FROM Person WHERE gender = "Male" LIMIT...

which data type in orient db for @rid?


java,spring,orient-db
i tried to fetch all data from orientdb using java. my code is public static ArrayList<dbentity.DoctorEntity> viewAllDoctor(){ graph = factory.getTx(); ArrayList<dbentity.DoctorEntity> al=new ArrayList<dbentity.DoctorEntity>(); for (Vertex v : graph.getVerticesOfClass("DoctorA")) { System.out.println(v.getProperty("@rid")); dbentity.DoctorEntity disent=new DoctorEntity(v.getProperty("@rid"), v.getProperty("NAME"),v.getProperty("specialization")); al.add(disent); } graph.shutdown(); return al; } i want add @rid to...

How to insert a large record into Orient DB using pyOrient?


python,pandas,orient-db
I have an orientDB database with a vertex type 'node'. The node vertex has a string property called 'data'. I am trying to insert roughly 5 to 10mb into the node's data property, however, the database seems to become non responsive when doing so. I am using pyOrient as a...

NoSQL statistics type query with BaasBox - OrientDB 1.7.10


nosql,orient-db,baasbox
I'm trying out BaasBox v0.9.2 which ships with OrientDB 1.7.10 for a proof of concept web app I want to build. Premise is fairly simple and adding/querying is very straight forward and simple for single collections. What I'm having difficulty trying to visualize is how to get statistics type information...

Create a vertex with Label in Gremlin


orient-db,gremlin
This seems like a must have feature for graph query language, but I cannot find a command that let me create a vertex with label, nor add a label after a vertex has been created. I tried the solution here, but it does not work because the property T.label is...

OrientDB SELECT and subqueries


orient-db
I'm really puzzled about this. Why does this works: SELECT out('Posted').out('IsFromCategory') FROM #18:1 And this does not: SELECT out('IsFromCategory') FROM (SELECT out('Posted') FROM #18:1) That's not me real logic, but is something I came up doing some tests......

How to authenticate a HTTP request to an OrientDB function on AngularJS?


angularjs,httprequest,orient-db
I have the following OrientDB function: http://cmdrafernando:2480/function/ApplicationVtaf/getPassFailCount/9:600 And it returns the following JSON result: {"result":[{"@type":"d","@version":0,"pass":16.0,"fail":2.0,"@fieldTypes":"pass=d,fail=d"}]} What I need to do is to get the values of "pass" and "fail" to use in my web page. So far I have done this with AngularJS: $http.get('http://cmdrafernando:2480/function/ApplicationVtaf/getPassFailCount/9:600'). success(function(data) { $scope.data = data.result; //...

Import from RDBMS DB2 To Document DB OrientDB


import,orient-db
In my database CU242176 DBMS OrientDB version 2.0.7 is a table M_PERM: PERM_DESC:string; PERM_ID:integer not null; PERM_NAME:string. In my database CU242176 DBMS DB2 version 9.1 is a table M_PERM of the same structure. In this table 14 rows. With module Orientdb-ETL I did import the data. No errors, but there...

Understand orient-db logic


sql,orient-db
I'm new in OrientDB/grahps and I'm trying to understand it's logic clearly. Let's say there are vertexes Movies 1:n Genres with SortOf edge. I would like to know other genres that have movies that are 'Comedy'. After reading docs I'd thought that it should be something like that: SELECT expand(in('SortOf').out('SortOf')[name<>'Comedy'])...

how to add conditions in OrientDB ETL


orient-db
I have a CSV file contains addresses for restaurants and other places, and at one colomun I have 'N' for neighborhood and 'S' (and not both) for street. If a line have the letter 'N' I want to link it to a vertex named neighborhood, and if it had 'S'...

OrientDB — is there a way to find out which edge was traversed?


orient-db
I've been researching/looking around high and low for this, but, could not find any leads. I'm thinking this is a limitation, but, I would like to be sure. Scenario (1): In this scenario, I've explicitly informed which edge I'd like to traverse through. Thus, I know who is attending the...

OrientDB query for hierarchical data


orient-db
OrientDB Server v2.0.10 , I am trying to come up with a query for the following scenario. I have 2 hierarchies: A->B->C and D->E->F The number of nodes in the hierarchy can change. The node in 1st hierarchy can be connected to the other hierarchy using some relation say 'Assigned'....

What does the exclusive lock on storage for OrientDB entail exactly?


concurrency,transactions,locking,orient-db
Having read the following statement from the official documentation of OrientDB: In order to guarantee atomicity and consistency, OrientDB acquire an exclusive lock on the storage during transaction commit. I am wondering if my understanding of the situation is correct. Here is how I assume this will work: Thread 1...

What factors to consider when choosing a Multi-model DBMS? (OrientDB vs ArangoDB)


database,orient-db,arangodb,foundationdb,multi-model-database
I am looking to dip my hands into the world of Multi-Model DBMS, I have no particular use cases, just want to start learning. I find that there are two prominent ones - OrientDB vs ArangoDB, but was unable to find any meaningful comparison, unopinionated between them. Can someone shed...

Orient-db working with Dates


orient-db
I'm trying to query record filtering on the date (documentation for date) select * from InstallationFee where infinite OR (date() >= dateFrom and date() <= dateTo) The query returns the following error in the studio: java.lang.ClassCastException: com.orientechnologies.orient.core.sql.filter.OSQLFilterItemField cannot be cast to com.orientechnologies.orient.core.sql.filter.OSQLFilterCondition Here is the stack trace in the JAVA...

OrientDB - Result from 2 different tables


sql,database,select,orient-db
I have a database that has 2 V's classes ('User' that has 2 strings named Name and Surname ,'Cinema') and 2 E's classes ('isGoing' that has an Integer property named Day, 'Friend'). This select returns all the 'Cinema' that the 'Friend' of the initial Vertex are going on a specific...

Writting SQL command to traverse Vertex on Edges conditions


java,orient-db
Imagine the following schema Let's say each edge is of type "manage" with an attribute "permissions" set to "rw" or "r-" or "--" and each vertex is of type Account. Here, Account 3 is not able to write in Account 5, but since Account 1 is able to write in...

Create schema for graph database with Java in OrientDB


java,orient-db
I'm trying to create schema for graph database in OrientDB with Java but I have two problems I can't solve. I'm using this example http://orientdb.com/docs/last/Graph-Schema.html When I use this code I get the following error: java.lang.NoSuchMethodError: com.orientechnologies.common.concur.resource.OResourcePool.getAllResources()Ljava/util/Collection; at com.orientechnologies.orient.client.r OServerAdmin serverAdmin = new OServerAdmin("remote:localhost").connect("root", "1234"); serverAdmin.createDatabase("mydb", "graph", "plocal");...

OrientDB import CSV is modifying my property name


csv,properties,import,character,orient-db
I'm no expert in OrientDB, and I'm having a problem with an odd character showing up in the command line. Oddly enough, it's in the name of my property. Because the name of the property is different, my queries are breaking. For example, I can't execute SELECT * FROM Class...

OrientDB - How To - Record Level Security with ODocument


java,orient-db
I'm trying to get Record Level Security working using the Document database (Java) API for OrientDB. I like the idea of restricting access for certain records in the database to particular roles; however, I could not find how to do this in the documentation. I'm new to OrientDB so I'm...

OrientDB average over collection


sql,aggregate,average,orient-db
Im trying orientdb with some simple apps. In this app I have People (persona) and places to eat (sitio), people go to those places (I store how many times they do) and score them. Using this query: SELECT *, inE('puntua').comida as comida, inE('puntua').servicio as servicio, inE('puntua').extras as extras from Sitio...

Fetching all the paths between two nodes using gremlin in java


java,graph-databases,orient-db,gremlin,tinkerpop
Hi I am kinda new to gremlin and trying to achieve some solve by finding all the paths between two nodes. In simple query on gremlin console I was able to do that using this query : (Name of the first Node).loop(1){it.loops<100}{true}.has('name', (Name of the second node)).path{it.name} But while I...

Distinct function somehow not giving back all types


distinct,orient-db,result
Feel free to check it on my latest project: http://arda-maps.org:2480 arda arda as login. Now check select distinct(type) from Location Here you get 8 records (River,Lake,Region,City,Island,House,Mountain,Hill). But actually there are way more... To show you that the distinct somehow is not giving back all distinct we search for one specific...

Graph Databases vs Triple Stores - when to use which?


neo4j,sparql,graph-databases,orient-db,triplestore
I know that there are similar questions around on Stackoverflow but I don't feel they answer the following. Graph Databases to my understanding store data following mostly this schema: Table/Collection 1: store nodes with UID Table/Collection 2: store relations referencing nodes via UID This allows storing arbitrary types of graphs....

How to group all sibling nodes from different parents by common sibling in a graph using Gremlin/OrientDB


graph,graph-databases,orient-db,gremlin
It is difficult for me to describe. The Gremlin query I am trying to write has one node as an input. Then I am searching all the nodes with class Group of input. Then in each group there is only one Text class node and a number of Elem nodes....

OrientDB doesn't save edge in/out and properties


distributed,orient-db
I've installed orientdb in distributed mode but I have a problem during creation of the edges (lightweightmode is disabled). When I create an edge everything seems to work fine but actually orientdb doesn't save the properties and even the link between out-in objects! I run the server executing dserver.sh. If...

Select query to get fields within JSON in orientdb


json,database,select,orient-db
In what way can I get fields within a JSON that is stored as a OrientDB Class field? For example, I have a class FILE having a field named 'data'. orientdb {db=baasbox}> select data from FILE ----+---------------------- # | data ----+---------------------- 0 | {"email":"[email protected]"} ----+---------------------- The field 'data' is a...

OrientDB - LET variable in where


where,orient-db,let
I have a query very similar to this: SELECT FROM Post LET $category = (SELECT EXPAND(out('PartOf')) FROM $current), $poster = (SELECT EXPAND(in('Posted')) FROM $current) WHERE $poster <> #18:1 AND $poster IN (SELECT EXPAND(out('IsUser')) FROM (SELECT EXPAND(out('Related')) FROM #18:1) WHERE out('RelatedIn') IN ($category)) LIMIT 10000 And a graph like this: CREATE...

Find “friends of friends” with OrientDB SQL


orient-db
Although one of the most common use cases for demonstrating the capabilities of a graph database, I cannot seem to find a good example or best practice for obtaining "friends of friends" with OrientDB SQL. Lets assume a social network and try to model it with "user" vertices and "is_friend_with"...

Representation of python dictionaries with unicode in database queries


python,unicode,orient-db
I have a problem that I would like to know how to efficiently tackle. I have data that is JSON-formatted (used with dumps / loads) and contains unicode. This is part of a protocol implemented with JSON to send messages. So messages will be sent as strings and then loaded...

In a OrientDB query, how can the where clause reference a column in the select


orient-db
I want to write a query in OrientDB performs WHERE filtering on some columns/fields on the SELECTed vertex. Here is the equivalent query implemented with nested SELECT's- SELECT FROM (SELECT EXPAND(OUT('Foo')) FROM #13:1 ) WHERE prop = 'bar' How I can write this query with a single SELECT?...

orientDB list of map keys


sql,orient-db
I created an embedded map trough Java in the following way: Map<String,Object> mapObjectToInsert = new HashMap<String, Object>(); mapObjectToInsert.put("attr1",1); mapObjectToInsert.put("attr2","bla"); ODocument doc = new ODocument("testClass"); doc.field("postUrl","11"); doc.field("jsonData",mapObjectToInsert); doc.save(); and now I have the following embedded map: { "result": [ { "@type": "d", "@rid": "#14:0", "@version": 1, "@class": "testClass", "postUrl": "11", "postCategory":...

Querying OrientDB for latitude-longitude pairs in a circle of a given radius and center


orient-db
I have collection of nodes of latitude-longitude pairs. How do I query OrientDB to find all the nodes (latitude-longitude pairs) in a circle of given radius with center in given coordinates? ...

OrientDB ETL importing date field


orient-db
I have imported a large table containing demographic information and my ETL JSON looks like this { "config": { "log": "debug" }, "extractor" : { "jdbc": { "driver": "com.mysql.jdbc.Driver", "url": "jdbc:mysql://localhost/avicenna", "userName": "xxxxxx", "userPassword": "xxxxxxxxxxxx", "query": "select * from patients", "fetchSize": 1000 } }, "transformers" : [ { "vertex": {...

Saving to new cluster returns error


orient-db
I'm creating cluster dynamically in xtend/Java for (int i : 0 ..< DistributorClusters.length) { val clusterName = classnames.get(i) + clusterSuffix; database.command( new OCommandSQL('''ALTER CLASS «classnames.get(i)» ADDCLUSTER «clusterName»''')).execute(); } Then I create I add the oRole and Grant the security to the new oRole val queryOroleCreation = '''INSERT INTO orole SET...

Waterline orientdb database connections timing out


node.js,sails.js,orient-db,waterline,sails-orientdb
With SailsJS/Waterline I am using the waterline-orientdb adapter to connect to and commit my domain objects to OrientDB. Everything with that is fairly straightforward except for the frequent connection timeouts that I'm getting from the database. orientdb: { adapter: 'waterline-orientdb', host: 'somehost', port: 2424, user: 'someuser', password: 'somepassword', database: 'somedatabasename'...

$parent and $ current in orientDB query


orient-db
I read it on orientDB documentation but can't get a hold of it. It would be great if someone could explain the use of $parent and $current in detail. In a few examples I tried $parent.$parent.$current and $parent.$current, both give the same results which I feel should not happen. Below...

Cannot establish a connection to orientdb using jdbc driver?


netbeans,jdbc,nosql,orient-db
I'm newbie to the orientdb, I'm using netbeans's (add new connection wizard) to add a connection to the orientdb, I used orientdb-jdbc-2.0.2-all.jar as a jdbc driver, but I got the following error after clicking on test connection Snapshot of the error I made sure that the database is connected and...

orientdb property constraints like MANDATORY not failing on improper java api insertions


java,graph,orient-db
I have an orientdb setup with a class called MessageLog with a property messageId that has a constraint MANADATORY and NOT NULL. If i try to insert a record from the console with a null messageId it raises an exception telling that the property cannot be null. But when i...

list OrientDb databases using HTTP protocol and golang


go,orient-db
I am trying to get a list of OrientDb databases using HTTP protocol. But I cannot get expected response, which I can get in a browser. If I input in a browser address line http://localhost:2480/listDatabases then I have response: {"@type":"d","@version":0,"databases":["MaximDB","GratefulDeadConcerts"],"@fieldTypes":"databases=e"} How can I get the same using golang? My code:...

OrientDB - Edge Property in Expand


database,select,orient-db,edge
I have 2 'V' classes in my database that are: "User" and "Cinema" and 2 'E' classes that are: "Friend" and "isGoing". My "Friend" edge is lightweight and is working fine, but whenever I try to select anything using the property inside "isGoing" (Datetime date), the select returns empty. Examples:...

orient db unable to open any kind of graph


orient-db
I am new to orient-db and have run into a major block even trying to open a simple in memory database. Here is my two lines of code (in java) OrientGraphFactory factory = new OrientGraphFactory("memory:test").setupPool(1,10); // EVERY TIME YOU NEED A GRAPH INSTANCE OrientGraph g = factory.getTx(); try { }...

How to run a SQL Script that builds my DB and schema in OrientDB?


orient-db
I'm using OrientDB 2.0.2. I'm writing a SQL script that will create a new DB, construct the schema, and then populate the DB with static initial data. I know that the database will be automatically created if I simply start loading data, and that classes will automatically be created if...

According to the list to receive a string RID class MARKS


orient-db
In my database IM_0609 OrientDB version 2.0.8 is a class MARKS: CALIBRATION_DATE:date. DEVICE_MARK:string DEVICE_NAME:string END_MARK_NUM:decimal MARK_NUM:decimal PERIOD:decimal SERIAL_NUM:string In the class MARKS I have created the index as follows: CREATE INDEX IDX_MARK_NUM on MARKS(MARK_NUM) NOTUNIQUE I run the following query quickly: select rid from index:IDX_MARK_NUM where key>=74118499 and key<=74118501 Results...

OrientDB: How to update column using select query


sql,orient-db
I need to update a column in table using following: update Table1 set name = (select productName from Table2 where @rid=$parent.$current.productid) Query works fine but instead of name query stores value in "[productname]" format. I have read orientdb documentation, I guess select query returns result in collection format. so I...

Waterline-OrientDB - Bi-Directional Edge


node.js,sails.js,orient-db,waterline,sails-orientdb
I have two models declared in Sails and I'm using the Waterline-Orientdb adapter and don't know how to connect them via a bi-directional edge Questions Model var Waterline = require('waterline'); module.exports = Waterline.Collection.extend({ tableName: 'questionsTable', identity: 'questions', connection: 'associations', attributes: { id: { type: 'string', primaryKey: true, columnName: '@rid'}, question...

How can I get the latest 10 posts those are written by people in my network (2 level) with gremlin query?


graph,orient-db,gremlin
I have friends, my friends have friends also. How can I get the latest 10 posts those are written by people in my network (2 level) with gremlin query?

Accessing Connected Vertices in OrientDB Javascript Functions


javascript,graph-databases,orient-db
I'm attempting to use the build in Functions in OrientDB studio to group Workstations that aren't in use by a Person. The query to get these vertices works fine but I'm trying to avoid Traverse as it is very slow - too slow to be used in production. Instead of...

Lucene acting up on OrientDB when confronted with fuzzy queries


indexing,lucene,orient-db,fuzzy-search
I have indexed a property on OrientDB using Lucene's keyword analyzer: CREATE INDEX Snippet.ssdeep ON Snippet (ssdeep) FULLTEXT ENGINE LUCENE METADATA {"analyzer":"org.apache.lucene.analysis.core.KeywordAnalyzer"} The filed contains simhashes that I have indexed for test. Now when I search using Lucene, I get a response for the exact queries, but not for the...

How to connect orientdb database using java?


java,database,orient-db
I tried to connect using orientdb database with java. like this OrientGraph odb = new OrientGraph("plocal:C:/Users/USER/Desktop/orientdb/databases/testJ", "admin", "admin"); Its showing an error HTTP Status 500 - Handler processing failed; nested exception is java.lang.NoClassDefFoundError: com/orientechnologies/orient/core/db/record/ODatabaseRecord My dependencies.. <dependency> <groupId>com.orientechnologies</groupId> <artifactId>orientdb-core</artifactId> <version>2.0.8</version>...