Przeglądaj źródła

add graph_local

lizg 5 dni temu
rodzic
commit
57a4b7fb08

+ 145 - 0
odbctest/mql/problem/basic/graph_local/30graph_delete_data.mql

@@ -0,0 +1,145 @@
+delete from /m3graph_local/entity/vmware with version!
+/**
+onerror(continue,`not exist`,`not find`,`not found`)
+**/;
+
+delete from /m3graph_local/entity/weblogic with version!
+/**
+onerror(continue,`not exist`,`not find`,`not found`)
+**/;
+
+delete from /m3graph_local/entity/websphere with version!
+/**
+onerror(continue,`not exist`,`not find`,`not found`)
+**/;
+
+delete from /m3graph_local/entity/windows with version!
+/**
+onerror(continue,`not exist`,`not find`,`not found`)
+**/;
+
+delete from /m3graph_local/entity/x86 with version!
+/**
+onerror(continue,`not exist`,`not find`,`not found`)
+**/;
+
+delete from /m3graph_local/entity/aix with version!
+/**
+onerror(continue,`not exist`,`not find`,`not found`)
+**/;
+
+delete from /m3graph_local/entity/app with version!
+/**
+onerror(continue,`not exist`,`not find`,`not found`)
+**/;
+
+delete from /m3graph_local/entity/biz with version!
+/**
+onerror(continue,`not exist`,`not find`,`not found`)
+**/;
+
+delete from /m3graph_local/entity/cluster with version!
+/**
+onerror(continue,`not exist`,`not find`,`not found`)
+**/;
+
+delete from /m3graph_local/entity/db2 with version!
+/**
+onerror(continue,`not exist`,`not find`,`not found`)
+**/;
+
+delete from /m3graph_local/entity/esx with version!
+/**
+onerror(continue,`not exist`,`not find`,`not found`)
+**/;
+
+delete from /m3graph_local/entity/ha with version!
+/**
+onerror(continue,`not exist`,`not find`,`not found`)
+**/;
+
+delete from /m3graph_local/entity/hmc with version!
+/**
+onerror(continue,`not exist`,`not find`,`not found`)
+**/;
+
+delete from /m3graph_local/entity/http with version!
+/**
+onerror(continue,`not exist`,`not find`,`not found`)
+**/;
+
+delete from /m3graph_local/entity/linux with version!
+/**
+onerror(continue,`not exist`,`not find`,`not found`)
+**/;
+
+delete from /m3graph_local/entity/mal with version!
+/**
+onerror(continue,`not exist`,`not find`,`not found`)
+**/;
+
+delete from /m3graph_local/entity/mysql with version!
+/**
+onerror(continue,`not exist`,`not find`,`not found`)
+**/;
+
+delete from /m3graph_local/entity/openstack with version!
+/**
+onerror(continue,`not exist`,`not find`,`not found`)
+**/;
+
+delete from /m3graph_local/entity/oracle with version!
+/**
+onerror(continue,`not exist`,`not find`,`not found`)
+**/;
+
+delete from /m3graph_local/entity/pdu with version!
+/**
+onerror(continue,`not exist`,`not find`,`not found`)
+**/;
+
+delete from /m3graph_local/entity/power with version!
+/**
+onerror(continue,`not exist`,`not find`,`not found`)
+**/;
+
+delete from /m3graph_local/entity/router with version!
+/**
+onerror(continue,`not exist`,`not find`,`not found`)
+**/;
+
+delete from /m3graph_local/entity/sanstorage with version!
+/**
+onerror(continue,`not exist`,`not find`,`not found`)
+**/;
+
+delete from /m3graph_local/entity/sanswitch with version!
+/**
+onerror(continue,`not exist`,`not find`,`not found`)
+**/;
+
+delete from /m3graph_local/entity/sqlserver with version!
+/**
+onerror(continue,`not exist`,`not find`,`not found`)
+**/;
+
+delete from /m3graph_local/entity/switch with version!
+/**
+onerror(continue,`not exist`,`not find`,`not found`)
+**/;
+
+delete from /m3graph_local/entity/tomcat with version!
+/**
+onerror(continue,`not exist`,`not find`,`not found`)
+**/;
+
+delete from /m3graph_local/entity/ups with version!
+/**
+onerror(continue,`not exist`,`not find`,`not found`)
+**/;
+
+delete from /m3graph_local/entity/vlan with version!
+/**
+onerror(continue,`not exist`,`not find`,`not found`)
+**/;
+

