Class PDTBXPath

  extended byedu.upenn.cis.pdtb.xpath.PDTBXPath

public class PDTBXPath
extends java.lang.Object

A simple top level query interface to the PDTB. Usage is as follows:

  java -Xmx100M -Xms100M -server edu.upenn.cis.pdtb.xpath.PDTBXPath args
The arguments are as follows:
  --rawRoot RawRoot (or -r RawRoot)
  --ptbRoot PtbRoot (or -p PtbRoot)
  --pdtbRoot PdtbRoot (or -d PdtbRoot)
  --outputRoot OutputRoot (or -o OutputRoot. This will serve as the result PdtbRoot. 
                           OutputRoot should not exist when this is run)
  --xpath XPathExpression (or -x XPathExpression)
  -c (generates total counts in addition to the files)
  -b (opens results in the browser. The saved results can always be opened in the browser
      at a later time, by specifying OutputRoot as the PdtbRoot argument to the browser.)
The XPath expression should select Element nodes listed below. If any other kind of node or object is returned by the query, the program exits. The full XPath functionality can be accessed via the API. The following is the list of Elements, their children, and attributes (the suffix * indicates optionality of an attribute, and 0 or more potential occurences of a child element):
Element QName Children QNames Attribute QNames
RelationList ExplicitRelation*, ImplicitRelation*, AltLexRelation*, EntityRelation*, NoRelation*
ExplicitRelation Sup1*, Arg1, Arg2, Sup2* Source, Type, Polarity, Det, connHead, sClassA, sClassB*, rawText
ImplicitRelation Sup1*, Arg1, Arg2, Sup2* Source, Type, Polarity, Det, conn1, sClass1A, sClass1B*, conn2*, sClass2A*, sClass2B*
AltLexRelation Sup1*, Arg1, Arg2, Sup2* Source, Type, Polarity, Det, sClassA, sClassB*, rawText
EntityRelation Arg1, Arg2
NoRelation Arg1, Arg2
Arg1 Source, Type, Polarity, Det, rawText
Arg2 Source, Type, Polarity, Det, rawText
Sup1 rawText
Sup2 rawText

The expression "//PDTBExplicitRelation[@connHead='because']" selects all occurences of the explicit connective "because". The expression "//ImplicitRelation[@conn1='instead']" selects all implicit relations where "instead" is chosen as conn1. Note that the enclosing quotes are necessary on the command line.

If an Element is selected by an expression, the closest ancestor (or the node itself) which is a child of PDTBRelationList will be output. This is so that the results can be loaded in the browser. If the -c option is specified total counts of the number of objects selected is produced. This will usually be greater than or equal to the number of relations saved in the OutputRoot.

Here is a sample command line invocation:

    java -Xmx100M -Xms100M -server edu.upenn.cis.pdtb.xpath.PDTBXPath\\  
            -r Corpora/PTB/raw/wsj \\ 
            -p Corpora/PTB/combined/wsj \\ 
            -d Corpora/PDTB/PDTB-Flat3 \\
            -o Corpora/PDTB/PDTB-Flat4 \\ 
            -x "//ImplicitRelation[@conn1 = 'because']" -c -b
Note that the output directory specified by -o, should not exist prior to invocation.

See the XPath recommendation for further info on XPath. For querying the syntax as well, use the API.

The following syntactic shortenings are supported, since v0.2.3:

Standard XPath Short Form
self::* =::*
child::* >::*
parent::* <::*
descendant::* >>::*
descendant-or-self::* =>>::*
ancestor-or-self::* <<=::*
following::* ->::*
preceding::* <-::*
following-sibling::* $>::*
preceding-sibling::* <$::*

nikhild, geraud

Field Summary
static java.lang.String NoFilesMessage
static java.lang.String Usage
Constructor Summary
          Creates a new instance of PDTBXPath
Method Summary
static void main(java.lang.String[] args)
static int runQuery(java.lang.String[] browserArgsIn, java.lang.String xpathStr, javax.swing.JProgressBar progressBar)
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail


public static final java.lang.String Usage
See Also:
Constant Field Values


public static final java.lang.String NoFilesMessage
Constructor Detail


public PDTBXPath()
Creates a new instance of PDTBXPath

Method Detail


public static int runQuery(java.lang.String[] browserArgsIn,
                           java.lang.String xpathStr,
                           javax.swing.JProgressBar progressBar)


public static void main(java.lang.String[] args)
args - the command line arguments