Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Extend BROWSER show-links
Answer
5/22/16 1:54 PM
Hello,
I have made some standardised sparql queries and i want to return the results in SeMFIS using CC "AdoScript" BROWSER show-links command.
For this reason i have made a jar file which i call in my adoscript asc file and return the results in a txt file. 
Then, i put the results in an array and i want to show them via BROWSER show-links to user.
But i realised that i can't use the content of browser dynamically e.g. it couldn't create as many rows as the results are anytime a query is done and set in the variables o:, c: m: the values of variables instead of static values.
Here is a snippet of my adoscript code:
...
 1
 2SYSTEM ("cmd /c java -jar "+jarFile+" "+myOwlPath+" "+resultsQueries)
 3CC "AdoScript"  FREAD file: (resultsQueries) binary:0 base64:0
 4SET sResultQuery: (text)
 5SET sSepLine: "\n"
 6SET actArray: (array(0))
 7FOR sQueryInfo in: (sResultQuery) sep: (sSepLine)
 8{
 9  #CC "AdoScript" INFOBOX ("sQueryInfo is: " + sQueryInfo)
10  SET param1: (search(sQueryInfo, "activity:", 0))
11  #CC "AdoScript" INFOBOX ("param1 is: " + STR param1)
12  IF(param1 = 0)
13  {
14    SET act: (copy(sQueryInfo, 9, LEN sQueryInfo))
15    SET act: (replall(act, "_", " "))
16    SET dummy: (aappend(actArray, act))
17    #CC "AdoScript" INFOBOX ("act is: " + act)
18  }
19}
20
21  #SET actParam: (actArray[i])
22  CC "AdoScript" BROWSER  show-links
23                        objref-format:"%c: %o (of model %m [%t])"
24                        title:"My Query Results"
25                        content:";Type;Reference\t
26            FOR i from:0 to: (actArray.length-1)
27                        {
28              SET j: i+1
29                          j;Activity;REF mt:\"Business process diagram (BPMN 2.0)\" m:\"annotated_onLineShop 1.0\" c:\"Task\" o: (actArray[i])\t
30            }"
31                       linesep: "\t"
32                        with-handlecolumn header:"Save\nthis header" print-header:"Print\nthis header"


Of course nothing happens because of FOR loop inside the 'content' of BROWSER.
Is there a way to make the CC "AdoScript" BROWSER show-links dynamically? 
If not, is there another way to show the results dynamically as a table with links?

Thank you in advance,
Ioanna

RE: Extend BROWSER show-links
Answer
5/23/16 6:42 AM as a reply to Ioanna Ramoutsaki.
Hello Ioanna,
How is this functionality triggered? And I would also kindly ask you to attach also the library with your AdoScript in order to find an appropriate solution for you. 

RE: Extend BROWSER show-links
Answer
5/23/16 6:33 PM as a reply to Mehmet Albayrak.
Hello,

In 'Analysis' menu, i have made a sub-menu called 'sparql queries' which execute the 'sparql.asc' file. This file gets all the annotated BPMN models of the explorer and the 'basicBPMN_Ontology' model of the explorer too and creates an owl file in which the annotated BPMN models are instances of the basicBPMN_Ontology.
After that, this owl file is uploaded in virtuoso and  makes some standardised queries on it. The user has the opportunity to select which query to be executed and with which parameters. 
The result of the selected query i want to be displayed on the user as a table with links. 
For example on the query: 'Give me all the activities which have semantic annotation with the class ... (e.g. to_search_for_product)'
I want to get the table with the results as it seems in the attach icon.
I also attach my library.

I'll appreciate any help.

With regards,
Ioanna
Attachment

Attachments: extendigSeMFIS_230516.abl (52,750.5k), sparql_query_results.PNG (58.0k)

RE: Extend BROWSER show-links
Answer
5/25/16 7:56 AM as a reply to Ioanna Ramoutsaki.
Hello Ioanna,
Because of the lack of Virtuoso on localhost your VirtuosoSparqlQueries.jar file return a connection error, and we were not able to recunstruct your scenario/functionality (consider this also if you want to hand on your application library/modelling tool and avoid additional tool installations). Can you please attach a 'resultQueries'-file as an output from the line

1SYSTEM ("cmd /c java -jar "+jarFile+" "+myOwlPath+" "+resultsQueries)

