input
stringlengths
10
828
output
stringlengths
5
107
public boolean matches rdf triple other boolean match true if subject null match subject matches other get subject if match property null system out println prop property other other get property descend property is descendant other get property match property equals other get property property is descendant other get property if match object null match object matches other get object return match
return if this triple matches another triple
public void store triples set rdf triple triples add all triples
store new rdf triples into the triple store
public void set descriptor field desc descriptor desc descriptor
get the field descriptor for this literal
public date parse date string string val throws parse exception date date null if format null date format parse string val else date new date long parse long string val return date
parses the string into a single date
protected void add property prop map put name this prop map put name this
add this property to the internal set of properties
public property get parent return null
get the parent property if any for this property
public time span parse duration date start date string duration str double dur val double parse double duration str if dur units equals seconds dur val 1000 else if dur units equals minutes dur val 60000 else if dur units equals hours dur val 3600000 else if dur units equals days dur val 86400000 long end millis start date get time long dur val return new time span start date new date end millis
parses a duration field into a span
public boolean is descendant property prop boolean found false property parent prop get parent if parent null parent equals this found true else if parent null found is descendant parent return found
determines if the property is a descendant of this property
public boolean is descendant string prop name property prop property get property prop name return is descendant prop
determines if the property is a descendant of this property
public void set name string prop name name prop name prop map put name this
set the name of this property
public void set uri uri property uri uri property uri
set the uri which specifies this property
public time span parse duration time span span string duration str return parse duration span get start date duration str
parses a duration field into a span
public boolean is variable flag return variable
query whether this rdf thing represents a variable
public boolean matches rdf thing thing return variable my name equals thing get name uri null thing get uri null uri equals thing get uri
return whether this thing matches another thing
public void set name string thing name if thing name null throw new null pointer exception null name in rdf thing this my name thing name
set the name of this rdf thing
public void set uri uri object uri uri object uri
set the uri which specifies this property
public void set variable flag boolean variable flag variable variable flag
set whether this rdf thing represents a variable
public void store templates hash map string data template data templates for string name get template names data template template data templates get name if template null templates add template
this method identifies the templates which this particular data
public void remove enum field value string field name string field value data type type field types get field name if enm data null type null type equals data type enum enm data remove field value field name field value if enm data key set contains field name field types remove field name
remove an enumerated value from the set of values for the given
public string get destination field return dest field
get the field used to indicate the destination node for an edge
public string get origin field return orig field
get the field used to indicate the origin node for an edge
public void remove field string field name if str data null str data remove field name if int data null int data remove field name if enm data null enm data remove field name if msr data null msr data remove field name if tim data null tim data remove field name if loc data null loc data remove field name field types remove field name
remove the values and key for the specified field name
public element to xml document doc element elem doc create element graph elem set attribute name name string buffer edge buf new string buffer for string cls name edge classes if edge buf length 0 edge buf append edge buf append cls name string buffer node buf new string buffer for string cls name node classes if node buf length 0 node buf append node buf append cls name elem set attribute node class node buf to string elem set attribute edge class edge buf to string elem set attribute directed boolean to string directed return elem
convert this specification into xml format
public data change type get change type return type
get whether the change indicates that new data has been added
private void convert records for data structure listener listener listeners string struc name listener get structure name data structure spec spec get spec struc name for string name spec get template names data template template get template name store template record template if spec instanceof graph spec graph spec graph spec graph spec spec for string name graph spec get edge template names data template template get template name store template record template
convert the data element to data records for each available template
public data record get record data template template if convert map contains key template get name store template record template return convert map get template get name
get the record for a particular template
private void store template record data template template if convert map contains key template get name data record rec convert data data element template convert map put template get name rec
store a record for a particular template in this convert record
public void add data structure listener data structure listener listener listeners add listener
add a data structure listener to listen for events when a particular
protected void fire change event data structure event event string struc name event get structure name for data structure listener listener listeners if struc name equals listener get structure name listener data structure changed event
fire a data structure event for any listeners which match the event
public void start parse throws ioexception saxexception file file new file path if file exists file is directory if path ends with gz gzipinput stream in new gzipinput stream new file input stream file parser parse in rec handle else parser parse file rec handle
start parting the file or directory
public int get aging time return aging time
get the length of time that a particular data element will be retained
public void start parse input stream in throws saxexception ioexception parser parse in rec handle
start parsing the input stream
public void receive data d data convert record rec new convert record data synchronized records records put data rec for string struc match structures rec fire change event new data structure event this struc data change type data added
receive a data element
public void add listener data record listener listener listeners add listener
add a listener to the set of listeners for this data record stream
public void apply reasoner data record rec if reasoner null reasoner augment record rec
apply the reasoner to the data record
public void set aging time int time aging time time
set the length of time that a particular data element will be retained
protected void fire record received data record rec for data record listener listener listeners listener receive record rec
send the data record to all record listeners
public void add template string template name item classes add template name
add the named template which should correspond to a data template to
public semantic reasoner get reasoner return reasoner
get the semantic reasoner for this data record stream
public void load from xml element elem name elem get attribute name string node class str elem get attribute item class if node class str null node class str length 0 string str array node class str split s for string element str array item classes add element
load the dataset specification from an xml element
public element to xml document doc element elem doc create element dataset elem set attribute name name string buffer item buf new string buffer for string cls name item classes if item buf length 0 item buf append item buf append cls name elem set attribute item class item buf to string return elem
convert this specification into xml format
public data template get template return template
get the data template for this data record stream
public boolean augment record data record rec boolean augmented false set string loc fields rec get location field names for string field loc fields for location loc rec get location values field if loc get center null string loc name loc get name geo coord coordinate locator get coordinate loc name loc set center coordinate augmented true return augmented
augment the data record with information from the reasoner
public void remove listener data record listener listener listeners remove listener
remove a listener from the set of listeners for this data record stream
public geo locator get locator return locator
get the locator currently used by this reasoner
public void set reasoner semantic reasoner semantic reasoner reasoner semantic reasoner
set the semantic reasoner for this data record stream
public void set template data template data template template data template
set the data template for this data record stream
public entity type determine type string term return locator get geo object term null null entity type location
determine the type of an entity
public string normalize string term entity type type string norm null if type equals entity type location geo object geo locator get geo object term if geo null norm geo get name return norm
normalize the name
public void set model string cfg set config cfg
set the model information
public boolean verify type string term entity type type return type equals entity type location locator get geo object term null
verify the entity type
public void set enum field string field name string field value validate field type field name data type enum if enm data null enm data new multi value map string enm data set field field name field value
sets the value for a particular enumerated field
public void add file file file throws ioexception saxexception add url file to uri to url
adds a file to this accessor
public void set float field string field name double field value set measure field field name new measure field value unitless ratio
sets the value for a particular data field
public void add file string file name throws ioexception saxexception add url new file file name to uri to url
adds a file by name to this accessor
public void set init parameters map string string parameters init params put all parameters for semantic accessor access data sources values access set init parameters parameters
set any initialization parameters required by this data accessor
public void set int field string field name integer field value validate field type field name data type int if int data null int data new multi value map integer int data set field field name field value
sets the value for a particular text field
public void add accessor string name semantic accessor accessor data sources put name accessor
add a semantic accessor to this data coordinator
public void set location field string field name location field value validate field type field name data type location if loc data null loc data new multi value map location loc data set field field name field value
sets the value for a particular location field
public void set measure field string field name measure field value validate field type field name data type measure if msr data null msr data new multi value map measure msr data set field field name field value
sets the value for a particular measure field
public void add field handler string field name field handler handler field handlers put field name handler
add a field handler for a particular field
private void apply reasoner data template template set data record records semantic reasoner reasoner reasoner map get template if reasoner null for data record rec records reasoner augment record rec
apply the reasoner to all data records in a set
public void set name string rec name name rec name
set the name for this data record
public void load data file string data file throws file not found exception file input stream in stream new file input stream data file load data in stream data file
set the configuration from a local file
public void load data file url data url throws ioexception load data data url open stream data url to string
set the configuration from a url
public void set text field string field name string field value validate field type field name data type text if str data null str data new multi value map string str data set field field name field value
sets the value for a particular text field
private void load dataset element elem node list kids elem get child nodes hash set data record recs new hash set data record for int i 0 i kids get length i node node kids item i if node instanceof element data record rec create record element node if rec null recs add rec dataset recs
load the dataset from an xml element
public void set time field string field name time span field value validate field type field name data type time if tim data null tim data new multi value map time span tim data set field field name field value
sets the value for a particular time field
public field handler get field handler string field name return field handlers get field name
get the field handler associated with the specified field
private void load tree element elem node list tree elems elem get elements by tag name tree node if tree elems get length 1 system err println malformed tree specification element root elem element tree elems item 0 tree parse tree element root elem
load the tree from an xml element
public int get max records return max recs
get the maximum number of records returned by this accessor on any
private input stream open stream string data name input stream in stream null try url url new url data name in stream url open stream catch exception exc file file new file data name if file exists file can read try in stream new file input stream file catch file not found exception exc1 return in stream
open the named object as an input stream
private void validate field type string field name data type data type data type type field types get field name if type null type equals data type throw new illegal argument exception field field name already defined as type field types put field name data type
validates whether the given field name is used for the given data type
public void set init parameters map string string parameters
set the initialization parameters
public semantic reasoner get reasoner data template template return reasoner map get template
get the reasoner for the specified template for this accessor
public string write fields to string tree set string all fields new tree set string all fields add all make text listing str data all fields add all make text listing int data all fields add all make text listing msr data all fields add all make text listing tim data all fields add all make text listing loc data all fields add all make text listing enm data string buffer str buf new string buffer for string field all fields str buf append field return str buf to string trim
create a string containing the content of all fields in this data record
public void set max records int rec cnt max recs rec cnt
set the maximum number of records returned by this accessor on any
public void set doc base string doc base str try set doc base new url doc base str catch malformed urlexception exc throw new illegal argument exception invalid doc base doc base str
set the document base for this semantic accessor client
public void set init parameters map string string parameters string language parameters get language lang language null language length 0 language en topic parameters get query
set any initialization parameters required by this data accessor
public void set reasoner data template template semantic reasoner reasoner reasoner map put template reasoner
set the reasoner for the template
public void set doc base url document base doc base document base try input stream in stream doc base open stream set config in stream catch ioexception exc throw new runtime exception cannot access servlet for configuration at doc base exc
set the document base for this semantic accessor client
public void set init parameters map string string parameters string doc base str parameters get doc base if doc base str null doc base null throw new illegal argument exception cannot determine doc base else if doc base str null set doc base doc base str
set any initialization parameters required by the
public void set reasoner string template name semantic reasoner reasoner data template template get template template name if template null reasoner map put template reasoner
set the reasoner for the template
public int get cache limit return cache limit
get the cache limit for this accessor
private element read url url url throws ioexception saxexception input stream in stream url open stream document doc doc build parse in stream return doc get document element
read the data file parsing the data into rows
private void read data try buffered reader reader new buffered reader new input stream reader data file open stream string line reader read line string header line split delim for int i 0 i header length i if col names get header i null duplicate column header header i header i i col names put header i i boolean limited false while line reader read line null limited data lines add line split delim if data lines size cache limit limited true data lines clear reader close catch ioexception exc exc print stack trace
read the data file parsing the data into rows
public void set cache limit int limit cache limit limit
set the cache limit for this accessor
public void set init parameters map string string parameters if parameters contains key data file string path parameters get data file try data files put new url path null catch malformed urlexception exc guess that the path is a file and load it that way file file new file path try data files put file to uri to url null catch malformed urlexception exc1 exc1 print stack trace
set any initialization parameters required by this data accessor
public void set init parameters map string string parameters if parameters contains key data file string path parameters get data file try data file new url path catch malformed urlexception exc guess that its a file and load it that way file file new file path try data file file to uri to url catch malformed urlexception exc1 exc1 print stack trace if parameters contains key delimiter delim parameters get delimiter trim if parameters contains key cache limit try cache limit integer parse int parameters get cache limit catch number format exception exc cache limit 1000
set any initialization parameters required by this accessor
public void set init parameters map string string parameters string driver parameters get db driver string url parameters get db url string user parameters get db user string pass parameters get db pass if driver null url null user null pass null try class for name driver conn driver manager get connection url user pass catch class not found exception exc system err println db driver class invalid or not found driver catch sqlexception exc exc print stack trace
set any initialization parameters required by this data accessor
public void add derived clause calc clause clause derived add clause
add a derived clause to the rule
private rdf triple assign vars rdf triple triple map string rdf thing vars rdf thing subj triple get subject triple type type triple get type if subj is variable flag vars contains key subj get name subj vars get subj get name type triple type implied rdf thing obj triple get object if obj is variable flag vars contains key obj get name obj vars get obj get name type triple type implied return new rdf triple subj triple get property obj type
assign variables to an rdf triple
public boolean can read return swrl file null
return whether this reader can read data
public string get source return swrl file
get the source for this reader
public unit get default unit return def unit
get the default unit for this measure field descriptor
public boolean has more data return swrl file null rules is empty
return whether this reader has more data to be read
protected void add doc data doc data doc if corpus contains key doc get name corpus put doc get name doc set string keys doc get keys for string key keys if all keys contains key key int val all keys get key all keys put key val 1 else all keys put key 1 if graph dynamic add doc to graphs doc
add a doc data element to the corpus
protected void clear corpus corpus clear all keys clear key graph clear sim graph clear
this method clears all data from the corpus
private boolean matches unit unit unit string unit str return unit str equals ignore case unit to string unit str equals unit get abbreviation
determine if the unit string specified matches the unit
public doc corpus create sub corpus collection string keys doc corpus sub corpus new doc corpus for string key keys for doc data doc corpus values if doc matches key key sub corpus add doc data doc return sub corpus
derive a sub corpus of documents which match the given set of keys