logo
down
shadow

OrientDB deep traversal until specific class


OrientDB deep traversal until specific class

Content Index :

OrientDB deep traversal until specific class
Tag : development , By : user152423
Date : November 25 2020, 03:01 PM

wish help you to fix your issue It's definitely a bug, I'm checking it. As a quick work-around you can add a condition to the first element in the pattern, so that you force the executor to start from there:
 MATCH {class:Team, as: team, where:(true)} --> {class: Sport, maxDepth: 10}
 RETURN team.Abbreviation
 MATCH {class:Team, as: team} --> {where: (@class = 'Sport'), maxDepth: 10}
 RETURN team.Abbreviation

Comments
No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

OrientDB shortestPath() using specific edge @class?


Tag : java , By : TheDave1022
Date : March 29 2020, 07:55 AM
With these it helps just implemented in OrientDB v.2.0.9 and 2.1. Both will be released in next days, if you want to try it now you can compile from source (branches "2.0.x" and "develop")
current signature of the function is this:

OrientDB: probability-weighted edges and traversal


Tag : development , By : lietkynes
Date : March 29 2020, 07:55 AM
will be helpful for those in need given a sample graph of 6 nodes (A, B, C, D, E, F) , Try this JS function that has as parameter the @rid of the Node D
var g=orient.getGraph();
var nodes = [];
var previous=[];
var currently=[];
var paths=new Array;
var pathsProbability=[];
var b=g.command("sql","select from Node where @rid = " + rid);
var step=1;
var defaultProbability=1.0;
if(b.length>0){
    var vertex=b[0];
    previous.push(vertex);
    nodes.push(vertex);
    paths[0]=new Array(vertex);
    pathsProbability.push(defaultProbability);
    do{
        for(i=0;i<previous.length;i++){
            var vertexOut=previous[i];
            var edges=g.command("sql","select expand(outE()) from Node where @rid = "+ vertexOut.getId());
            for(j=0;j<edges.length;j++){ 
                var edge=edges[j];
                var vIn=edge.getProperty("in");
                if(!check(vIn)){ 
                    var probability=edge.getProperty("probability");
                    setPaths(vertexOut, vIn,probability);
                }
            }
        }
        removePaths();
        step++;
        change();
    }while(previous.length>0);
    return nodes;
}

function check(vIn) {
  for(y=0;y<nodes.length;y++){ 
    var idNode=nodes[y].getId().toString();
    var idIn=vIn.getId().toString();
    if(idNode==idIn)
      return true;
  }
} 

function setPaths(vOut, vIn,prob){
  for (m = 0; m < paths.length; m++) {
    var length=paths[m].length;
    var list = paths[m];
    var last = list[length - 1];
    var lastId=last.getId().toString();
    var idOut=vOut.getId().toString();
    if (lastId==idOut) {
        if (pathsProbability[m] * prob >= 0.5) {
            var listVertex=[];
            for (k=0;k<list.length;k++) {
                listVertex.push(list[k]);
            }
        listVertex.push(vIn);
        paths[paths.length]=listVertex;
        pathsProbability.push(pathsProbability[m]*prob);
        nodes.push(vIn);
        currently.push(vIn);
        return;
        }
    }
  }
}

function change(){
    previous=[];
    for (indice=0;indice<currently.length;indice++)
        previous.push(currently[indice]);
    currently=[];
}

function removePaths(){
    for(i=0;i<paths.length;i++){
        if(paths[i].length==step){
            paths.splice(i, 1);
            pathsProbability.splice(i, 1);  
            i--;
        }
    }
}

Using maxdepth and while in orientdb traversal


Tag : development , By : B3CFT
Date : March 29 2020, 07:55 AM
help you fix your problem I am using orientdb v2.1.4 Is it possible to do an orientdb traversal from a target record with a while condition and a maxdepth parameter in either SQL or the Java API? For example: , try this query:
traverse both() from YourClass while both('your_edge_class').size() = 0 and $depth <= 25
var g=orient.getGraph();
var result=[];
var current=[];
var next=[];
var listEdges=excludeEdges.substring(1,excludeEdges.length-1).split(",");
var root=g.command('sql','select from '+rid);
current.push(root[0]);
var step=1;
while(current.length>0 && step<=maxDepth){
    for(i=0;i<current.length;i++){
        getVertex(current[i],"OUT");
        getVertex(current[i],"IN");
    }
    change();
    step++;
}
return result;

function change(){
    current=[];
    for (index=0;index<next.length;index++)
        current.push(next[index]);
    next=[];
}

function getVertex(start,direction){
    var edgeDir="outE()";
    var reverseDirection="in";
    if(direction=="IN"){
        edgeDir="inE()";
        reverseDirection="out";
    }
    var edges=g.command("sql","select expand("+edgeDir +") from "+start.getId());
    for(h=0;h<edges.length;h++){
        var found=false;
        for(m=0;m<listEdges.length;m++){
            if(edges[h].getProperty("@class")==listEdges[m]){
                found=true;
                break;
            }
        }
        if(found==false){
            var vertex=g.command("sql","select expand("+ reverseDirection + ") from " +edges[h].getId());
            for(j=0;j<result.length;j++){
                if(result[j].getId().toString().equals(vertex[0].getId().toString()) ||
                    vertex[0].getId().toString().equals(rid)){
                    found=true;
                    break;
                }
            }
            if(found==false){
                result.push(vertex[0]);
                next.push(vertex[0]);
            }
        }
    }
}
select expand(result) from (select myFunction("#9:1",25,"[type1,type2]") as result)