RE: Extend BROWSER show-links
Answer
5/25/16 4:20 PM as a reply to Mehmet Albayrak.
Hello,

Thank you for your advice as far as virtuoso sparql endpoint is concerned. I indeed must take it into consideration. 
I attach 3 txt files, one for each query of the followings:
1. Give me all the activities which have semantic annotation with the class ... (e.g. to_search_for_product), as well as the process which belong in.
2. Give me all distinct activities inside a subprocess and the subprocess.
3. Get all activities which is connected with the activity ... (e.g. choose a product)with the relation ... (e.g. subsequent)

thank you in advance.

With regards,
Ioanna
Attachments: resultsquery1.txt (0.2k), resultsquery2.txt (0.4k), resultsquery3.txt (0.0k)

RE: Extend BROWSER show-links
Answer
5/27/16 1:05 PM as a reply to Ioanna Ramoutsaki.
Dear Ioanna,
The content that should be displayed in a browser window should be configured/defined before you call the BROWSER command as follows:

 1CC "AdoScript" FREAD file: ("D:\\newresultsquery1.txt") binary:0 base64:0
 2SET sResultQuery: (text)
 3SET sSepLine: "\n"
 4SET actArray: (array(0))
 5SET sBrowserContent: ("")
 6FOR sQueryInfo in: (sResultQuery) sep: (sSepLine) {
 7  ## In the variable 'param1' we get the results that concern the activities of the models.
 8  SET param1: (search(sQueryInfo, "activity:", 0))
 9  SET param2: (search(sQueryInfo, ";", 9))
10  SET param3: (search(sQueryInfo, ":",param2))
11  #CC "AdoScript" INFOBOX (param2)
12    IF(param1 = 0) {
13      SET act: (copy(sQueryInfo, 9, (param2-9)))
14      SET sptype: (copy(sQueryInfo, param2+1, (param3-param2-1)))
15      SET smodel: (copy(sQueryInfo, param3+1, (LEN sQueryInfo)-1))
16
17      # replace underlines within the names
18      #!!!!!!!!!!NOTE: if there exists underlines in the modelling name than the name is not valid anymore!!!!!!!!!!!!         
19      SET act: (replall(act, "_", " "))
20      SET smodel: (replall(smodel, "annotated_", ""))
21      SET smodel: (replall(smodel, "_", " "))
22      SET smodel: ("annotated_"+smodel)
23
24      SET dummy: (aappend(actArray, act))
25      #CC "AdoScript" INFOBOX ("act is: " + act)   
26      IF (sBrowserContent="") {    
27        SET sBrowserContent: (";Activitytype;Processtype;Reference\n;Activity;"+sptype+";REF mt:\"Business process diagram (BPMN 2.0)\" m:\""+smodel+"\" c:\"Task\" o:\"" +act+ "\"\n")   
28        } ELSE {      
29         SET sBrowserContent: (sBrowserContent + ";Activity;"+sptype+";REF mt:\"Business process diagram (BPMN 2.0)\" m:\""+smodel+"\" c:\"Task\" o:\"" +act+ "\"\n")
30       }
31   }
32}
33#delete the last linebreak
34SET sBrowserContent: (copy(sBrowserContent, 0, ((LEN sBrowserContent)-1)))
35CC "AdoScript" EDITBOX text: (sBrowserContent)
36
37CC "AdoScript" BROWSER  show-links
38                            objref-format:"%c: %o (of model %m [%mt])"linesep: "\n"
39                            modref-format:"Model %m of type %mt"
40                            title:"My Query Results"
41                            content: (sBrowserContent)
42                            with-handlecolumn header:"Save\nthis header" print-header:"Print\nthis header"

Note that:
1) If you want to read also the modelname and the processtype from your results and display it in the BROWSER (as above), then take another seperator between the activity and the process than each result (see e.g. newresultsquery1.txt)
2) It is not allowed to reference to relations -like in your resultsquery2.txt
3) You can also work with maps instead of lines 8-10 and 13-15 (see https://www.adoxx.org/live/faq/-/message_boards/message/139305)
4) Names should not be changed during the whole process either in the sparql query nor in AdoScript (See line 17 ff) as they are the identifier of the reference. 

.
Attachments: newresultsquery1.txt (0.2k), sparql.asc (2.1k)

RE: Extend BROWSER show-links
Answer
5/31/16 4:01 AM as a reply to Mehmet Albayrak.
Thank you so much for your help!!!