com.ibm.tspaces
Class XMLField

java.lang.Object
  |
  +--com.ibm.tspaces.Field
        |
        +--com.ibm.tspaces.XMLField

public class XMLField
extends Field
implements java.io.Serializable

The XMLField class extends the Field class Its purpose is to store XML documents or XML URIs for processing by the TSpaces/TupleTree processor.
General comments on usage of XML in TSpaces:

 1. Given an XML document, it can be wrapped up in an XMLField simply
 by naming the XML String as one of the tuple constructor parameters
 2. Upon tuple creation, the XMLField will be flagged, and the TSDB
 will catch the flag on insertion at the server.
 3. The TSDB will create a TupleTree object to transform the XML
 string into a tree of tuples, referencing each other via TupleIDs
 4. The tuples are then each inserted into TSDB, and queries can be
 performed on them via the XQuery and XQueryImpl classes.  Results of
 queries are the original Tuple that contains the XMLField when one or more 
 nodes match the XQL Query constraints
 5. The Queries are much like XQL path expressions, with current
 support for descendants, attribute constraints, and tag
 and value pairs
 

To make use of the XML indexing and store functionality in TSpaces, simply create a new XMLField object around the XML document, and then pass it in to a Tuple constructor as a field, and the TSpace backend will do the rest. After documents have been stored, queries are supported via the XQuery interface, using a subset of the XQL query language.

  XMLField f1 =  new XMLField(
    "
    
     World
     "Hello World"
    " );
  new Tuple t = new Tuple(f1);
  ts.write(t);
    ...
  Tuple query = new Tuple(new XQuery("/To");
  Tuple result = ts.read(query);
  

Author:
Ben Y. Zhao
See Also:
SuperTuple, TupleSpace, Field, TupleTree, XTuple, XQuery, XQueryImpl, Serialized Form

Field Summary
static int FIELDTYPE
          A binary filter value for the bit vector The other special fields need to have the same FIELDTYPE set to other integers with higher bit masks.
 
Fields inherited from class com.ibm.tspaces.Field
isFormal, theName, theType, theTypeString, theValue
 
Constructor Summary
XMLField(java.lang.String XMLString)
          XMLField (String) * The constructor that just sets the XML value, no field name
XMLField(java.lang.String fieldName, java.lang.String XMLString)
          XMLField (String, String) * The constructor setting a field name as well as the XML String inside
XMLField(XMLField oldField)
          XMLField (XMLField) * The constructor that builds and XMLField from another XMLField
 
Method Summary
 java.util.Vector getQueryResult()
          getQueryResult * The accessor for the queryResualt
 TupleID getRootTuple()
          getRootTuple * The accessor for the root Tuple value
 void setQueryResult(java.util.Vector queryResult)
          setQueryResult * The setter for the QueryResult
 void setRootTuple(TupleID root)
          setRootTuple * The setter for the root Tuple value
 java.lang.String toString()
          Return a String that represents the XMLField.
 
Methods inherited from class com.ibm.tspaces.Field
assign, clone, formal, getName, getType, getValue, isFormal, main, makeField, matches, name, setFormal, setFormal, setName, setType, setValue, type, value
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FIELDTYPE

public static final int FIELDTYPE
A binary filter value for the bit vector The other special fields need to have the same FIELDTYPE set to other integers with higher bit masks. I.E. The next field would be 2, the next 4, the next 8 on up to the value of 2^31
Constructor Detail

XMLField

public XMLField(java.lang.String fieldName,
                java.lang.String XMLString)
         throws TupleSpaceException
XMLField (String, String) * The constructor setting a field name as well as the XML String inside
Parameters:
fieldName - - The name of this XMLField
XMLString - - The string representation of the XML

XMLField

public XMLField(java.lang.String XMLString)
         throws TupleSpaceException
XMLField (String) * The constructor that just sets the XML value, no field name
Parameters:
XMLString - - The XML String encoded

XMLField

public XMLField(XMLField oldField)
         throws TupleSpaceException
XMLField (XMLField) * The constructor that builds and XMLField from another XMLField
Parameters:
XMLField -  
Method Detail

getRootTuple

public TupleID getRootTuple()
getRootTuple * The accessor for the root Tuple value
Returns:
TupleID of the root of the Tuple tree

setRootTuple

public void setRootTuple(TupleID root)
setRootTuple * The setter for the root Tuple value
Parameters:
TupleID - of the root of the Tuple tree

getQueryResult

public java.util.Vector getQueryResult()
getQueryResult * The accessor for the queryResualt
Returns:
TupleIDs for the nodes that was matched

setQueryResult

public void setQueryResult(java.util.Vector queryResult)
setQueryResult * The setter for the QueryResult
Parameters:
Vector - that contains the result

toString

public java.lang.String toString()
Return a String that represents the XMLField. Format is
Overrides:
toString in class Field
Returns:
A String that represents the XMLField.