+ 74 - 0
odbctest/mql/problem/basic/graph_local/31graph_drop_class.mql

@@ -0,0 +1,74 @@
+DROP EDGE TYPE m3graph_local.connect;
+DROP EDGE TYPE m3graph_local.contain;
+DROP EDGE TYPE m3graph_local.runon;
+DROP EDGE TYPE m3graph_local.depend;
+
+drop class if exists /m3graph_local/entity/vmware
+;
+drop class if exists /m3graph_local/entity/weblogic
+;
+drop class if exists /m3graph_local/entity/websphere
+;
+drop class if exists /m3graph_local/entity/windows
+;
+drop class if exists /m3graph_local/entity/x86
+;
+
+drop class if exists /m3graph_local/entity/aix
+;
+drop class if exists /m3graph_local/entity/app
+;
+drop class if exists /m3graph_local/entity/biz
+;
+
+drop class if exists /m3graph_local/entity/cluster
+;
+drop class if exists /m3graph_local/entity/db2
+;
+drop class if exists /m3graph_local/entity/esx
+;
+
+drop class if exists /m3graph_local/entity/ha
+;
+drop class if exists /m3graph_local/entity/hmc
+;
+drop class if exists /m3graph_local/entity/http
+;
+
+drop class if exists /m3graph_local/entity/linux
+;
+drop class if exists /m3graph_local/entity/mal
+;
+drop class if exists /m3graph_local/entity/mysql
+;
+
+drop class if exists /m3graph_local/entity/openstack
+;
+drop class if exists /m3graph_local/entity/oracle
+;
+drop class if exists /m3graph_local/entity/pdu
+;
+drop class if exists /m3graph_local/entity/power
+;
+
+drop class if exists /m3graph_local/entity/router
+;
+drop class if exists /m3graph_local/entity/sanstorage
+;
+drop class if exists /m3graph_local/entity/sanswitch
+;
+drop class if exists /m3graph_local/entity/sqlserver
+;
+
+drop class if exists /m3graph_local/entity/switch
+;
+drop class if exists /m3graph_local/entity/tomcat
+;
+drop class if exists /m3graph_local/entity/ups
+;
+drop class if exists /m3graph_local/entity/vlan
+;
+drop class if exists /m3graph_local/entity
+;
+drop class if exists /m3graph_local
+;

+ 46 - 0
odbctest/mql/problem/basic/graph_local/32graph_create_class.mql

