iKnow + Atelier, hello world?

Hello! 

I'm trying to make a simple hello world program for iKnow but the documentation only shows examples using the scripting language or XML XData. 

The domain is already created and configured, what I hope for is to be able to work with the data in some high-level language. 

Is it possible to do something like this:

 


int domainId = 1;
IKnow iknow = new IKnow( domainId );
List concepts = iknow.getTopConcepts();

Any feedback will be greatly appreciated!

  • + 1
  • 0
  • 290
  • 8
  • 0

Comments

If you think, that really need some new language in Caché. You can add with some limitiations, if Studio already can highlight that language. Now you can do it only in Studio, Atelier does not support it. I've already wrote a short post about something like you want. And about javascript-like language which can be executed on server side, because compiles into COS, yet in russian, and it will be transleted in english some time later. In that my article, I used as an example code

// hello
console.log('Hello World!');

var name='';
read('What is your name? ', name);
println('Hello ' + name + '!');

which compiles to

;generated at 2014-05-18 20:06:36
    Write "Hello World!",!
    new name
    set name = ""
    read "What is your name? ", name,!
    Write "Hello "_ name _"!",!

No, Dmitry, the original question is not about any presented or missing high-level language support, but rather about simplest approach to deal with iKnow data from any high-level language (in this case it looked like C++) working at client side.

Like like generation of C++ binding projection code is inevitable here.

Post names as iKnow +Atelier, and I guess it means server side language, not client side. That's why I offered this variant.

Hello! 

I'm sorry for the confusion. We are doing a qualitative study on a set of documents to see if we can find important features in them. What we want to do is answer the question "Which of these documents contains this CRC". 

I don't know if this is easier to do client side or server side but it don't think it matters in our case. The reason I wrote Atelier was because I thought that was the simplest way to get started for a beginner. 

If you have any suggestions on alternative methods I'd be happy to hear them!
I know PHP and SQL, is it possible to query iKnow from PHP? It seems possible but I could find anything on Learn -> FAQ or Google. If it's possible I would greatly appreciate if you could point me to some documentation on the subject.

Thank you all for the great answers!   

 

Hi Benjamin,

 

if you're familiar with Caché ObjectScript, that's the easiest way to work with iKnow. For example, the script below will add two short "sources" (documents) to your domain and then query the top concepts:

set domainID = 1, domainName = $system.iKnow.GetDomainName(domainID)

write $system.iKnow.IndexString(domainName, "123", "This is a first piece of text to be added to your iKnow domain!")

write $system.iKnow.IndexString(domainName, "234", "This is the second piece of text to be added to your iKnow domain! And guess what, it's an even more inspirational one!")

write ##class(%iKnow.Queries.EntityAPI).GetTop(.result, domainID)

zwrite result

 

For a good start with iKnow, take a look at this iKnow video and the next ones in the iKnow playlist.

 

If you prefer to work with SQL and loaded your domain through the iKnow Architect in the management portal, you can invoke those same query APIs through either of the following calls (for domain ID = 1):

CALL %iKnow_Queries.EntityQAPI_GetTop(1)

SELECT * FROM %iKnow_Queries.EntityQAPI_GetTop(1)

Hello Benjamin!

I haven't used Caché ObjectScript before but I'll glady learn it if it's the best way to interact with iKnow. 

Thank you for the video. I think understand the fundamantals about CRCs and paths and all. What I don't understand is how to write a program that can do what the Knowledge Portal does.

In our case we have a lot of phone calls that has been transcribed to text. What we want is to give each call a score based on if they contain some CRCs or not.  The scoring can be done elsewhere but from iKnow need to extract the set of calls that contains some CRCs.

 

I tried running your code in the terminal and it worked great. However, there seems to be a problem running it in Atelier. What I did was: New -> Routine File -> COS Routing (.mac). I didn't choose any optional package, then pasted your code. 

I'm very thankful for all the help! 

The first character on each new line of a Caché routine needs to be a label or function name.  Add a tab to the beginning of each of your lines and I will bet you'll find it works better :)

Hi Benjamin (sounds like a conversation amongst just Benjamins now!),

 

The knowledge portal demonstration interface you find in the %iKnow.UI package (which gets a significant visual overhaul in 2016.3) is written using InterSystems' Zen technology, a web development framework that helps you combine client-side JavaScript and server-side Caché ObjectScript to build web applications. If you're good with PHP and/or JavaScript, there's no strict need to dig into Zen to build an iKnow-powered application. You can either use ODBC to connect to Caché and use SQL as in the above examples to query an iKnow domain, or you can build a simple REST service on top of iKnow (in Caché ObjectScript) and query that from your PHP/JavaScript code. We'll be releasing an out-of-the-box REST interface with 2016.3, but it's no rocket science to build one that fits your needs on earlier versions. If you already have an ISC sales engineering contact (none of them called Benjamin, unfortunately ;o) ), we can work together to get you up and running.

 

FYI, this github repo contains a simple iKnow demo application written with AngularJS and a REST interface. It's technically speaking a CSP page (yet another ISC web technology at a lower level than Zen), but could have been a straight HTML page.

 

 

Regards,

Benjamin