PonteExpander issues

Retrieval
Joan
2013-07-23
2016-11-09
  • Joan

    Joan - 2013-07-23

    Hi everyone,

    I am using Indri's (5.3) Java API in order to do retrieval via QueryEnvironment which works great. However, now I'm willing to use PonteExpander and RMExpander (both use a pseudo-relevance feedback model, am I right?).

    The way I do it is:

    QueryEnvironment env = new QueryEnvironment();
    String myIndex="path";
    env.addIndex(myIndex);
    RMExpander rm = new RMExpander(env, new HashMap());
    //I don't know if I have to specify fbDocs,fbTerms,fbMu and fbOrigWeight or if it uses //default values. If I've to specify I understand I've to use a Map<String,String>, right?

    However, when I run the program I got this error:

    Exception in thread "main" java.lang.UnsatisfiedLinkError: lemurproject.indri.indriJNI.SWIGPonteExpanderUpcast(J)J
    at lemurproject.indri.indriJNI.SWIGPonteExpanderUpcast(Native Method)
    at lemurproject.indri.PonteExpander.<init>(PonteExpander.java:15)
    at lemurproject.indri.PonteExpander.<init>(PonteExpander.java:37)

    I'm loading indri.jar, IndexUI.jar and RetUI.jar.

    Can someone give me a hand? What I'm doing wrong?

    Thanks a lot,

    joan

     
    Last edit: Joan 2013-07-23
  • David Fisher

    David Fisher - 2013-07-23

    I am unable to replicate your issue. Are you certain that the shared library is on the java.library.path (or the current directory)?

    harvey:~/Development/test/test-java$ cat test.trectext 
    <DOC>
    <DOCNO>doc1</DOCNO>
    <TEXT>
    Once upon a time there was an elephant elephant who came and went from here 
    to there and back again
    an
    an
    </TEXT>
    </DOC>
    <DOC>
    <DOCNO>doc2</DOCNO>
    <TEXT>
    Once upon a time there was an elephant who came and went from here 
    to there and back again
    an an
    an
    </TEXT>
    </DOC>
    <DOC>
    <DOCNO>doc3</DOCNO>
    <TEXT>
    Once upon a time there was an another who came and went from here 
    to there and back again
    elephant
    here
    </TEXT>
    </DOC>
    <DOC>
    <DOCNO>doc4</DOCNO>
    <TEXT>
    Once upon a time there was an and so on who came and went from here 
    to there and back again
    and so forth
    an an
    </TEXT>
    </DOC>
    
    harvey:~/Development/test/test-java$ indri-5.3/buildindex/IndriBuildIndex \ 
      -index=index_test -corpus.path=test.trectext 
    0:00: Created repository index_test
    0:00: Opened test.trectext
    0:00: Documents parsed: 4 Documents indexed: 4
    0:00: Closed test.trectext
    0:00: Closing index
    0:00: Finished
    
    harvey:~/Development/test/test-java$ cat TestIndri.java 
    import lemurproject.indri.*;
    import java.util.*;
    
    public class TestIndri 
    {
        public static void main(String[] args) 
        {
            try {
                QueryEnvironment env = new QueryEnvironment();
                String myIndex = "index_test";
                String myQuery = "#combine(an elephant)";
                ScoredExtentResult[] results = null;
                String[] names = null;
                // open an Indri repository
                env.addIndex(myIndex);
                PonteExpander ponte = new PonteExpander(env, new HashMap());
                // run an Indri query, returning 10 results
                results = env.runQuery(myQuery, 10);
                String newQuery = ponte.expand(myQuery, results);
                System.out.println("New query: " + newQuery);
                results = env.runQuery(newQuery, 10);
                // fetch the names of the retrieved documents
                names = env.documentMetadata(results, "docno");
                for (int i = 0; i < results.length; i++) {
                    System.out.println(names[i] + " " + results[i].score + " "
                                       + results[i].begin + " " + results[i].end);
                }
                env.close();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
    
    harvey:~/Development/test/test-java$ javac -classpath indri.jar:. TestIndri.java
    harvey:~/Development/test/test-java$ ls -l
    total 160
    -rw-r--r--   1 dfisher  nlp  1837 Jul 23 08:16 TestIndri.class
    -rw-r--r--   1 dfisher  nlp  1252 Jul 23 08:04 TestIndri.java
    drwxr-xr-x   6 dfisher  nlp   204 Jul 23 08:14 index_test
    drwxr-xr-x  42 dfisher  nlp  1428 Nov  7  2012 indri-5.3
    lrwxr-xr-x   1 dfisher  nlp    33 Nov  7  2012 indri.jar -> indri-5.3/swig/obj/java/indri.jar
    lrwxr-xr-x   1 dfisher  nlp    43 Nov  7  2012 libindri_jni.jnilib -> indri-5.3/swig/obj/java/libindri_jni.jnilib
    -rw-r--r--   1 dfisher  nlp   613 Jul 23 08:14 test.trectext
    harvey:~/Development/test/test-java$ java -classpath indri.jar:. TestIndri
    New query: #weight( 0.50000000000000000000000000000000 
                        #combine( #combine(an elephant) ) 
       0.50000000000000000000000000000000 
       #weight(  0.00557690576640126195462343616782 "so"  
                 0.00666114340820692790723356324634 "elephant"
                 0.00692703347890288260307878331901 "here"
                 0.03164140419811853344178587121860 "an"
                 0.02580724787161419592207423079344 "there"  
                 0.03138415363801545787669766696126 "and"  ) ) 
    doc1 -2.5156713328613574 0 22
    doc2 -2.5168955683376657 0 22
    doc3 -2.52017183813507 0 21
    doc4 -2.5203519467626165 0 26
    
     
  • Joan

    Joan - 2013-07-23

    Hi David,

    first of all, thank for your help.

    However, regarding to my problem...When it comes to execute:

            env.runQuery(myQuery,10);
    

    The system works great... It would mean that I do have well configurated the usage of the shared library, right?

    The problem appear in this line:

            String newQuery = ponte.expand(myQuery, results);
    

    I've copied the piece of code that you have provided me with, and I still have the same problem:

    Exception in thread "main" java.lang.UnsatisfiedLinkError: lemurproject.indri.indriJNI.SWIGPonteExpanderUpcast(J)J
    at lemurproject.indri.indriJNI.SWIGPonteExpanderUpcast(Native Method)
    at lemurproject.indri.PonteExpander.<init>(PonteExpander.java:15)
    at lemurproject.indri.PonteExpander.<init>(PonteExpander.java:37)

    Thanks again,

    joan

     
  • David Fisher

    David Fisher - 2013-07-23

    As I said, I am unable to replicate your issue.

    Please attach the file: swig/src/java/lemurproject/indri/PonteExpander.java so that I may inspect it. Please also attach the config.log file from the top level indri directory.

     
  • Joan

    Joan - 2013-07-23

    PonteExpander.java

     
  • Joan

    Joan - 2013-07-23

    config.log

     
  • David Fisher

    David Fisher - 2013-07-23

    I am sorry, I don't see anything obvious to explain it. Your GCC is 4.6, which has not been tested.

    I did try using an Ubuntu 13.04 VM, with oracle java 6 and GCC 4.7 and was unable to replicate your issue.

     
  • Joan

    Joan - 2013-07-23

    I'm using netbeans, I don't know if that could help you to help me :)
    I'm really confused because I've been working with Indri for a while and I've found it always intuitive and robust...I don't know what I'm doing wrong now....

     
  • Joan

    Joan - 2013-07-23

    Another clue, when I use the console and do:

    -Djava.library.path=libindri_jni.so

    I cannot even create a QueryEnverioment object, so when I do run

            QueryEnvironment env = new QueryEnvironment();
    

    I do obtain a similar error:

    /usr/lib/jvm/java-6-sun/bin/javac -classpath indri.jar:IndexUI.jar:RetUI.jar:. TestIndri.java

    /usr/lib/jvm/java-6-sun/bin/java -classpath indri.jar:IndexUI.jar:RetUI.jar:. -Djava.library.path=libindri_jni.so TestIndri
    Exception in thread "main" java.lang.UnsatisfiedLinkError: no indri_jni in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1738)
    at java.lang.Runtime.loadLibrary0(Runtime.java:823)
    at java.lang.System.loadLibrary(System.java:1028)
    at lemurproject.indri.indriJNI.<clinit>(indriJNI.java:102)
    at lemurproject.indri.QueryEnvironment.<init>(QueryEnvironment.java:39)
    at TestIndri.main(TestIndri.java:18)

     
    Last edit: Joan 2013-07-23
  • David Fisher

    David Fisher - 2013-07-24

    -Djava.library.path= has to be the directory path to the directory that contains libindri_jni.so, not the .so file itself.

    I can't speak to trying to use the software inside the netbeans environment.

     
  • Joan

    Joan - 2013-07-24

    Hi David,

    I've solved part of the problem. I'm able to use Ponte's extender from the console by defining LD_LIBRARY_PATH

    I'm still not able to use it inside the netbeans... But I can work with that.

    Thank you very much for your help!

    Joan

     
  • Sameh souma

    Sameh souma - 2016-11-07

    plz help me to correct this error
    Exception in thread "main" java.lang.UnsatisfiedLinkError: no indri_jni in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1864)
    at java.lang.Runtime.loadLibrary0(Runtime.java:870)
    at java.lang.System.loadLibrary(System.java:1122)
    at lemurproject.indri.indriJNI.<clinit>(indriJNI.java:109)
    at lemurproject.indri.QueryEnvironment.<init>(QueryEnvironment.java:39)
    at exemples.TestIndri.main(TestIndri.java:15)

     
  • Sameh souma

    Sameh souma - 2016-11-08

    plz help me to correct this error

    Exception in thread "main" java.lang.UnsatisfiedLinkError: no indri_jni in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1864)
    at java.lang.Runtime.loadLibrary0(Runtime.java:870)
    at java.lang.System.loadLibrary(System.java:1122)
    at lemurproject.indri.indriJNI.<clinit>(indriJNI.java:109)
    at lemurproject.indri.QueryEnvironment.<init>(QueryEnvironment.java:39)
    at exemples.TestIndri.main(TestIndri.java:15)

    ***thank you in advance***

     
  • Sameh souma

    Sameh souma - 2016-11-09

    I resolved the problem by defining the path in Netbeans

    Setting the java.library path. using Netbeans: In order to define the java.library.path property in Netbeans, the following steps must be completed:
    1/ Select your project in the Projects area and press a right click on it.
    2/ Select Properties and then, move to the Run tab.
    3/ In the VM Options field, add the following option, based on your library’s path:
    4/ java -Djava.library.path=<path_to_dll>
    path_to_dll = path to folder contain the file indri_jni.dll
    5/ Click on OK in order for the window to close.

     

Log in to post a comment.