sempre icon indicating copy to clipboard operation
sempre copied to clipboard

Can't run query mode or simple-freebase mode

Open osmode opened this issue 9 years ago • 13 comments

Hello,

When I try to run this query: ./run @mode=query @sparqlserver=localhost:3001 -formula '(fb:location.location.containedby fb:en.california)'

I get the following error: Error: Could not find or load main class edu.stanford.nlp.sempre.freebase.SparqlExecutor Command failed: java -ea -cp libsempre/:lib/ edu.stanford.nlp.sempre.freebase.SparqlExecutor -SparqlExecutor.endpointUrl http://localhost:3001/sparql -formula (fb:location.location.containedby fb:en.california)

And when I try to run simple-freebase mode: ./run @mode=simple-freebase @sparqlserver=localhost:3001

I get this error: Problem processing: freebase edu.stanford.nlp.sempre.freebase.BinaryLexicon Exception in thread "main" java.lang.RuntimeException: java.lang.ClassNotFoundException: edu.stanford.nlp.sempre.freebase.BinaryLexicon at edu.stanford.nlp.sempre.Master.getOptionsParser(Master.java:443) at edu.stanford.nlp.sempre.Main.main(Main.java:38) Caused by: java.lang.ClassNotFoundException: edu.stanford.nlp.sempre.freebase.BinaryLexicon at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:264) at edu.stanford.nlp.sempre.Master.getOptionsParser(Master.java:437) ... 1 more Command failed: java -Dmodules=core,freebase -cp libsempre/:lib/ -ea edu.stanford.nlp.sempre.Main -executor freebase.SparqlExecutor -SparqlExecutor.endpointUrl http://localhost:3001/sparql -FreebaseSearch.cachePath FreebaseSearch.cache -EntityLexicon.mid2idPath freebase.cloudapp.net:4000:freebase-rdf-2013-06-09-00-00.canonical-id-map.gz -TypeInference.typeLookup freebase.FreebaseTypeLookup -FreebaseTypeLookup.entityTypesPath freebase.cloudapp.net:4000:freebase-rdf-2013-06-09-00-00.canonicalized.en-types.gz -EntityLexicon.maxEntries 2 -FeatureExtractor.featureDomains rule -Parser.coarsePrune -JoinFn.typeInference -UnaryLexicon.unaryLexiconFilePath /dev/null -BinaryLexicon.binaryLexiconFilesPath /dev/null -Grammar.inPaths freebase/data/demo1.grammar -SparqlExecutor.returnTable -Main.interactive

These errors persist despite running ./pull-dependencies freebase make freebase

Any thoughts? osmode

osmode avatar Oct 19 '15 06:10 osmode

Hi, osmode. Could you try running ant clean and then ant? Maybe the class was not compiled correctly.

ppasupat avatar Oct 19 '15 06:10 ppasupat

Thanks for your quick reply, ppasupat. When I run "ant clean" and "ant", I get:

... [echo] Compiling semparse: freebase [mkdir] Created dir: /home/breitkopf/Desktop/sempre/classes/freebase [javac] Compiling 55 source files to /home/breitkopf/Desktop/sempre/classes/freebase [javac] Note: /home/breitkopf/Desktop/sempre/src/edu/stanford/nlp/sempre/freebase/LambdaCalculusConverter.java uses unchecked or unsafe operations. [javac] Note: Recompile with -Xlint:unchecked for details. [jar] Building jar: /home/breitkopf/Desktop/sempre/libsempre/sempre-freebase.jar

