发布新帖

查找

公告
· 四月 11, 2022

InterSystems CCR Technical Implementation Specialist Certification Exam is now LIVE!

Get certified on InterSystems CCR!

Hello Community,

After beta testing the new CCR Technical Implementation Specialist exam, the Certification Team of InterSystems Learning Services has performed the necessary calibration and adjustments to release it to our community. It is now ready for purchase and scheduling in the InterSystems certification exam catalog. Potential candidates can review the exam topics and the practice questions to help orient them to exam question approaches and content. Passing the exam allows you to claim an electronic certification badge that can be embedded in social media accounts such as Linkedin.  

If you are new to InterSystems Certification, please review our program pages that include information on taking examsexam policiesFAQ and more. Also, check out our Organizational Certification that can help your organization access valuable business opportunities and establish your organization as a solid provider of InterSystems solutions in our marketplace. 

The Certification Team of InterSystems Learning Services is excited about this new exam and we are also looking forward to working with you to create new certifications that can help you advance your career. We are always open to ideas and suggestions at certification@intersystems.com.

One final note: The Certification Team will be proctoring free certification exams ($150 value) at Global Summit 2022. All of the products in our exam catalog will be available. The summit will be in Seattle, WA from June 20-23. All individuals registered for the Summit will be eligible for one free certification exam (that must be taken during the Summit at one of the live proctoring sessions).

Looking forward to celebrating your success, 

Shane Nowack - Certification Exam Developer, InterSystems

3 Comments
讨论 (3)3
登录或注册以继续
讨论 (0)0
登录或注册以继续
文章
· 四月 5, 2022 阅读大约需 7 分钟

Using Globals as a graph database to store and retrieve graph structure data

image

Hi Community,

This post is a introduction of my openexchange iris-globals-graphDB application.
In this article I will demonstrate how to save and retrieve Graph Data into InterSystems Globals with the help of Python Flask Web Framework and PYVIS Interactive network visualizations Library

Recommendation

 

Step1 : Establish Connection with IRIS Globals by using python native SDK

 #create and establish connection
  if not self.iris_connection:
         self.iris_connection = irisnative.createConnection("localhost", 1972, "USER", "superuser", "SYS")
                                     
  # Create an iris object
  self.iris_native = irisnative.createIris(self.iris_connection)
  return self.iris_native

 

Step2 : Save data to globals by using  iris_native.set( ) function     

#import nodes data from csv file
isdefined = self.iris_native.isDefined("^g1nodes")
if isdefined == 0:
    with open("/opt/irisapp/misc/g1nodes.csv", newline='') as csvfile:

 reader = csv.DictReader(csvfile)
 for row in reader:
    self.iris_native.set(row["name"], "^g1nodes", row["id"])

 #import edges data from csv file
 isdefined = self.iris_native.isDefined("^g1edges")
 if isdefined == 0:
    with open("/opt/irisapp/misc/g1edges.csv", newline='') as csvfile:
 reader = csv.DictReader(csvfile)
 counter = 0                
 for row in reader:
    counter = counter + 1
    #Save data to globals
    self.iris_native.set(row["source"]+'-'+row["target"], "^g1edges", counter)  

 

Step3: Pass nodes and edges data to PYVIS from globals by using iris_native.get() function

 #Get nodes data for basic graph    
  def get_g1nodes(self):
        iris = self.get_iris_native()
        leverl1_subscript_iter = iris.iterator("^g1nodes")
        result = []
        # Iterate over all nodes forwards
        for level1_subscript, level1_value in leverl1_subscript_iter:
            #Get data from globals
            val = iris.get("^g1nodes",level1_subscript)
            element = {"id": level1_subscript, "label": val, "shape":"circle"}
            result.append(element)            
        return result

    #Get edges data for basic graph  
    def get_g1edges(self):
        iris = self.get_iris_native()
        leverl1_subscript_iter = iris.iterator("^g1edges")
        result = []
        # Iterate over all nodes forwards
        for level1_subscript, level1_value in leverl1_subscript_iter:
            #Get data from globals
            val = iris.get("^g1edges",level1_subscript)
            element = {"from": int(val.rpartition('-')[0]), "to": int(val.rpartition('-')[2])}
            result.append(element)            
        return result

 

Step4: Use PYVIS Javascript to generate graph data