@@ -0,0 +1,46 @@
+create class if not exists /m3graph_local() with core=local, ttl=366 day, namespace='m3graph_local';
+create class if not exists /m3graph_local/entity() with core=local, ttl=366 day, nickname='entity2_local';
+create class if not exists /m3graph_local/entity/vmware() with core=local, ttl=366 day, autosearch=true, version=true, nickname='vmware_local';
+create class if not exists /m3graph_local/entity/weblogic() with core=local,  ttl=366 day, autosearch=true, version=true, nickname='weblogic_local';
+create class if not exists /m3graph_local/entity/websphere() with core=local, ttl=366 day, autosearch=true, version=true, nickname='websphere_local';
+create class if not exists /m3graph_local/entity/windows() with core=local,  ttl=366 day, autosearch=true, version=true, nickname='windows_local';
+create class if not exists /m3graph_local/entity/x86() with core=local,  ttl=366 day, autosearch=true, version=true, nickname='x86_local';
+
+
+create class if not exists /m3graph_local/entity/aix() with core=local, ttl=366 day, autosearch=true, version=true, nickname='aix_local';
+create class if not exists /m3graph_local/entity/app() with core=local, ttl=366 day, autosearch=true, version=true,  nickname='app_local';
+create class if not exists /m3graph_local/entity/biz() with core=local,  ttl=366 day, autosearch=true, version=true,  nickname='biz_local';
+
+create class if not exists /m3graph_local/entity/cluster() with core=local,  ttl=366 day, autosearch=true, version=true,  nickname='cluster_local';
+create class if not exists /m3graph_local/entity/db2() with core=local,  ttl=366 day, autosearch=true, version=true,  nickname='db2_local';
+create class if not exists /m3graph_local/entity/esx() with core=local,  ttl=366 day, autosearch=true, version=true,  nickname='esx_local';
+
+create class if not exists /m3graph_local/entity/ha() with core=local,  ttl=366 day, autosearch=true, version=true,  nickname='ha_local';
+create class if not exists /m3graph_local/entity/hmc() with core=local,  ttl=366 day, autosearch=true, version=true,  nickname='hmc_local';
+create class if not exists /m3graph_local/entity/http() with core=local,  ttl=366 day, autosearch=true, version=true,  nickname='http_local';
+
+
+create class if not exists /m3graph_local/entity/linux() with core=local,  ttl=366 day, autosearch=true, version=true,  nickname='linux_local';
+create class if not exists /m3graph_local/entity/mal() with core=local,  ttl=366 day, autosearch=true, version=true,  nickname='mal_local';
+create class if not exists /m3graph_local/entity/mysql() with core=local,  ttl=366 day, autosearch=true, version=true,  nickname='mysql_local';
+
+create class if not exists /m3graph_local/entity/openstack() with core=local,  ttl=366 day, autosearch=true, version=true,  nickname='openstack_local';
+create class if not exists /m3graph_local/entity/oracle() with core=local,  ttl=366 day, autosearch=true, version=true,  nickname='oracle_local';
+create class if not exists /m3graph_local/entity/pdu() with core=local,  ttl=366 day, autosearch=true, version=true,  nickname='pdu_local';
+create class if not exists /m3graph_local/entity/power() with core=local,  ttl=366 day, autosearch=true, version=true,  nickname='power_local';
+
+create class if not exists /m3graph_local/entity/router() with core=local,  ttl=366 day, autosearch=true, version=true,  nickname='router_local';
+create class if not exists /m3graph_local/entity/sanstorage() with core=local,  ttl=366 day, autosearch=true, version=true,  nickname='sanstorage_local';
+create class if not exists /m3graph_local/entity/sanswitch() with core=local,  ttl=366 day, autosearch=true, version=true,  nickname='sanswitch_local';
+create class if not exists /m3graph_local/entity/sqlserver() with core=local,  ttl=366 day, autosearch=true, version=true,  nickname='sqlserver_local';
+
+create class if not exists /m3graph_local/entity/switch() with core=local,  ttl=366 day, autosearch=true, version=true,  nickname='switch_local';
+create class if not exists /m3graph_local/entity/tomcat() with core=local,  ttl=366 day, autosearch=true, version=true,  nickname='tomcat_local';
+create class if not exists /m3graph_local/entity/ups() with core=local,  ttl=366 day, autosearch=true, version=true,  nickname='ups_local';
+create class if not exists /m3graph_local/entity/vlan() with core=local,  ttl=366 day, autosearch=true, version=true,  nickname='vlan_local';
+
+/**
+sleep(2s)
+**/
+;
+

+ 11 - 0
odbctest/mql/problem/basic/graph_local/33graph_create_type.mql

@@ -0,0 +1,11 @@
+
+CREATE EDGE TYPE IF NOT EXISTS m3graph_local.connect '连接';
+CREATE EDGE TYPE IF NOT EXISTS m3graph_local.contain '包含';
+CREATE EDGE TYPE IF NOT EXISTS m3graph_local.runon '运行于';
+CREATE EDGE TYPE IF NOT EXISTS m3graph_local.depend '依赖';
+
+/**
+sleep(2s)
+**/
+;
+

+ 90 - 0
odbctest/mql/problem/basic/graph_local/34graph_insert_data.mql