tables: [echo] Compiling semparse: tables [mkdir] Created dir: /home/breitkopf/Desktop/sempre/classes/tables [javac] Compiling 50 source files to /home/breitkopf/Desktop/sempre/classes/tables [javac] /home/breitkopf/Desktop/sempre/src/edu/stanford/nlp/sempre/tables/ConvertCsvToTtl.java:7: error: package au.com.bytecode.opencsv does not exist [javac] import au.com.bytecode.opencsv.CSVReader; [javac] ^ [javac] /home/breitkopf/Desktop/sempre/src/edu/stanford/nlp/sempre/tables/TableKnowledgeGraph.java:6: error: package au.com.bytecode.opencsv does not exist [javac] import au.com.bytecode.opencsv.CSVReader; [javac] ^ [javac] /home/breitkopf/Desktop/sempre/src/edu/stanford/nlp/sempre/tables/ConvertCsvToTtl.java:205: error: cannot find symbol [javac] try (CSVReader csv = new CSVReader(new FileReader(inPath))) { [javac] ^ [javac] symbol: class CSVReader [javac] location: class ConvertCsvToTtl [javac] /home/breitkopf/Desktop/sempre/src/edu/stanford/nlp/sempre/tables/ConvertCsvToTtl.java:205: error: cannot find symbol [javac] try (CSVReader csv = new CSVReader(new FileReader(inPath))) { [javac] ^ [javac] symbol: class CSVReader [javac] location: class ConvertCsvToTtl [javac] /home/breitkopf/Desktop/sempre/src/edu/stanford/nlp/sempre/tables/TableKnowledgeGraph.java:181: error: cannot find symbol [javac] try (CSVReader csv = new CSVReader(new FileReader(filename))) { [javac] ^ [javac] symbol: class CSVReader [javac] location: class TableKnowledgeGraph [javac] /home/breitkopf/Desktop/sempre/src/edu/stanford/nlp/sempre/tables/TableKnowledgeGraph.java:181: error: cannot find symbol [javac] try (CSVReader csv = new CSVReader(new FileReader(filename))) { [javac] ^ [javac] symbol: class CSVReader [javac] location: class TableKnowledgeGraph [javac] Note: /home/breitkopf/Desktop/sempre/src/edu/stanford/nlp/sempre/tables/features/PredicateInfo.java uses unchecked or unsafe operations. [javac] Note: Recompile with -Xlint:unchecked for details. [javac] 6 errors

BUILD FAILED /home/breitkopf/Desktop/sempre/build.xml:25: The following error occurred while executing this line: /home/breitkopf/Desktop/sempre/build.xml:75: Compile failed; see the compiler error output for details.

osmode avatar Oct 19 '15 06:10 osmode

I see. Could you try ant clean and then ant freebase corenlp?

ppasupat avatar Oct 19 '15 08:10 ppasupat

This fixed half the problem. Now I can run this query: ./run @mode=query @sparqlserver=localhost:3001 -formula '(fb:location.location.containedby fb:en.california)'

However, when I try to run: ./run @mode=simple-freebase @sparqlserver=localhost:3001

I get this error:

main() { Grammar.read { Lexicon() { Loading unary lexicon file /dev/null { Number of lexemes: 0 } Loading Freebase schema: lib/fb_data/93.exec/schema2.ttl { 1163 CVTs, (19337,19282) property types, 858 property units } Loading formula info... { Adding schema properties Current number of binary formulas: 19278 Current number of unary formulas: 19284 Compuing reverse for schema formulas Adding reverse formulas: 19278 Current number of binary formulas: 38556 Generate formulas through CVTs Current number of binary formulas: 57226 } [1.5s, cum. 2.3s] Loading binary lexicon file /dev/null { Number of entries: 0 } } [2.3s, cum. 2.3s] RemoteStringCache: connecting to freebase.cloudapp.net:4000 to access freebase-rdf-2013-06-09-00-00.canonicalized.en-types.gz java.lang.RuntimeException: java.net.UnknownHostException: freebase.cloudapp.net at edu.stanford.nlp.sempre.cache.RemoteStringCache.(RemoteStringCache.java:37) at edu.stanford.nlp.sempre.cache.StringCacheUtils.create(StringCacheUtils.java:15) at edu.stanford.nlp.sempre.freebase.FreebaseTypeLookup.getEntityTypes(FreebaseTypeLookup.java:28) at edu.stanford.nlp.sempre.freebase.FreebaseTypeLookup.getEntityType(FreebaseTypeLookup.java:41) at edu.stanford.nlp.sempre.TypeInference.inferType(TypeInference.java:143) at edu.stanford.nlp.sempre.TypeInference.inferType(TypeInference.java:177) at edu.stanford.nlp.sempre.TypeInference.inferType(TypeInference.java:112) at edu.stanford.nlp.sempre.TypeInference.inferType(TypeInference.java:106) at edu.stanford.nlp.sempre.ConstantFn.init(ConstantFn.java:26) at edu.stanford.nlp.sempre.Grammar.parseSemanticFn(Grammar.java:471) at edu.stanford.nlp.sempre.Grammar.interpretRule(Grammar.java:255) at edu.stanford.nlp.sempre.Grammar.interpret(Grammar.java:154) at edu.stanford.nlp.sempre.Grammar.readOnePath(Grammar.java:130) at edu.stanford.nlp.sempre.Grammar.read(Grammar.java:61) at edu.stanford.nlp.sempre.Grammar.read(Grammar.java:53) at edu.stanford.nlp.sempre.Builder.buildUnspecified(Builder.java:45) at edu.stanford.nlp.sempre.Builder.build(Builder.java:38) at edu.stanford.nlp.sempre.Main.run(Main.java:17) at fig.exec.Execution.runWithObjArray(Execution.java:337) at fig.exec.Execution.run(Execution.java:325) at edu.stanford.nlp.sempre.Main.main(Main.java:38) Caused by: java.net.UnknownHostException: freebase.cloudapp.net at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at java.net.Socket.connect(Socket.java:538) at java.net.Socket.(Socket.java:434) at java.net.Socket.(Socket.java:211) at edu.stanford.nlp.sempre.cache.RemoteStringCache.(RemoteStringCache.java:26) ... 20 more ERROR: java.lang.RuntimeException: Error on (rule $NP (actors) (ConstantFn (fb:people.person.profession fb:en.film_actor))): java.lang.RuntimeException: java.net.UnknownHostException: freebase.cloudapp.net: edu.stanford.nlp.sempre.Grammar.interpret(Grammar.java:176) edu.stanford.nlp.sempre.Grammar.readOnePath(Grammar.java:130) edu.stanford.nlp.sempre.Grammar.read(Grammar.java:61) edu.stanford.nlp.sempre.Grammar.read(Grammar.java:53) edu.stanford.nlp.sempre.Builder.buildUnspecified(Builder.java:45) edu.stanford.nlp.sempre.Builder.build(Builder.java:38) edu.stanford.nlp.sempre.Main.run(Main.java:17) fig.exec.Execution.runWithObjArray(Execution.java:337) fig.exec.Execution.run(Execution.java:325) edu.stanford.nlp.sempre.Main.main(Main.java:38) 1 errors, 0 warnings } [2.4s, cum. 2.5s] Command failed: java -Dmodules=core,freebase -cp libsempre/:lib/ -ea edu.stanford.nlp.sempre.Main -executor freebase.SparqlExecutor -SparqlExecutor.endpointUrl http://localhost:3001/sparql -FreebaseSearch.cachePath FreebaseSearch.cache -EntityLexicon.mid2idPath freebase.cloudapp.net:4000:freebase-rdf-2013-06-09-00-00.canonical-id-map.gz -TypeInference.typeLookup freebase.FreebaseTypeLookup -FreebaseTypeLookup.entityTypesPath freebase.cloudapp.net:4000:freebase-rdf-2013-06-09-00-00.canonicalized.en-types.gz -EntityLexicon.maxEntries 2 -FeatureExtractor.featureDomains rule -Parser.coarsePrune -JoinFn.typeInference -UnaryLexicon.unaryLexiconFilePath /dev/null -BinaryLexicon.binaryLexiconFilesPath /dev/null -Grammar.inPaths freebase/data/demo1.grammar -SparqlExecutor.returnTable -Main.interactive

osmode avatar Oct 19 '15 08:10 osmode

I'll venture a guess here and say that this is a freebase connection error ("connecting to freebase.cloudapp.net:4000 ...")

I'm able to start simple-sparql mode just fine and run a few basic queries that way: ./run @mode=simple-sparql @sparqlserver=localhost:3001

Thanks very much for all of your help ppasupat.

osmode avatar Oct 19 '15 08:10 osmode

Has anyone recently been able to run simple-freebase mode?

I'm able to run some examples in simple-sparql mode, but I would like to use my own custom triples, and this is where I'm getting stuck. I set up an Apache Jena server to do this, but I'm having trouble finding a mode that will let me take advantage of using my own RDF client. Can anyone point me in the right direction?

osmode avatar Oct 21 '15 23:10 osmode

@osmode ,i get the same problem with you, but i also don't know how to solve it.

datawlb avatar Dec 19 '15 01:12 datawlb

@percyliang I got the same problem

laotao avatar Jan 26 '16 03:01 laotao

Same problem, simple-freebase mode is giving the error

argoel avatar Jan 27 '16 04:01 argoel

The command:

./run @mode=simple-freebase @sparqlserver=localhost:3001

works if I remove the following rule from demo1.grammar:

(rule $NP (actors) (ConstantFn (fb:people.person.profession fb:en.film_actor)))

I don't know why though

argoel avatar Jan 27 '16 08:01 argoel

Basically the Virtuoso instance on the default URL (cloudapp.net) is already dead. You can still use your local Virtuoso instance though.

For the simple-freebase mode, the cache server must also be specified. To start the cache server, run:

./run @mode=cacheserver -readOnly -capacity MAX -basePath lib/fb_data

To specify a port, add @port=[portnumber] to the command. The default port is 4000.

Then try:

./run @mode=simple-freebase @sparqlserver=localhost:3001 @cacheserver=localhost:4000

If you run the SPARQL server on another port, use that port number instead of 3001.

ppasupat avatar Jan 27 '16 22:01 ppasupat

@argoel You solution works for me.

zhaopku avatar Oct 27 '16 06:10 zhaopku

@argoel what is the expected output of the sentence "height of tom cruise" if i run the following: ./run @mode=simple-freebase @sparqlserver=localhost:3001

Also, do i need to comment out the (rule $NP ($Str) (LexiconFn entity fbsearch)), as it says freebase search api is deprecated.

And, do i need to download the whole freebase database?

nandinicbit1981 avatar Feb 27 '17 23:02 nandinicbit1981