<script type="text/javascript">
    // initialize global variables.
    var edges;
    var nodes;
    var network;
    var container;
    var options, data;
  
    // This method is responsible for drawing the graph, returns the drawn network
    function drawGraph() {
        var container = document.getElementById('mynetwork');
        let node = JSON.parse('{{ nodes | tojson }}');
        let edge = JSON.parse('{{ edges | tojson }}');
     
        // parsing and collecting nodes and edges from the python
        nodes = new vis.DataSet(node);
        edges = new vis.DataSet(edge);

        // adding nodes and edges to the graph
        data = {nodes: nodes, edges: edges};

        var options = {
            "configure": {
                "enabled": true,
                "filter": [
                "physics","nodes"
            ]
            },
            "nodes": {
                "color": {
                  "border": "rgba(233,180,56,1)",
                  "background": "rgba(252,175,41,1)",
                  "highlight": {
                    "border": "rgba(38,137,233,1)",
                    "background": "rgba(40,138,255,1)"
                  },
                  "hover": {
                    "border": "rgba(42,127,233,1)",
                    "background": "rgba(42,126,255,1)"
                 }
                },

                "font": {
                  "color": "rgba(255,255,255,1)"
                }
              },
            "edges": {
                "color": {
                    "inherit": true
                },
                "smooth": {
                    "enabled": false,
                    "type": "continuous"
                }
            },
            "interaction": {
                "dragNodes": true,
                "hideEdgesOnDrag": false,
                "hideNodesOnDrag": false,
                "navigationButtons": true,
                "hover": true
            },

            "physics": {
                "barnesHut": {
                    "avoidOverlap": 0,
                    "centralGravity": 0.3,
                    "damping": 0.09,
                    "gravitationalConstant": -80000,
                    "springConstant": 0.001,
                    "springLength": 250
                },

                "enabled": true,
                "stabilization": {
                    "enabled": true,
                    "fit": true,
                    "iterations": 1000,
                    "onlyDynamicEdges": false,
                    "updateInterval": 50
                }
            }
        }
        // if this network requires displaying the configure window,
        // put it in its div
        options.configure["container"] = document.getElementById("config");
        network = new vis.Network(container, data, options);
        return network;
    }
    drawGraph();
</script>

 

Step5: Calling above codes from app.py main file

#Mian route. (index)
@app.route("/")
def index():
    #Establish connection and import data to globals
    irisglobal = IRISGLOBAL()
    irisglobal.import_g1_nodes_edges()
    irisglobal.import_g2_nodes_edges()

    #getting nodes data from globals
    nodes = irisglobal.get_g1nodes()
    #getting edges data from globals
    edges = irisglobal.get_g1edges()

    #To display graph with configuration
    pyvis = True
    return render_template('index.html', nodes = nodes,edges=edges,pyvis=pyvis)    


Thanks 

2 Comments
讨论 (2)1
登录或注册以继续
文章
· 三月 29, 2022 阅读大约需 1 分钟

プログラムでCSVファイルを1行ずつ読み込む方法

これは、InterSystems FAQサイトの記事です。
 

%SQL.Util.Proceduresクラスの CSV() プロシジャを使用することにより、実現できます。
下記が使用例のコードとなります。(test.csvというファイルが c:\temp にあるという前提)

 Set rowtype="Name VARCHAR(50),UID VARCHAR(50), PHONE VARCHAR(50)"
 Set filename="c:\temp\test.csv"
 Set result=##class(%SQL.Statement).%ExecDirect(,"call %SQL_Util.CSV(,?,?)",.rowtype,filename)
 Set rset =result.%NextResult()
 
 // 全件表示したい場合は、do rset.%Display()
 While rset.%Next() {
     Write "Name:",rset.%GetData(1)," UID:",rset.%GetData(2)," PHONE:",rset.%GetData(3),!
     }

 Set rset="",result=""
 Quit

 

上記を実行することにより結果セットとして各行およびフィールドにアクセスできます。
実行例:

USER>do ^CSV
Name    UID     PHONE
山田,太郎 0001    080-1111-1111
bbb     0003    090-2222-2222
ccc     0009    "050-3333-3333"
ddd     0010    0120-17-1972
4 Rows(s) Affected

 

 %SQL.Util.Proceduresクラスのクラスリファレンスも併せてご確認ください。
クラスリファレンス:%SQL.Util.Procedures.CSV()

3 Comments
讨论 (3)1
登录或注册以继续
文章
· 三月 27, 2022 阅读大约需 2 分钟

.Net Gateway(オブジェクトゲートウェイ)で外部DLLを使用する方法

これはInterSystems FAQ サイトの記事です。

  • まず予め Visual Studioを使用して、呼び出したい内容のクラスライブラリを作成します。
  • そのプロジェクトをコンパイルし、DLLを作成します。
  • 管理ポータルでオブジェクトゲートウェイを作成します。   システム管理 > 構成 > 接続性 > オブジェクトゲートウェイ ゲートウェイ名 : testGateway サーバ名 / IPアドレス : 127.0.0.1 ポート : 55000 (後はデフォルト)  
  • testGateway を開始します。


※管理ポータルから、もしくはコマンドから開始できます。 

do ##class(%Net.Remote.Service).StartGateway(gateway.Name)
  •   以下のいずれかの方法でDLLを呼び出すプロキシクラスを作成します。

       a. コマンドで作成する場合 

     set dllPath="C:\temp\TestDll.dll
     do ##class(%Net.Remote.Gateway).%ExpressImport(dllPath, 55000, "127.0.0.1")

       b. スタジオで作成する場合


 [ツール] - [アドイン] - [.Net ゲートウェイウィザード] ⑥ 以下のような手順でコードを実行します。

例: 

  Set gateway=##class(%Net.Remote.Gateway).%New()
   set host="localhost"
   set port=55000
   set namespace="USER"
   set timeout=2
   Set classPath=##class(%ListOfDataTypes).%New()
   Set samplePath="C:\temp\TestDll.dll"
   Do classPath.Insert(samplePath)
  Set status=gateway.%Connect(host,port,namespace,timeout,classPath)
   write !,"status: ",status
   set cl=##class(TestDll.MyDllClass).%New(gateway)
   do cl.test(gateway)

 

最後の行の do cl.test(..) は、VisualStudioで作成したクラスライブラリの関数になります。

 

呼び出し引数は、作成したプロキシクラスに従ってください。

讨论 (0)1
登录或注册以继续