@@ -0,0 +1,90 @@
+insert into /m3graph_local/entity/biz id="biz_local:查账系统",contain=["cluster_local:查账系统web集群","cluster_local:查账系统应用服务集群","ha_local:查账系统数据库HA"],depend=["biz_local:认证系统"];
+
+insert into /m3graph_local/entity/cluster id="cluster_local:查账系统web集群",contain=["http_local:查账http1","http_local:查账http2","http_local:查账http3","http_local:查账http4"];
+
+insert into /m3graph_local/entity/cluster id="cluster_local:查账系统应用服务集群",contain=["weblogic_local:weblogic1","weblogic_local:weblogic2","weblogic_local:weblogic3","app_local:app1","app_local:app2","app_local:app3"];
+
+insert into /m3graph_local/entity/ha id="ha_local:查账系统数据库HA",contain=["oracle_local:oracle1","oracle_local:oracle2"];
+
+insert into /m3graph_local/entity/http id="http_local:查账http1",runon=["linux_local:linux1"];
+insert into /m3graph_local/entity/http id="http_local:查账http2",runon=["linux_local:linux3"];
+insert into /m3graph_local/entity/http id="http_local:查账http3",runon=["linux_local:linux5"];
+insert into /m3graph_local/entity/http id="http_local:查账http4",runon=["linux_local:linux8"];
+
+insert into /m3graph_local/entity/oracle id="oracle_local:oracle1",runon=["linux_local:linux6"];
+insert into /m3graph_local/entity/oracle id="oracle_local:oracle2",runon=["linux_local:linux9"];
+
+insert into /m3graph_local/entity/app id="app_local:app1",depend=["weblogic_local:weblogic1"],runon=["linux_local:linux2"];
+insert into /m3graph_local/entity/app id="app_local:app2",depend=["weblogic_local:weblogic2"],runon=["linux_local:linux4"];
+insert into /m3graph_local/entity/app id="app_local:app3",depend=["weblogic_local:weblogic3"],runon=["linux_local:linux7"];
+
+insert into /m3graph_local/entity/weblogic id="weblogic_local:weblogic1",runon=["linux_local:linux2"];
+insert into /m3graph_local/entity/weblogic id="weblogic_local:weblogic2",runon=["linux_local:linux4"];
+insert into /m3graph_local/entity/weblogic id="weblogic_local:weblogic3",runon=["linux_local:linux7"];
+
+insert into /m3graph_local/entity/linux id="linux_local:linux1",runon=["esx_local:esx1"];
+insert into /m3graph_local/entity/linux id="linux_local:linux2",runon=["esx_local:esx1"];
+insert into /m3graph_local/entity/linux id="linux_local:linux3",runon=["esx_local:esx1"];
+insert into /m3graph_local/entity/linux id="linux_local:linux4",runon=["esx_local:esx2"];
+insert into /m3graph_local/entity/linux id="linux_local:linux5",runon=["esx_local:esx2"];
+insert into /m3graph_local/entity/linux id="linux_local:linux6",runon=["esx_local:esx2"];
+insert into /m3graph_local/entity/linux id="linux_local:linux7",runon=["esx_local:esx3"];
+insert into /m3graph_local/entity/linux id="linux_local:linux8",runon=["esx_local:esx3"];
+insert into /m3graph_local/entity/linux id="linux_local:linux9",runon=["esx_local:esx3"];
+
+insert into /m3graph_local/entity/esx id="esx_local:esx1",connect=["switch_local:switch1","sanswitch_local:sanswitch1"];
+insert into /m3graph_local/entity/esx id="esx_local:esx2",connect=["switch_local:switch2","sanswitch_local:sanswitch1"];
+insert into /m3graph_local/entity/esx id="esx_local:esx3",connect=["switch_local:switch3","sanswitch_local:sanswitch1"];
+
+insert into /m3graph_local/entity/switch id="switch_local:switch1",connect=["esx_local:esx1","esx_local:esx4","esx_local:esx5","switch_local:switch4","switch_local:switch5"];
+insert into /m3graph_local/entity/switch id="switch_local:switch2",connect=["esx_local:esx2","switch_local:switch4","switch_local:switch5"];
+insert into /m3graph_local/entity/switch id="switch_local:switch3",connect=["esx_local:esx3","switch_local:switch4","switch_local:switch5"];
+
+insert into /m3graph_local/entity/switch id="switch_local:switch4",connect=["switch_local:switch1","switch_local:switch2","switch_local:switch3","router_local:router1","router_local:router2"];
+insert into /m3graph_local/entity/switch id="switch_local:switch5",connect=["switch_local:switch1","switch_local:switch2","switch_local:switch3","router_local:router1","router_local:router2"];
+
+insert into /m3graph_local/entity/router id="router_local:router1",connect=["switch_local:switch4","switch_local:switch5","router_local:router3","router_local:router4"];
+insert into /m3graph_local/entity/router id="router_local:router2",connect=["switch_local:switch4","switch_local:switch5","router_local:router3","router_local:router4"];
+
+insert into /m3graph_local/entity/router id="router_local:router3",connect=["router_local:router1","router_local:router2","switch_local:switch6","switch_local:switch7"];
+insert into /m3graph_local/entity/router id="router_local:router4",connect=["router_local:router1","router_local:router2","switch_local:switch6","switch_local:switch7"];
+
+insert into /m3graph_local/entity/switch id="switch_local:switch6",connect=["router_local:router3","router_local:router4"];
+insert into /m3graph_local/entity/switch id="switch_local:switch7",connect=["router_local:router3","router_local:router4"];
+
+insert into /m3graph_local/entity/sanswitch id="sanswitch_local:sanswitch1",connect=["esx_local:esx1","esx_local:esx2","esx_local:esx3","esx_local:esx4","esx_local:esx5","sanstorage_local:sanstorage1"];
+
+insert into /m3graph_local/entity/sanswitch id="sanswitch_local:sanswitch2";
+
+insert into /m3graph_local/entity/sanstorage id="sanstorage_local:sanstorage1",connect=["sanswitch_local:sanswitch1"];
+
+insert into /m3graph_local/entity/biz id="biz_local:认证系统",contain=["ha_local:认证系统数据库HA","ha_local:认证系统应用服务集群"];
+
+insert into /m3graph_local/entity/ha id="ha_local:认证系统数据库HA",contain=["db2_local:db21","db2_local:db22"];
+
+insert into /m3graph_local/entity/ha id="ha_local:认证系统应用服务集群",contain=["weblogic_local:weblogic4","weblogic_local:weblogic5","app_local:app4","app_local:app5"];
+
+insert into /m3graph_local/entity/db2 id="db2_local:db21",runon=["linux_local:linux10"];
+insert into /m3graph_local/entity/db2 id="db2_local:db22",runon=["linux_local:linux12"];
+
+insert into /m3graph_local/entity/weblogic id="weblogic_local:weblogic4",runon=["linux_local:linux11"];
+insert into /m3graph_local/entity/weblogic id="weblogic_local:weblogic5",runon=["linux_local:linux13"];
+
+insert into /m3graph_local/entity/app id="app_local:app4",runon=["linux_local:linux11"];
+insert into /m3graph_local/entity/app id="app_local:app5",runon=["linux_local:linux13"];
+
+insert into /m3graph_local/entity/linux id="linux_local:linux10",runon=["esx_local:esx4"];
+insert into /m3graph_local/entity/linux id="linux_local:linux11",runon=["esx_local:esx4"];
+insert into /m3graph_local/entity/linux id="linux_local:linux12",runon=["esx_local:esx5"];
+insert into /m3graph_local/entity/linux id="linux_local:linux13",runon=["esx_local:esx5"];
+
+insert into /m3graph_local/entity/esx id="esx_local:esx4",connect=["switch_local:switch1","sanswitch_local:sanswitch1"];
+insert into /m3graph_local/entity/esx id="esx_local:esx5",connect=["switch_local:switch1","sanswitch_local:sanswitch1"];
+
+create ("sanstorage_local:sanstorage1")-[:connect]->("sanswitch_local:sanswitch2")
+
+/**
+sleep(2s)
+**/
+;
+

