Author Topic: Alternate Input methods and API samples  (Read 15955 times)

Offline coldfire

  • Newbie
  • *
  • Posts: 13
    • View Profile
Alternate Input methods and API samples
« on: April 07, 2009, 18:02:40 »
In order to run any BN with hugin java api, one has to give as argument the .net file which has the network info. Is there any possibility to take xml based (rdf-triples) or anyother input representation formats as well ?


the examples given with hugin release are only .net/.oobn files....there should be some API realted examples as well in order to know, how to use and run.

Offline coldfire

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: Alternate Input methods and API samples
« Reply #1 on: April 08, 2009, 11:59:37 »
In addition,

Do we always have to provide the .net file for java api to run it or we can create the network on the go while running behind some application. The reason i am asking this question is,

I have an application which includes some data that I will use to create my network-of-nodes. But, the data is not discrete and may change with the change of selection (of options), eventually creating the network at run time.
So, the problem is I dont have the .net file already built to do the reasoning instead, it depends on the dynamic input coming from the user-interaction via application.

Offline Anders L Madsen

  • HUGIN Expert
  • Hero Member
  • *****
  • Posts: 2295
    • View Profile
Re: Alternate Input methods and API samples
« Reply #2 on: April 08, 2009, 13:20:44 »
The network can be constructed at run time using APIs. The HUGIN software package includes examples for different programming language. The examples are included in the "Test" directory. For instance, the BuildNetwork.cpp example shows how to construct a network at run time using C++ (it is similar for other programming language).

There is another simple example here: http://forum.hugin.com/index.php?topic=131.0

We can provide other examples, if you are not using C++.

Hope this helps.
HUGIN EXPERT A/S

Offline coldfire

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: Alternate Input methods and API samples
« Reply #3 on: April 08, 2009, 18:44:59 »
that solves the one of my questions....
I run the test file LoadAndPropagate.java in Test folder. But it always gives exception of loading Domain. The .net file is placed at the right location and it reads it but fails to excute after this line
Code: [Select]
            Domain domain = new Domain (netName + ".net", parseListener);
it says:

Quote
Exception caught: A fatal error occurred during an input or output operation.  This could be a failure to open a specified file, a failure to create a file due to wrong permissions, a failure during a write operation due to the disk running full, etc.

my 2nd question was realted to alternate input formats....instead of .net file, I want to make an xml tree to load as a network....still searching answers....

Offline Anders L Madsen

  • HUGIN Expert
  • Hero Member
  • *****
  • Posts: 2295
    • View Profile
Re: Alternate Input methods and API samples
« Reply #4 on: April 08, 2009, 19:08:33 »
Quote
The .net file is placed at the right location and it reads it but fails to excute after this line

Please provide the command with all arguments that produces the error (Notice that the program assumes the network to be stored in a file with suffix "net")

Quote
I want to make an xml tree to load as a network....still searching answers....

The HUGIN APIs does not support XML. You will have to implement an XML parser using appropriate HUGIN API commands to construct the network. Notice that the format of the HUGIN Network Language is specified in the HUGIN API Reference Manual (the HUGIN C API).

Hope this answers your questions.
HUGIN EXPERT A/S