Graph traversal based on value of property of Edge | OrientDB


Tag : development , By : Frank
Date : March 29 2020, 07:55 AM
Any of those help I have a graph which save topology of cloud infrastructure of a firm.It consists of Vertex called Object (Machines) and Edge called link (to denote how machines are linked to each other these links keep changing according as one machine can connect to different machines depending on need). , I was able to form a query that produced the desired output

Graph Traversal & Filtering with Gremlin using OrientDB


Tag : development , By : Simone
Date : March 29 2020, 07:55 AM
To fix the issue you can do Here's your graph - when asking questions about Gremlin it's always helpful to provide your sample data in this way:
graph = TinkerGraph.open()
g = graph.traversal()
g.addV('group').property('code','a').as('a').
  addV('group').property('code','b').as('b').
  addV('group').property('code','c').as('c').
  addV('choice').property('selected',true).
  addE('link').from('a').
  addV('choice').property('selected',false).
  addE('link').from('a').
  addV('choice').property('selected',false).
  addE('link').from('a').
  addV('choice').property('selected',false).
  addE('link').from('b').
  addV('choice').property('selected',false).
  addE('link').from('b').
  addV('choice').property('selected',false).
  addE('link').from('c').
  addV('choice').property('selected',true).
  addE('link').from('c').iterate()
gremlin> g.V().hasLabel('group').
......1>   where(__.not(out('link').has('selected',true))).
......2>   values('code')
==>b
g.V().has('label','group').filter{ it._().out('link').has('selected',true).hasNext() }
Related Posts Related QUESTIONS :
  • Sleep from within an Informix SPL procedure
  • License Models
  • Rational Purify failing to jump to memory leaks
  • Telligent's Community Server
  • Do people use the Hungarian Naming Conventions in the real world?
  • Memcached chunk limit
  • How do you pull the URL for an ASP.NET web reference from a configuration file in Visual Studio 2008?
  • How to add CVS directories recursively
  • Web App Beta
  • Virtual machine supporting multiple displays
  • LINQ to SQL strings to enums
  • How do I configure eclipse (zend studio 6) to hint and code complete several languages?
  • Recommended Fonts for Programming?
  • Automating VMWare or VirtualPC
  • How do I use more than one OpenID?
  • Domain Specific Language resources
  • Vista or XP for Dev Machine
  • Where can I get the Windows Workflow "wca.exe" application?
  • How to learn ADO.NET
  • What is a good barebones CMS or framework?
  • What's the Developer Express equivalent of System.Windows.Forms.LinkButton?
  • Is it acceptable for invalid XHTML?
  • Anyone soloing using fogbugz?
  • Using MBUnit in TeamCity
  • How to setup a crontab to execute at specific time
  • Linking two Office documents
  • How can I detect if a browser is blocking a popup?
  • Apply filter to t-foreach
  • Lotus Notes convert formula to agent
  • Problem with configuration of odoo for working with pycharm
  • Unexpected number of arguments when calling EM_JS function
  • What does the function state_fidelity() do in Qiskit?
  • Azure function with IoT Hub trigger get send device
  • Cluster similar words using word2vec
  • Add elements into an array then find distinct,
  • Angular8 - error TS2304: Cannot find name
  • Manually polling streams in future implementation
  • How do you perform receipt validation for Android on Xamarin Forms
  • What is the rule behind instruction count in Intel PIN?
  • How to draw some text when click a button in wxWidgets?
  • Restrict entity types in Spacy NER
  • How to animate CN1 Slider progress on load
  • Issue with bwa mem process not running on all output files from previous process
  • Delete videos from playlist using YouTube API
  • How to restart the Hyperledger Composer Playground locally
  • How to configure email alerts in Zabbix Server?
  • Simulator is not working for smart home action with all configured session
  • How parse data using join on Objection.js
  • Assign an array to a property in a Chapel Class
  • Netlogo: How can I obtain the accumulate value in Netlogo?
  • How to populate datasource for listview using api response in react native?
  • Why does gmail API when using history.list method send message ids without the field what action has been preformed on t
  • How to run an append query in ms access vba as part of a transaction
  • Wrong dates shown in Jekyll-based blog
  • How to concatenate two document lists in a webMethods flow service?
  • How to properly set up a site map addition in a customization project
  • IBM Content Collector error calling external Web Service
  • Is (0*1*)* equal to (0 | 1)*?
  • How do I configure phpMyAdmin to start with a blank sql query from the SQL tab?
  • "Objects are not valid as a React child" Redux error when conditionally connecting a component?
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com