+ 20 - 0
odbctest/mql/problem/basic/graph_local/35graph_match.mql

@@ -0,0 +1,20 @@
+match ("biz_local:查账系统")-[:contain*1]->()-[*]->("esx_local:*")-[*1]->('switch_local:*')
+/**
+output()
+match("graph.nodes.len",46)
+**/
+;
+
+match (b:"biz_local:*")-[*]->(e:"esx_local:*")-[*1]->(s:"switch_local:*") short path b,e,s
+/**
+output()
+match("graph.paths.len",18)
+**/
+;
+
+match ("biz_local:查账系统")-[:contain]->("cluster_local:查账系统web集群")-[*]->() until "switch_local:*"
+/**
+output()
+match("graph.nodes.len",18)
+**/
+;

+ 16 - 0
odbctest/mql/problem/basic/graph_local/36case_sensitive.mql

@@ -0,0 +1,16 @@
+
+
+
+match (:/m3graph_local/entity/sanstorage)-[:connect]->(:/m3graph_local/entity/sanswitch)
+/**
+output()
+match("graph.edges.len",2,"graph.nodes.len",3)
+**/
+;
+
+match (:/m3graph_local/entity/Sanstorage)-[:connect]->(:/m3graph_local/entity/Sanswitch)
+/**
+output()
+match("graph.edges.len",2,"graph.nodes.len",3)
+**/
+;