Updated contents on SPARQL in README / TUTORIAL

This commit is contained in:
Panupong Pasupat 2016-11-15 14:02:14 -08:00
parent 3b31ba7aef
commit f0248a0c2b
4 changed files with 28 additions and 18 deletions

View File

@ -123,16 +123,12 @@ For Ubuntu, follow this:
sudo apt-get install -y automake gawk gperf libtool bison flex libssl-dev
# Clone the repository
git clone https://github.com/openlink/virtuoso-opensource
./pull-dependencies virtuoso
# Make and install
cd virtuoso-opensource
git checkout tags/v7.0.0
# Configure
./autogen.sh
mv INSTALL INSTALL.txt # Avoid conflict on case-insensitive file systems
./configure --prefix=$PWD/install
# Make (this takes a while)
make
make install
cd ..

View File

@ -17,7 +17,8 @@ Recall that in semantic parsing, *natural language utterances* are mapped into
*logical forms* (think programs), which are executed to produce some
*denotation* (think return value).
We have assumed you have already downloaded SEMPRE and can open up a shell:
We have assumed you have already [installed](README.md#installation)
SEMPRE and can open up a shell:
./run @mode=simple
@ -32,7 +33,7 @@ shell command and executes it. To see which command is run, do:
This should print out:
rlwrap java -cp libsempre/*:lib/* -ea edu.stanford.nlp.sempre.Main -interactive
java -cp libsempre/*:lib/* -ea edu.stanford.nlp.sempre.Main -Main.interactive
You can pass in additional options:
@ -586,7 +587,7 @@ To stop the server:
### Setting up a copy of Freebase
The best case is someone already installed Freebase for you and handed you a
host:port. Otherwise, to run your own copy of the Freebase graph (a
host:port. Otherwise, to run your own copy of the entire Freebase graph (a
2013 snapshot), read on.
Download it (this is really big and takes a LONG time):
@ -611,12 +612,9 @@ We assume you have started the Virtuoso database:
Then start up a prompt:
./run @mode=simple-freebase @sparqlserver=localhost:3001
The simplest logical formula in lambda DCS is a single entity:
fb:en.california
./run @mode=simple-freebase-nocache @sparqlserver=localhost:3001
The simplest logical formula in lambda DCS is a single entity such as `fb:en.california`.
To execute this query, simply type the following into the interactive prompt:
(execute fb:en.california)
@ -753,7 +751,7 @@ is the basis for the overloading.
Now start the interactive prompt:
./run @mode=simple-freebase @sparqlserver=localhost:3001 -Grammar.inPaths freebase/data/tutorial-freebase.grammar -SimpleLexicon.inPaths freebase/data/tutorial-freebase.lexicon
./run @mode=simple-freebase-nocache @sparqlserver=localhost:3001 -Grammar.inPaths freebase/data/tutorial-freebase.grammar -SimpleLexicon.inPaths freebase/data/tutorial-freebase.lexicon
We should be able to parse the following utterances:

16
run
View File

@ -489,6 +489,22 @@ addMode('simple-freebase', 'Simple shell for using Freebase', lambda { |e| l(
o('Main.interactive'),
nil) })
addMode('simple-freebase-nocache', 'Simple shell for using Freebase (without a cache server)', lambda { |e| l(
'java', '-Dmodules=core,freebase', '-cp', 'libsempre/*:lib/*', '-ea', 'edu.stanford.nlp.sempre.Main',
o('executor', 'freebase.SparqlExecutor'),
letDefault(:sparqlserver, 'freebase.cloudapp.net:3093'),
sparqlOpts,
o('FeatureExtractor.featureDomains', 'rule'),
o('Parser.coarsePrune'),
o('JoinFn.typeInference'),
o('UnaryLexicon.unaryLexiconFilePath', '/dev/null'),
o('BinaryLexicon.binaryLexiconFilesPath', '/dev/null'),
#o('JoinFn.showTypeCheckFailures'), # Use this to debug
o('Grammar.inPaths', 'freebase/data/demo1.grammar'), # Override with your own custom grammar
#o('SparqlExecutor.includeSupportingInfo'), # Show full information
o('Main.interactive'),
nil) })
############################################################
# {2014-12-27} [Percy]: Overnight semantic parsing

View File

@ -23,10 +23,10 @@ public class JoinFn extends SemanticFn {
public static class Options {
@Option(gloss = "Verbose") public int verbose = 0;
@Option public boolean showTypeCheckFailures = false;
@Option public boolean typeInference = false;
@Option public boolean typeInference = true;
// TODO(joberant): this flag is for backward compatibility. If we don't
// need it for the new results, get rid of it.
@Option public boolean specializedTypeCheck = true;
@Option public boolean specializedTypeCheck = false;
}
public static Options opts = new Options();