|
Version: 1.1.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ca.ucalgary.seahawk.util.DataUtils
public class DataUtils
Contains methods for the storage and retrieval of Seahawk-specific information from Moby XML payloads, specifically in the context of data provenance for programming-by-example.
Field Summary | |
---|---|
static String |
ARTICLE_PEERS_MODE
|
static String |
DATATYPE_PEERS_MODE
|
static DocumentBuilder |
docBuilder
|
static String |
INPUTSRC_ATTR
|
static String |
PI_TARGET
|
static String |
REGISTRY_ATTR
|
static String |
SERVICEID_ATTR
|
static String |
SERVICEINPUT_ATTR
|
static String |
TEMP_FILE_PREFIX
|
static XPathFactory |
xPathFactory
|
Constructor Summary | |
---|---|
DataUtils()
|
Method Summary | |
---|---|
static Boolean |
addHASXPtrs(List<String> filterList,
Element object)
If any moby object member is in a HAS relationship, add it to the list of filterable items |
static void |
addUserData(MobyDataInstance mdi,
URL conditionalOutputURL,
FilterSearch filter)
Record a condition for data acceptability, another service call with an output filter criteria. i.e. records if(f1(x) matches f1's output filter){...} |
static void |
addUserDataToPayload(MobyContentInstance contentInstance,
Document sourceDoc)
Tacks the data provenance info saved as processing instructions during saveInputData() back into the MobyContentInstance loaded from file using the usual, customization-oblivious MobyDataUtils.fromXMLDocument(). |
static URL |
createServiceInputFileForPeers(MobyContentInstance peerJobs,
MobyDataJob sampleJob)
Create a temp file that populates the MobyContentInstance from the sample data for all missing fields in peerJobs. |
static String |
elementInContextToNameBasedXPath(Element targetElement)
Generalizes the element instance into an XPath retrieving it and all similarly nested elements (based on traversing the parent nodes and prepending their names) |
static void |
filterNodes(Node rootNode,
Map<String,String> filteredXPtrs)
Loads targetURL, minus the nodes specified by the xpath keys in filteredXPtrs (map values are not currently used). |
static List<String> |
findFilteredNodes(Document targetDoc,
FilterSearch filter,
List<String> filterableXPtrs,
Map<String,String> xPtrsToFilter,
Map<String,Boolean> jobXPtrs,
MutableNodeList currentSelectedData,
StringBuffer currentSelectionXPath,
boolean apply)
Returns a list of xptrs to filterable nodes in the targetDoc, an populates the list of xptrs that should be filtered according to the provided filter. |
static Document |
findFilteredNodes(URL targetURL,
FilterSearch filter,
Map<String,String> xPtrsToFilter)
For one-off filtering of a doc. |
static String |
findMobyJobName(Node n)
|
static Document |
getInputDoc(Document responseDom)
|
static MobyDataJob |
getInputSample(Document responseDom,
Registry registry)
Backtrack from a service result to the input doc sent to the service |
static MobyDataJob |
getInputSample(Document responseDom,
String jobName,
Registry registry)
Same as two-arg, but retrieves a specific job's input (or null if not a job name found in the doc). |
static URL |
getInputURL(Document responseDom)
|
static List<String> |
getInputXPtrs(URL serviceResultURL,
URL targetInputURL)
Gets a list of XPointers of the style /1/1/1/4/3/1 from targetInputURL that were used as input to the service call that resulted in serviceResultURL. |
static NodeList |
getPeerElements(Document doc,
MobyDataInstance mobyData,
Map<String,String> xPtrsToFilter,
String peerMode)
We need to enumerate the possible peer-sets for the selected data item. |
static Registry |
getRegistry(Document responseDoc)
Find out which registry the service that created the reponse is registered in. |
static String |
getSeahawkAttrFromDoc(Document mobyXmlDoc,
String attrName)
|
static String |
getSeahawkAttrFromDoc(URL docURL,
String attrName)
Retrieves processing instructions embedded in Moby XML docs if they have the for |
static MobyService |
getService(Document responseDoc)
|
static MobyService |
getService(URL responseURL)
Find out what the service was that created the given URL. |
static String |
getXPtr(Node n)
|
static MobyDataInstance |
loadMobyDataFromXPointer(URL docURL,
Document domDoc,
String targetXptr,
Map<String,String> filteredXPtrs,
FilterSearch docFilter)
|
static MobyDataInstance |
loadMobyDataFromXPointer(URL targetURL,
Map<String,String> filteredXPtrs,
FilterSearch docFilter)
Get the data instance object associated with a given XPointer in a Moby XML doc. |
static void |
replaceUserData(MobyDataInstance mdi,
String selectionXPath)
Replace the selection xpath info in the data instance |
static URL |
saveOutputData(MobyContentInstance outputData,
MobyService payloadSource,
MobyContentInstance inputData,
String registryEndpoint)
|
static URL |
saveOutputData(MobyRequestEvent mre)
|
static URL |
saveOutputData(String output,
MobyService payloadSource,
URL inputURL,
String registryEndpoint)
|
static void |
setUserData(MobyDataInstance mobyData,
URL srcURL,
String selectionXPath,
String dataSrcXPtr,
FilterSearch fs)
Record the PbE pertinent info about the data to the Moby data object so it can be tracked through the rest of the app. |
static void |
updateInputFilter(URL serviceResultURL,
URL sourceServiceResultURL,
FilterSearch newFilter)
Edit a service input document's backtracking references to have a new filter criteria. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String PI_TARGET
public static final String REGISTRY_ATTR
public static final String SERVICEID_ATTR
public static final String SERVICEINPUT_ATTR
public static final String INPUTSRC_ATTR
public static final String TEMP_FILE_PREFIX
public static DocumentBuilder docBuilder
public static XPathFactory xPathFactory
public static final String ARTICLE_PEERS_MODE
public static final String DATATYPE_PEERS_MODE
Constructor Detail |
---|
public DataUtils()
Method Detail |
---|
public static void updateInputFilter(URL serviceResultURL, URL sourceServiceResultURL, FilterSearch newFilter)
serviceResultURL
- the service result from which the input will be backtrackedsourceServiceResultURL
- input sources coming from this service result will be the target for editingnewFilter
- the new filter criteria for passing data to the next servicepublic static List<String> getInputXPtrs(URL serviceResultURL, URL targetInputURL) throws Exception
serviceResultURL
- the service response from which to backtrack the input datatargetInputURL
- the service response chain that we're interested in (remember that input can come from multiple docs)
Exception
public static URL saveOutputData(MobyRequestEvent mre) throws Exception
Exception
public static URL saveOutputData(MobyContentInstance outputData, MobyService payloadSource, MobyContentInstance inputData, String registryEndpoint) throws Exception
Exception
public static URL saveOutputData(String output, MobyService payloadSource, URL inputURL, String registryEndpoint) throws Exception
Exception
public static URL getInputURL(Document responseDom) throws Exception
Exception
public static Document getInputDoc(Document responseDom) throws Exception
Exception
public static MobyDataJob getInputSample(Document responseDom, Registry registry) throws Exception
responseDom
- the XML DOM for the answer from a Moby Web service called in Seahawk
Exception
public static MobyDataJob getInputSample(Document responseDom, String jobName, Registry registry) throws Exception
Exception
public static void addUserDataToPayload(MobyContentInstance contentInstance, Document sourceDoc) throws Exception
Exception
public static void filterNodes(Node rootNode, Map<String,String> filteredXPtrs)
public static MobyDataInstance loadMobyDataFromXPointer(URL targetURL, Map<String,String> filteredXPtrs, FilterSearch docFilter)
targetURL
- of the form URLpath#/1/1/2/1 where /1/1/2/1 is an XPointer, or an standard xpath, to the part of the Moby XML doc to deserializefilteredXPtrs
- a map of the xpointers to data that should NOT be deserialized if children of the targetURL XPointerdocFilter
- the current filter applied to the document in targetURLpublic static MobyDataInstance loadMobyDataFromXPointer(URL docURL, Document domDoc, String targetXptr, Map<String,String> filteredXPtrs, FilterSearch docFilter)
public static String elementInContextToNameBasedXPath(Element targetElement)
public static void setUserData(MobyDataInstance mobyData, URL srcURL, String selectionXPath, String dataSrcXPtr, FilterSearch fs)
public static void addUserData(MobyDataInstance mdi, URL conditionalOutputURL, FilterSearch filter)
public static void replaceUserData(MobyDataInstance mdi, String selectionXPath)
public static String getSeahawkAttrFromDoc(URL docURL, String attrName) throws Exception
Exception
public static String getSeahawkAttrFromDoc(Document mobyXmlDoc, String attrName) throws Exception
Exception
public static MobyService getService(URL responseURL) throws Exception
responseURL
- the service response whose origin we should trace
Exception
public static MobyService getService(Document responseDoc) throws Exception
Exception
public static Registry getRegistry(Document responseDoc) throws Exception
responseDoc
- the service response whose origin we should trace
Exception
public static String getXPtr(Node n)
public static Boolean addHASXPtrs(List<String> filterList, Element object)
public static Document findFilteredNodes(URL targetURL, FilterSearch filter, Map<String,String> xPtrsToFilter)
public static List<String> findFilteredNodes(Document targetDoc, FilterSearch filter, List<String> filterableXPtrs, Map<String,String> xPtrsToFilter, Map<String,Boolean> jobXPtrs, MutableNodeList currentSelectedData, StringBuffer currentSelectionXPath, boolean apply)
public static URL createServiceInputFileForPeers(MobyContentInstance peerJobs, MobyDataJob sampleJob) throws Exception
Exception
public static NodeList getPeerElements(Document doc, MobyDataInstance mobyData, Map<String,String> xPtrsToFilter, String peerMode)
public static String findMobyJobName(Node n)
|
Version: 1.1.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |