001 package edu.upenn.cis.propbank_shen; 002 003 import org.w3c.dom.Node; 004 import org.w3c.dom.NamedNodeMap; 005 import org.w3c.dom.Attr; 006 007 008 /** 009 This class represents a propbank pointer to verbnet roles. 010 011 For a full API for verbnet, please see the 012 <a href="http://www.cis.upenn.edu/verbnet"> VerbNet website</a>. 013 014 @author Scott Cotton 015 */ 016 public class VNRole { 017 018 /** the theta role, such as Agent, Theme, Patient, etc */ 019 protected String vntheta; 020 /** the verbnet class */ 021 protected String vnclass; 022 /** the node from the frameset xml document */ 023 protected Node node; 024 025 /** construct a VNRole object from a vnrole node in the 026 propbank lexical guidelines */ 027 public VNRole(Node n) { 028 node = n; 029 vntheta = null; 030 vnclass = null; 031 NamedNodeMap attrs = n.getAttributes(); 032 int len = attrs.getLength(); 033 String anm = null; 034 for(int i=0; i<len; i++) { 035 Attr attr = (Attr) attrs.item(i); 036 anm = attr.getNodeName(); 037 if (anm.equals("vncls")) { 038 vnclass = attr.getNodeValue(); 039 } else if (anm.equals("vntheta")) { 040 vntheta = attr.getNodeValue(); 041 } 042 } 043 } 044 045 /** return the VerbNet theta role associated with this VNRole object */ 046 public String getVNTheta() 047 { 048 return vntheta; 049 } 050 051 /** return the VerbNet class identifier associated with this VNRole object */ 052 public String getVNClass() 053 { 054 return vnclass; 055 } 056 } 057