Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
  • 15 commits
  • 13 files changed
  • 0 commit comments
  • 2 contributors
Commits on Jan 19, 2012
@SyamGadde SyamGadde Added default namespace to root element, which propagates to any added
children.  Which also means any XPath query needs to use a (prefixed)
namespace to access now-namespace-scoped elements.
831881f
@SyamGadde SyamGadde Added default namespace to root element, which propagates to any adde…
…d children. Which also means any XPath query needs to use a (prefixed) namespace to access now-namespace-scoped elements.
4afbb7d
@SyamGadde SyamGadde Merge branch 'master' of github.com:SyamGadde/ProvenanceLibrary 62d2e05
@satra satra Merge pull request #5 from SyamGadde/master
Adding default PROV namespace to XML (and associated changes).
0b4fb67
@SyamGadde SyamGadde Add a prefix parameter to addAttribute(). Change all calls to addAttr…
…ibute to specify a prefix. For any "type" attributes, they are now qualified with the "prov" prefix. Any other explicitly named attributes are given the "ni" prefix. That leaves attributes whose names are data-driven (like environment variables), and for now these get a NULL prefix. addAttribute() allows prefix to be NULL, but W3C PROV may require that attributes have a namespace prefix so this may need to be revisited.
85273a7
@satra satra Merge pull request #6 from SyamGadde/master
proposed commits to make addAttribute() have a prefix parameter
787a68d
Commits on Jan 25, 2012
@satra satra fix: updated schema pointer 8c15c65
Commits on Feb 14, 2012
@satra satra fix: namespace cleanup 4815da2
@satra satra Merge pull request #8 from satra/fix/multidoc
fix: namespace cleanup
f7883a1
Commits on Feb 15, 2012
@satra satra fix: namespace for container id 3f981af
@satra satra Merge pull request #9 from satra/fix/multidoc
fix: namespace for container id
8c65609
@satra satra fix: memory leaks using valgrind a849847
@satra satra Merge pull request #10 from satra/fix/valgrind
fix: memory leaks using valgrind
b7096f6
@satra satra enh: added matlab demo ad64efd
@satra satra Merge pull request #11 from satra/fix/matlab
enh: added matlab demo
513097e
View
4 README
@@ -42,7 +42,9 @@ http://dvcs.w3.org/hg/prov/file/tip/ontology/ProvenanceFormalModel.html
Upstream schema
~~~~~~~~~~~~~~~
-https://github.com/lucmoreau/ProvToolbox/blob/master/xml/src/main/resources/prov-20111110.xsd
+if the date is much more recent than that indicated in the filename, please check luc moreau's repository
+
+http://github.com/lucmoreau/ProvToolbox/blob/master/xml/src/main/resources/prov-20120110.xsd
Install
-------
View
30 src/MATLABtestneuroprov.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<prov:container xmlns:prov="http://openprovenance.org/prov-xml#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ni="https://github.com/INCF/ProvenanceLibrary/wiki/terms" prov:id="BET">
+ <prov:records>
+ <prov:activity prov:id="a_0">
+ <prov:startTime>15-Feb-2012 13:37:29</prov:startTime>
+ <prov:endTime>15-Feb-2012 13:37:30</prov:endTime>
+ <prov:label>ni:brain_extraction</prov:label>
+ </prov:activity>
+ <prov:entity prov:id="e_0">
+ <prov:type xsi:type="xsd:string">NIFTI Image #1</prov:type>
+ <ni:name xsi:type="xsd:string">FileName</ni:name>
+ <ni:value xsi:type="xsd:string">???</ni:value>
+ </prov:entity>
+ <prov:dependencies>
+ <prov:used prov:id="u_0">
+ <prov:activity prov:ref="a_0"/>
+ <prov:entity prov:ref="e_0"/>
+ </prov:used>
+ <prov:used prov:id="u_1">
+ <prov:activity prov:ref="a_0"/>
+ <prov:entity prov:ref="e_1"/>
+ </prov:used>
+ </prov:dependencies>
+ <prov:entity prov:id="e_1">
+ <prov:type xsi:type="xsd:string">NIFTI Image #2</prov:type>
+ <ni:name xsi:type="xsd:string">FileName</ni:name>
+ <ni:value xsi:type="xsd:string">???</ni:value>
+ </prov:entity>
+ </prov:records>
+</prov:container>
View
100 src/neuroprovenance.c
@@ -1,3 +1,4 @@
+#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -12,6 +13,8 @@ ProvObjectPtr newProvenanceObject(const char* id)
ProvPtr p_prov = newProvenanceFactory(id);
// add new namespace
addNamespace(p_prov, "https://github.com/INCF/ProvenanceLibrary/wiki/terms", "ni");
+ //xmlNewNs(root_node, "http://incf.org/incf-schema", "incf");
+ //xmlNewNs(root_node, "http://this.namespace.needs.to/be.decided", "ni");
return((ProvObjectPtr)p_prov);
}
@@ -61,7 +64,8 @@ ProcessPtr newProcess(ProvObjectPtr p_prov, const char* startTime, const char* e
RecordPtr p_record = ((ProvPtr)p_prov)->p_record;
IDREF act_id = newActivity(p_record, NULL, startTime, endTime);
if (type != NULL)
- addAttribute(p_record, act_id, "type", type);
+ addAttribute(p_record, act_id, "prov", NULL, "label", type);
+ assert(act_id);
return((ProcessPtr)act_id);
}
@@ -70,13 +74,16 @@ REFID newProcessInput(ProvObjectPtr p_prov, ProcessPtr p_proc, const char* name,
{
RecordPtr p_record = ((ProvPtr)p_prov)->p_record;
IDREF id = newEntity(p_record);
+ assert(id);
if (type == NULL)
- addAttribute(p_record, id, "type", "ni:input");
+ addAttribute(p_record, id, "prov", "xsd:QName", "type", "ni:input");
else
- addAttribute(p_record, id, "type", type);
- addAttribute(p_record, id, "name", name);
- addAttribute(p_record, id, "value", value);
- newUsedRecord(p_record, (IDREF)p_proc, id, NULL);
+ addAttribute(p_record, id, "prov", "xsd:string", "type", type);
+ addAttribute(p_record, id, "ni", "xsd:string", "name", name);
+ addAttribute(p_record, id, "ni", "xsd:string", "value", value);
+ IDREF used_id = newUsedRecord(p_record, (IDREF)p_proc, id, NULL);
+ assert(used_id);
+ freeID(used_id);
return((REFID)id);
}
@@ -85,13 +92,16 @@ REFID newProcessOutput(ProvObjectPtr p_prov, ProcessPtr p_proc, const char* name
{
RecordPtr p_record = ((ProvPtr)p_prov)->p_record;
IDREF id = newEntity(p_record);
+ assert(id);
if (type == NULL)
- addAttribute(p_record, id, "type", "ni:output");
+ addAttribute(p_record, id, "prov", "xsd:QName", "type", "ni:output");
else
- addAttribute(p_record, id, "type", type);
- addAttribute(p_record, id, "name", name);
- addAttribute(p_record, id, "value", value);
- newGeneratedByRecord(p_record, id, (IDREF)p_proc, NULL);
+ addAttribute(p_record, id, "prov", "xsd:string", "type", type);
+ addAttribute(p_record, id, "ni", "xsd:string", "name", name);
+ addAttribute(p_record, id, "ni", "xsd:string", "value", value);
+ IDREF gen_id = newGeneratedByRecord(p_record, id, (IDREF)p_proc, NULL);
+ assert(gen_id);
+ freeID(gen_id);
return((REFID)id);
}
@@ -99,7 +109,9 @@ REFID newProcessOutput(ProvObjectPtr p_prov, ProcessPtr p_proc, const char* name
int addInput(ProvObjectPtr p_prov, ProcessPtr p_proc, REFID input)
{
RecordPtr p_record = ((ProvPtr)p_prov)->p_record;
- newUsedRecord(p_record, (IDREF)p_proc, input, NULL);
+ IDREF id = newUsedRecord(p_record, (IDREF)p_proc, input, NULL);
+ assert(id);
+ freeID(id);
return(0);
}
@@ -107,7 +119,9 @@ int addInput(ProvObjectPtr p_prov, ProcessPtr p_proc, REFID input)
int addOutput(ProvObjectPtr p_prov, ProcessPtr p_proc, REFID output)
{
RecordPtr p_record = ((ProvPtr)p_prov)->p_record;
- newGeneratedByRecord(p_record, output, (IDREF)p_proc, NULL);
+ IDREF id = newGeneratedByRecord(p_record, output, (IDREF)p_proc, NULL);
+ assert(id);
+ freeID(id);
return(0);
}
@@ -135,10 +149,11 @@ static char* get_md5_hash(const char* path)
}
EVP_DigestFinal_ex(&mdctx, md_value, &md_len);
EVP_MD_CTX_cleanup(&mdctx);
- char* p_hash = (char*)malloc(2*md_len*sizeof(char));
- char* p_idx = p_hash;
+ unsigned char* p_hash = (unsigned char*)malloc((2*md_len+1)*sizeof(unsigned char));
+ unsigned char* p_idx = p_hash;
int i;
- for(i = 0; i < md_len; i++, p_idx+=2) sprintf(p_idx, "%02x", md_value[i]);
+ for(i = 0; i < md_len; i++, p_idx+=2)
+ sprintf(p_idx, "%02x", md_value[i]);
fclose(file);
free(buffer);
return p_hash;
@@ -151,15 +166,16 @@ REFID newFile(ProvObjectPtr p_prov, const char* filename, const char* type)
IDREF id = newEntity(p_record);
unsigned char* p_hash;
if (type == NULL)
- addAttribute(p_record, id, "type", "ni:file");
+ addAttribute(p_record, id, "prov", "xsd:QName", "type", "ni:file");
else
- addAttribute(p_record, id, "type", type);
- addAttribute(p_record, id, "path", filename);
+ addAttribute(p_record, id, "prov", "xsd:QName", "type", type);
+ //addAttribute(p_record, id, "ni", "xsd:string", "path", filename);
p_hash = get_md5_hash(filename);
if (p_hash != NULL){
- addAttribute(p_record, id, "md5sum", p_hash);
+ addAttribute(p_record, id, "ni", NULL, "md5sum", p_hash);
free(p_hash);
}
+ assert(id);
return((REFID)id);
}
@@ -170,11 +186,12 @@ REFID newFileCollection(ProvObjectPtr p_prov, const char** filenames, int n_file
IDREF id = newEntity(p_record);
int i;
if (type == NULL)
- addAttribute(p_record, id, "type", "ni:filelist");
+ addAttribute(p_record, id, "prov", "xsd:QName", "type", "ni:filelist");
else
- addAttribute(p_record, id, "type", type);
+ addAttribute(p_record, id, "prov", "xsd:string", "type", type);
for(i=0; i<n_files; i++)
- addAttribute(p_record, id, "path", filenames[i]);
+ addAttribute(p_record, id, "ni", NULL, "path", filenames[i]);
+ assert(id);
return((REFID)id);
}
@@ -183,8 +200,9 @@ REFID addEnvironVariable(ProvObjectPtr p_prov, ProcessPtr p_proc, const char* na
{
RecordPtr p_record = ((ProvPtr)p_prov)->p_record;
IDREF id = newEntity(p_record);
- addAttribute(p_record, id, "type", "ni:environ");
- addAttribute(p_record, id, name, getenv(name));
+ addAttribute(p_record, id, "prov", "xsd:QName", "type", "ni:environ");
+ addAttribute(p_record, id, "ni", NULL, name, getenv(name));
+ assert(id);
return((REFID)id);
}
@@ -195,7 +213,8 @@ REFID addAllEnvironVariables(ProvObjectPtr p_prov, ProcessPtr p_proc, char **env
IDREF id = newEntity(p_record);
char buffer[255];
int i;
- addAttribute(p_record, id, "type", "ni:environ");
+ addAttribute(p_record, id, "prov", "xsd:QName", "type", "ni:environ");
+ //addAttribute(p_record, id, "ni", "foo", "foo");
char** env;
for (env = envp; *env != 0; env++)
{
@@ -206,9 +225,14 @@ REFID addAllEnvironVariables(ProvObjectPtr p_prov, ProcessPtr p_proc, char **env
while (thisEnv[pos++] != '=');
name = strndup(thisEnv, pos-1);
if (name[0] != '_')
- addAttribute(p_record, id, name, &thisEnv[pos]);
+ {
+ sprintf(buffer, "%s\0", &thisEnv[pos]);
+ //fprintf(stderr, "<%s>=%s\n", name, &buffer);
+ addAttribute(p_record, id, "ni", NULL, name, &buffer);
+ }
free(name);
}
+ assert(id);
return((REFID)id);
}
@@ -216,7 +240,7 @@ REFID addAllEnvironVariables(ProvObjectPtr p_prov, ProcessPtr p_proc, char **env
int addKeyValuePair(ProvObjectPtr p_prov, ProcessPtr p_proc, const char* key, const char* value)
{
RecordPtr p_record = ((ProvPtr)p_prov)->p_record;
- addAttribute(p_record, (IDREF)p_proc, key, value);
+ addAttribute(p_record, (IDREF)p_proc, "ni", NULL, key, value);
return(0);
}
@@ -241,7 +265,7 @@ int addCommandLine(ProvObjectPtr p_prov, ProcessPtr p_proc, int argc, char** arg
RecordPtr p_record = ((ProvPtr)p_prov)->p_record;
IDREF id = (IDREF)p_proc;
char *cmdline = get_cmdline(argc, argv);
- addAttribute(p_record, id, "cmdline", cmdline);
+ addAttribute(p_record, id, "ni", NULL, "cmdline", cmdline);
free(cmdline);
return(0);
}
@@ -253,10 +277,13 @@ int addDependency(ProvObjectPtr p_prov, ProcessPtr parent, ProcessPtr child)
}
/* Add additional type information to a record object (process/input/output) */
-int addType(ProvObjectPtr p_prov, REFID id, const char* type)
+int addType(ProvObjectPtr p_prov, REFID id, const char* type, const char* xsdType)
{
RecordPtr p_record = ((ProvPtr)p_prov)->p_record;
- addAttribute(p_record, id, "type", type);
+ if (xsdType == NULL)
+ addAttribute(p_record, id, "prov", "xsd:string", "type", type);
+ else
+ addAttribute(p_record, id, "prov", xsdType, "type", type);
return(0);
}
@@ -265,6 +292,17 @@ int changeREFID(ProvObjectPtr p_prov, REFID id, const char* new_id)
return(changeID(((ProvPtr)p_prov)->p_record, (IDREF)id, new_id));
}
+int freeREFID(REFID id)
+{
+ freeID((IDREF)id);
+ return(0);
+}
+
+int freeProcess(ProcessPtr p_proc)
+{
+ return(freeREFID((REFID)p_proc));
+}
+
int addProvenanceRecord(ProvObjectPtr p_curprov, const ProvObjectPtr p_otherprov, const char *prefix)
{
return(addProvAsAccount(((ProvPtr)p_curprov)->p_record, (ProvPtr)p_otherprov, prefix));
View
4 src/neuroprovenance.h
@@ -26,6 +26,7 @@ void freeBuffer(char* buffer);
/* Record creation routines */
ProcessPtr newProcess(ProvObjectPtr, const char* startTime, const char* endTime, const char* type);
+int freeProcess(ProcessPtr p_proc);
REFID newProcessInput(ProvObjectPtr p_prov, ProcessPtr p_proc, const char* name, const char* value, const char* type);
REFID newProcessOutput(ProvObjectPtr p_prov, ProcessPtr, const char* name, const char* value, const char* type);
@@ -40,9 +41,10 @@ REFID addEnvironVariable(ProvObjectPtr p_prov, ProcessPtr p_proc, const char* na
REFID addAllEnvironVariables(ProvObjectPtr p_prov, ProcessPtr p_proc, char **envp);
int addDependency(ProvObjectPtr p_prov, ProcessPtr parent, ProcessPtr child);
-int addType(ProvObjectPtr p_prov, REFID id, const char* type);
+int addType(ProvObjectPtr p_prov, REFID id, const char* type, const char* xsdType);
int changeREFID(ProvObjectPtr p_prov, REFID id, const char*);
+int freeREFID(REFID id);
int addProvenanceRecord(ProvObjectPtr p_curprov, const ProvObjectPtr p_otherprov, const char *prefix);
#endif
View
241 src/provenance.c
@@ -54,11 +54,17 @@ static XPathQueryPtr query_xpath(const xmlDocPtr doc, const xmlChar* xpathExpr)
return(NULL);
}
+ xpathCtx->namespaces = xmlGetNsList(doc, xmlDocGetRootElement(doc));
+ xpathCtx->nsNr = 0;
+ if (xpathCtx->namespaces != NULL) {
+ while (xpathCtx->namespaces[xpathCtx->nsNr] != NULL)
+ xpathCtx->nsNr++;
+ }
+
/* Evaluate xpath expression */
xpathObj = xmlXPathEvalExpression(xpathExpr, xpathCtx);
if(xpathObj == NULL) {
fprintf(stderr,"Error: unable to evaluate xpath expression \"%s\"\n", xpathExpr);
- xmlXPathFreeContext(xpathCtx);
return(NULL);
}
XPathQueryPtr p_xpquery = (XPathQueryPtr)malloc(sizeof(XPathQuery));
@@ -68,6 +74,8 @@ static XPathQueryPtr query_xpath(const xmlDocPtr doc, const xmlChar* xpathExpr)
}
static int free_xpquery(XPathQueryPtr p_xpquery){
+ if (p_xpquery->xpathCtx->namespaces != NULL)
+ xmlFree(p_xpquery->xpathCtx->namespaces);
xmlXPathFreeObject(p_xpquery->xpathObj);
xmlXPathFreeContext(p_xpquery->xpathCtx);
free(p_xpquery);
@@ -75,6 +83,30 @@ static int free_xpquery(XPathQueryPtr p_xpquery){
}
/*
+ Get the namespace prefix associated with the node
+*/
+static xmlNsPtr getNs(xmlNodePtr p_node, const char *prefix)
+{
+ xmlNsPtr ns = NULL;
+ xmlNodePtr root_node = xmlDocGetRootElement(p_node->doc);
+ if (prefix == NULL)
+ ns = xmlSearchNs(p_node->doc, root_node, BAD_CAST "prov");
+ else
+ ns = xmlSearchNs(p_node->doc, root_node, BAD_CAST prefix);
+ if (ns == NULL) {
+ if (prefix == NULL)
+ fprintf(stderr, "Prov namespace not defined.\n");
+ else
+ fprintf(stderr, "Namespace %s not defined. Use AddNamespace().\n", prefix);
+ }
+ /*
+ else
+ fprintf(stderr, "Namespace: %s\n", ns->prefix);
+ */
+ return(ns);
+}
+
+/*
Generic element adding routine
*/
static xmlNodePtr add_element(xmlNodePtr p_record,
@@ -88,12 +120,13 @@ static xmlNodePtr add_element(xmlNodePtr p_record,
xmlChar xpathExpr[255];
if (root == NULL)
- sprintf(xpathExpr, "//%s", element_name);
+ sprintf(xpathExpr, "//prov:%s", element_name);
else
- sprintf(xpathExpr, "//%s/%s", root, element_name);
+ sprintf(xpathExpr, "//prov:%s/prov:%s", root, element_name);
if (id_prefix != NULL){
- strcat(xpathExpr, "[@id]");
+ strcat(xpathExpr, "[@prov:id]");
}
+ //fprintf(stderr, "Query: %s\n", xpathExpr);
XPathQueryPtr p_xpquery = query_xpath(p_record->doc,
xpathExpr);
@@ -101,7 +134,7 @@ static xmlNodePtr add_element(xmlNodePtr p_record,
free_xpquery(p_xpquery);
if (root != NULL){
- sprintf(xpathExpr, "//%s", root);
+ sprintf(xpathExpr, "//prov:%s", root);
p_xpquery = query_xpath(p_record->doc, xpathExpr);
size2 = (p_xpquery->xpathObj->nodesetval) ? p_xpquery->xpathObj->nodesetval->nodeNr : 0;
@@ -114,11 +147,12 @@ static xmlNodePtr add_element(xmlNodePtr p_record,
else
root_node = p_record;
- p_node = xmlNewChild(root_node, NULL, BAD_CAST element_name, NULL);
- //fprintf(stdout, "%s:", id);
+ xmlNsPtr ns = getNs(root_node, NULL);
+ p_node = xmlNewChild(root_node, ns, BAD_CAST element_name, NULL);
if (id_prefix != NULL){
sprintf(id, "%s_%d", id_prefix, size1);
- xmlNewProp(p_node, BAD_CAST "id", BAD_CAST id);
+ //fprintf(stderr, "id: %s\n", id);
+ xmlNewNsProp(p_node, ns, BAD_CAST "id", BAD_CAST id);
}
return p_node;
}
@@ -129,14 +163,16 @@ static RecordPtr newRecord(ProvPtr p_prov)
{
assert(p_prov);
PrivateProvPtr p_priv = (PrivateProvPtr)(p_prov->private);
- XPathQueryPtr p_xpquery = query_xpath(p_priv->doc, "/container");
+ XPathQueryPtr p_xpquery = query_xpath(p_priv->doc, "/prov:container");
int size = (p_xpquery->xpathObj->nodesetval) ? p_xpquery->xpathObj->nodesetval->nodeNr : 0;
if (size != 1){
fprintf(stderr, "No container element found or multiple elements found\n");
return NULL;
}
- return (RecordPtr)add_element(p_xpquery->xpathObj->nodesetval->nodeTab[0], NULL, BAD_CAST "records", NULL);
+ RecordPtr p_record = (RecordPtr)add_element(p_xpquery->xpathObj->nodesetval->nodeTab[0], NULL, BAD_CAST "records", NULL);
+ free_xpquery(p_xpquery);
+ return(p_record);
}
@@ -162,13 +198,11 @@ ProvPtr newProvenanceFactory(const char* id)
PrivateProvPtr p_priv = (PrivateProvPtr)(p_prov->private);
p_priv->doc = xmlNewDoc(BAD_CAST "1.0");
xmlNodePtr root_node = xmlNewNode(NULL, BAD_CAST "container");
- xmlSetProp(root_node, BAD_CAST "id", BAD_CAST id);
xmlDocSetRootElement(p_priv->doc, root_node);
- xmlNewNs(root_node, "http://openprovenance.org/prov-xml#", "opm");
+ root_node->ns = xmlNewNs(root_node, "http://openprovenance.org/prov-xml#", "prov");
xmlNewNs(root_node, "http://www.w3.org/2001/XMLSchema-instance", "xsi");
xmlNewNs(root_node, "http://www.w3.org/2001/XMLSchema", "xsd");
- xmlNewNs(root_node, "http://openprovenance.org/prov-xml#", "prov");
- xmlNewNs(root_node, "http://incf.org/incf-schema", "incf");
+ xmlNewNsProp(root_node, root_node->ns, BAD_CAST "id", BAD_CAST id);
//fprintf(stdout, "Creating provenance object [END]\n");
p_prov->p_record = (void *)newRecord(p_prov);
@@ -196,12 +230,13 @@ ProvPtr newProvenanceFactoryFromFile(const char* filename)
return(NULL);
}
xmlNodePtr root_node = xmlDocGetRootElement(p_priv->doc);
- p_prov->id = strdup(xmlGetProp(root_node, BAD_CAST "id"));
- XPathQueryPtr p_xpquery = query_xpath(p_priv->doc, "/container/records");
+ p_prov->id = (char*)xmlGetProp(root_node, BAD_CAST "id");
+ XPathQueryPtr p_xpquery = query_xpath(p_priv->doc, "/prov:container/prov:records");
int size = (p_xpquery->xpathObj->nodesetval) ? p_xpquery->xpathObj->nodesetval->nodeNr : 0;
if (size != 1){
fprintf(stderr, "No records element found\n");
free(p_prov->private);
+ xmlFree((xmlChar*)p_prov->id);
free(p_prov);
free_xpquery(p_xpquery);
return NULL;
@@ -237,12 +272,12 @@ ProvPtr newProvenanceFactoryFromMemoryBuffer(const char* buffer, int bufferSize)
assert(root_node);
xmlChar* p_id = xmlGetProp(root_node, BAD_CAST "id");
assert(p_id);
- p_prov->id = strdup(p_id);
- XPathQueryPtr p_xpquery = query_xpath(p_priv->doc, "/container/records");
+ p_prov->id = p_id;
+ XPathQueryPtr p_xpquery = query_xpath(p_priv->doc, "/prov:container/prov:records");
int size = (p_xpquery->xpathObj->nodesetval) ? p_xpquery->xpathObj->nodesetval->nodeNr : 0;
if (size != 1){
fprintf(stderr, "%d records element found in container id[%s] \n", size, p_prov->id);
- free(p_prov->id);
+ xmlFree((xmlChar*)p_prov->id);
free(p_prov->private);
free(p_prov);
free_xpquery(p_xpquery);
@@ -274,9 +309,9 @@ int delProvenanceFactory(ProvPtr p_prov)
/*
* this is to debug memory for regression tests
*/
+ xmlFree((xmlChar*)p_prov->id);
xmlMemoryDump();
free(p_priv);
- free(p_prov->id);
free(p_prov);
//fprintf(stdout, "Destroying provenance object [END]\n");
@@ -342,7 +377,10 @@ RecordPtr newAccount(RecordPtr p_record, const char* asserter)
IDREF newEntity(RecordPtr p_record)
{
- return(xmlGetProp(add_element((xmlNodePtr)p_record, NULL, "entity", "e"), "id"));
+ xmlNodePtr p_node = add_element((xmlNodePtr)p_record, NULL, "entity", "e");
+ IDREF id = (IDREF)xmlGetProp(p_node, BAD_CAST "id");
+ assert(id);
+ return(id);
}
IDREF newActivity(RecordPtr p_record, const char* recipeLink,
@@ -353,102 +391,134 @@ IDREF newActivity(RecordPtr p_record, const char* recipeLink,
xmlNewChild(p_node, NULL, BAD_CAST "startTime", BAD_CAST startTime);
if (endTime != NULL)
xmlNewChild(p_node, NULL, BAD_CAST "endTime", BAD_CAST endTime);
- return(xmlGetProp(p_node, "id"));
+ IDREF id = (IDREF)xmlGetProp(p_node, BAD_CAST "id");
+ assert(id);
+ return(id);
}
IDREF newAgent(RecordPtr p_record)
{
xmlNodePtr p_node = add_element((xmlNodePtr)p_record, NULL, "agent", "ag");
- return(xmlGetProp(p_node, "id"));
+ IDREF id = (IDREF)xmlGetProp(p_node, BAD_CAST "id");
+ assert(id);
+ return(id);
}
IDREF newNote(RecordPtr p_record)
{
xmlNodePtr p_node = add_element((xmlNodePtr)p_record, NULL, "note", "n");
- return(xmlGetProp(p_node, "id"));
+ IDREF id = (IDREF)xmlGetProp(p_node, BAD_CAST "id");
+ assert(id);
+ return(id);
}
/* add relations */
IDREF newUsedRecord(RecordPtr p_record, IDREF activity, IDREF entity, const char* time)
{
xmlNodePtr p_node = add_element((xmlNodePtr)p_record, "dependencies", "used", "u");
- xmlSetProp(xmlNewChild(p_node, NULL, BAD_CAST "activity", NULL), BAD_CAST "ref", BAD_CAST activity);
- xmlSetProp(xmlNewChild(p_node, NULL, BAD_CAST "entity", NULL), BAD_CAST "ref", BAD_CAST entity);
+ xmlNsPtr ns = getNs(p_node, NULL);
+ xmlNodePtr p_child = xmlNewChild(p_node, ns, BAD_CAST "activity", NULL);
+ xmlNewNsProp(p_child, ns, "ref", (xmlChar*) activity);
+ xmlNewNsProp(xmlNewChild(p_node, ns, BAD_CAST "entity", NULL), ns, BAD_CAST "ref", BAD_CAST entity);
if (time != NULL)
- xmlNewChild(p_node, NULL, BAD_CAST "time", BAD_CAST time);
+ xmlNewChild(p_node, ns, BAD_CAST "time", BAD_CAST time);
return(xmlGetProp(p_node, "id"));
}
IDREF newGeneratedByRecord(RecordPtr p_record, IDREF entity, IDREF activity, const char* time)
{
xmlNodePtr p_node = add_element((xmlNodePtr)p_record, "dependencies", "wasGeneratedBy", "wgb");
- xmlSetProp(xmlNewChild(p_node, NULL, BAD_CAST "entity", NULL), BAD_CAST "ref", BAD_CAST entity);
- xmlSetProp(xmlNewChild(p_node, NULL, BAD_CAST "activity", NULL), BAD_CAST "ref", BAD_CAST activity);
+ xmlNsPtr ns = getNs(p_node, NULL);
+ xmlNewNsProp(xmlNewChild(p_node, ns, BAD_CAST "entity", NULL), ns, BAD_CAST "ref", BAD_CAST entity);
+ xmlNewNsProp(xmlNewChild(p_node, ns, BAD_CAST "activity", NULL), ns, BAD_CAST "ref", BAD_CAST activity);
if (time != NULL)
- xmlNewChild(p_node, NULL, BAD_CAST "time", BAD_CAST time);
- return(xmlGetProp(p_node, "id"));
+ xmlNewChild(p_node, ns, BAD_CAST "time", BAD_CAST time);
+ IDREF id = (IDREF)xmlGetProp(p_node, BAD_CAST "id");
+ assert(id);
+ return(id);
}
IDREF newAssociatedWithRecord(RecordPtr p_record, IDREF activity, IDREF agent, const char* startTime, const char* endTime)
{
xmlNodePtr p_node = add_element((xmlNodePtr)p_record, "dependencies", "wasAssociatedWith", "waw");
- xmlSetProp(xmlNewChild(p_node, NULL, BAD_CAST "activity", NULL), BAD_CAST "ref", BAD_CAST activity);
- xmlSetProp(xmlNewChild(p_node, NULL, BAD_CAST "agent", NULL), BAD_CAST "ref", BAD_CAST agent);
- return(xmlGetProp(p_node, "id"));
+ xmlNsPtr ns = getNs(p_node, NULL);
+ xmlNewNsProp(xmlNewChild(p_node, ns, BAD_CAST "activity", NULL), ns, BAD_CAST "ref", BAD_CAST activity);
+ xmlNewNsProp(xmlNewChild(p_node, ns, BAD_CAST "agent", NULL), ns, BAD_CAST "ref", BAD_CAST agent);
+ IDREF id = (IDREF)xmlGetProp(p_node, BAD_CAST "id");
+ assert(id);
+ return(id);
}
IDREF newControlledByRecord(RecordPtr p_record, IDREF activity, IDREF agent, const char* startTime, const char* endTime)
{
xmlNodePtr p_node = add_element((xmlNodePtr)p_record, "dependencies", "wasControlledBy", "wcb");
- xmlSetProp(xmlNewChild(p_node, NULL, BAD_CAST "effect", NULL), BAD_CAST "ref", BAD_CAST activity);
- xmlSetProp(xmlNewChild(p_node, NULL, BAD_CAST "cause", NULL), BAD_CAST "ref", BAD_CAST agent);
+ xmlNsPtr ns = getNs(p_node, NULL);
+ xmlNewNsProp(xmlNewChild(p_node, ns, BAD_CAST "effect", NULL), ns, BAD_CAST "ref", BAD_CAST activity);
+ xmlNewNsProp(xmlNewChild(p_node, ns, BAD_CAST "cause", NULL), ns, BAD_CAST "ref", BAD_CAST agent);
if (startTime != NULL)
- xmlNewChild(p_node, NULL, BAD_CAST "startTime", BAD_CAST startTime);
+ xmlNewChild(p_node, ns, BAD_CAST "startTime", BAD_CAST startTime);
if (endTime != NULL)
- xmlNewChild(p_node, NULL, BAD_CAST "endTime", BAD_CAST endTime);
- return(xmlGetProp(p_node, "id"));
+ xmlNewChild(p_node, ns, BAD_CAST "endTime", BAD_CAST endTime);
+ IDREF id = (IDREF)xmlGetProp(p_node, BAD_CAST "id");
+ assert(id);
+ return(id);
}
IDREF newDerivedFromRecord(RecordPtr p_record, IDREF entity_effect, IDREF entity_cause)
{
xmlNodePtr p_node = add_element((xmlNodePtr)p_record, "dependencies", "wasDerivedFrom", "wdf");
- xmlSetProp(xmlNewChild(p_node, NULL, BAD_CAST "effect", NULL), BAD_CAST "ref", BAD_CAST entity_effect);
- xmlSetProp(xmlNewChild(p_node, NULL, BAD_CAST "cause", NULL), BAD_CAST "ref", BAD_CAST entity_cause);
- return(xmlGetProp(p_node, "id"));
+ xmlNsPtr ns = getNs(p_node, NULL);
+ xmlNewNsProp(xmlNewChild(p_node, ns, BAD_CAST "effect", NULL), ns, BAD_CAST "ref", BAD_CAST entity_effect);
+ xmlNewNsProp(xmlNewChild(p_node, ns, BAD_CAST "cause", NULL), ns, BAD_CAST "ref", BAD_CAST entity_cause);
+ IDREF id = (IDREF)xmlGetProp(p_node, BAD_CAST "id");
+ assert(id);
+ return(id);
}
IDREF newInformedByRecord(RecordPtr p_record, IDREF activity_effect, IDREF activity_cause, const char* time)
{
xmlNodePtr p_node = add_element((xmlNodePtr)p_record, "dependencies", "wasInformedBy", "wib");
- xmlSetProp(xmlNewChild(p_node, NULL, BAD_CAST "effect", NULL), BAD_CAST "ref", BAD_CAST activity_effect);
- xmlSetProp(xmlNewChild(p_node, NULL, BAD_CAST "cause", NULL), BAD_CAST "ref", BAD_CAST activity_cause);
+ xmlNsPtr ns = getNs(p_node, NULL);
+ xmlNewNsProp(xmlNewChild(p_node, ns, BAD_CAST "effect", NULL), ns, BAD_CAST "ref", BAD_CAST activity_effect);
+ xmlNewNsProp(xmlNewChild(p_node, ns, BAD_CAST "cause", NULL), ns, BAD_CAST "ref", BAD_CAST activity_cause);
if (time != NULL)
- xmlNewChild(p_node, NULL, BAD_CAST "time", BAD_CAST time);
- return(xmlGetProp(p_node, "id"));
+ xmlNewChild(p_node, ns, BAD_CAST "time", BAD_CAST time);
+ IDREF id = (IDREF)xmlGetProp(p_node, BAD_CAST "id");
+ assert(id);
+ return(id);
}
IDREF newAlternateOfRecord(RecordPtr p_record, IDREF entity1, IDREF entity2)
{
xmlNodePtr p_node = add_element((xmlNodePtr)p_record, "dependencies", "alternateOf", "ao");
- xmlSetProp(xmlNewChild(p_node, NULL, BAD_CAST "entity1", NULL), BAD_CAST "ref", BAD_CAST entity1);
- xmlSetProp(xmlNewChild(p_node, NULL, BAD_CAST "entity2", NULL), BAD_CAST "ref", BAD_CAST entity2);
- return(xmlGetProp(p_node, "id"));
+ xmlNsPtr ns = getNs(p_node, NULL);
+ xmlNewNsProp(xmlNewChild(p_node, ns, BAD_CAST "entity1", NULL), ns, BAD_CAST "ref", BAD_CAST entity1);
+ xmlNewNsProp(xmlNewChild(p_node, ns, BAD_CAST "entity2", NULL), ns, BAD_CAST "ref", BAD_CAST entity2);
+ IDREF id = (IDREF)xmlGetProp(p_node, BAD_CAST "id");
+ assert(id);
+ return(id);
}
IDREF newSpecializationOfRecord(RecordPtr p_record, IDREF entity1, IDREF entity2)
{
xmlNodePtr p_node = add_element((xmlNodePtr)p_record, "dependencies", "specializationOf", "so");
- xmlSetProp(xmlNewChild(p_node, NULL, BAD_CAST "entity1", NULL), BAD_CAST "ref", BAD_CAST entity1);
- xmlSetProp(xmlNewChild(p_node, NULL, BAD_CAST "entity2", NULL), BAD_CAST "ref", BAD_CAST entity2);
- return(xmlGetProp(p_node, "id"));
+ xmlNsPtr ns = getNs(p_node, NULL);
+ xmlNewNsProp(xmlNewChild(p_node, ns, BAD_CAST "entity1", NULL), ns, BAD_CAST "ref", BAD_CAST entity1);
+ xmlNewNsProp(xmlNewChild(p_node, ns, BAD_CAST "entity2", NULL), ns, BAD_CAST "ref", BAD_CAST entity2);
+ IDREF id = (IDREF)xmlGetProp(p_node, BAD_CAST "id");
+ assert(id);
+ return(id);
}
IDREF newHasAnnotationRecord(RecordPtr p_record, IDREF thing, IDREF note)
{
xmlNodePtr p_node = add_element((xmlNodePtr)p_record, "dependencies", "hasAnnotation", "ha");
- xmlSetProp(xmlNewChild(p_node, NULL, BAD_CAST "thing", NULL), BAD_CAST "ref", BAD_CAST thing);
- xmlSetProp(xmlNewChild(p_node, NULL, BAD_CAST "note", NULL), BAD_CAST "ref", BAD_CAST note);
- return(xmlGetProp(p_node, "id"));
+ xmlNsPtr ns = getNs(p_node, NULL);
+ xmlNewNsProp(xmlNewChild(p_node, ns, BAD_CAST "thing", NULL), ns, BAD_CAST "ref", BAD_CAST thing);
+ xmlNewNsProp(xmlNewChild(p_node, ns, BAD_CAST "note", NULL), ns, BAD_CAST "ref", BAD_CAST note);
+ IDREF id = (IDREF)xmlGetProp(p_node, BAD_CAST "id");
+ assert(id);
+ return(id);
}
/* Record manipulation routines */
@@ -456,10 +526,11 @@ IDREF newHasAnnotationRecord(RecordPtr p_record, IDREF thing, IDREF note)
/*
Add key value elements with given id
*/
-int addAttribute(RecordPtr p_record, IDREF id, const char* key, const char* value)
+int addAttribute(RecordPtr p_record, IDREF id, const char * prefix, const char* type, const char* localName, const char* value)
{
xmlChar xpathExpr[128];
- sprintf(xpathExpr, "//*[@id='%s']", id);
+ assert(id);
+ sprintf(xpathExpr, "//*[@prov:id='%s']", id);
XPathQueryPtr p_xpquery = query_xpath(((xmlNodePtr)p_record)->doc,
xpathExpr);
int size = (p_xpquery->xpathObj->nodesetval) ? p_xpquery->xpathObj->nodesetval->nodeNr : 0;
@@ -470,17 +541,26 @@ int addAttribute(RecordPtr p_record, IDREF id, const char* key, const char* valu
free_xpquery(p_xpquery);
return(1);
}
+ //fprintf(stdout, "=====%s=====\n", id);
if (size>1){
- fprintf(stderr, "Multiple elements found. Doc invalid.\n");
+ fprintf(stderr, "addAttribute: Multiple elements found [n=%d]. Doc invalid. [id=%s]\n", size, id);
/* Cleanup */
free_xpquery(p_xpquery);
return(1);
}
xmlNodePtr p_node = p_xpquery->xpathObj->nodesetval->nodeTab[0];
- assert(key);
+ assert(localName);
assert(value);
- xmlNewChild(p_node, NULL, BAD_CAST key, BAD_CAST value);
-
+ xmlNsPtr ns = getNs(p_node, prefix);
+ if (ns == NULL) {
+ free_xpquery(p_xpquery);
+ return(1);
+ }
+ xmlNodePtr p_child = xmlNewChild(p_node, ns, BAD_CAST localName, BAD_CAST value);
+ if (type != NULL)
+ xmlNewProp(p_child, "xsi:type", type);
+ //fprintf(stderr,"%s=%s\n", localName, value);
+ //xmlSaveFormatFileEnc("-", ((xmlNodePtr)p_record)->doc, "UTF-8", 1);
/* Cleanup */
free_xpquery(p_xpquery);
return(0);
@@ -489,7 +569,7 @@ int addAttribute(RecordPtr p_record, IDREF id, const char* key, const char* valu
int changeID(RecordPtr p_record, IDREF id, const char* new_id)
{
xmlChar xpathExpr[128];
- sprintf(xpathExpr, "//*[@id='%s']", id);
+ sprintf(xpathExpr, "//*[@prov:id='%s']", id);
XPathQueryPtr p_xpquery = query_xpath(((xmlNodePtr)p_record)->doc,
xpathExpr);
int size = (p_xpquery->xpathObj->nodesetval) ? p_xpquery->xpathObj->nodesetval->nodeNr : 0;
@@ -501,7 +581,7 @@ int changeID(RecordPtr p_record, IDREF id, const char* new_id)
return(1);
}
if (size>1){
- fprintf(stderr, "Multiple elements found. Doc invalid.\n");
+ fprintf(stderr, "changeID: Multiple elements found. Doc invalid.\n");
/* Cleanup */
free_xpquery(p_xpquery);
return(1);
@@ -519,16 +599,21 @@ static void change_refs(xmlNodePtr p_node, char *prefix)
{
xmlNodePtr p_curnode = NULL;
char newid[255];
+ xmlChar* p_prop;
for (p_curnode = p_node; p_curnode; p_curnode = p_curnode->next) {
if (p_curnode->type == XML_ELEMENT_NODE) {
- if (xmlHasProp(p_curnode, BAD_CAST "id") != NULL){
- sprintf(newid, "%s_%s", prefix, xmlGetProp(p_curnode, BAD_CAST"id"));
- xmlSetProp(p_curnode, BAD_CAST "id", BAD_CAST newid);
+ if (xmlHasProp(p_curnode, BAD_CAST "id") != NULL){
+ p_prop = xmlGetProp(p_curnode, BAD_CAST"id");
+ sprintf(newid, "%s_%s", prefix, p_prop);
+ xmlSetProp(p_curnode, BAD_CAST "prov:id", BAD_CAST newid);
+ xmlFree(p_prop);
}
- if (xmlHasProp(p_curnode, BAD_CAST "ref") != NULL){
- sprintf(newid, "%s_%s", prefix, xmlGetProp(p_curnode, BAD_CAST"ref"));
- xmlSetProp(p_curnode, BAD_CAST "ref", BAD_CAST newid);
+ if (xmlHasProp(p_curnode, BAD_CAST "ref") != NULL){
+ p_prop = xmlGetProp(p_curnode, BAD_CAST"ref");
+ sprintf(newid, "%s_%s", prefix, p_prop);
+ xmlSetProp(p_curnode, BAD_CAST "prov:ref", BAD_CAST newid);
+ xmlFree(p_prop);
}
}
change_refs(p_curnode->children, prefix);
@@ -546,13 +631,16 @@ int addProvAsAccount(RecordPtr p_record, const ProvPtr p_prov, const char *prefi
char new_prefix[255];
if (prefix != NULL)
sprintf(new_prefix, "%s", prefix);
- else
- sprintf(new_prefix, "%s", xmlGetProp(p_account, "id") );
- fprintf(stdout, "new prefix: %s\n", new_prefix);
+ else{
+ xmlChar* id = xmlGetProp(p_account, "id");
+ sprintf(new_prefix, "%s", id);
+ xmlFree(id);
+ }
+ //fprintf(stdout, "new prefix: %s\n", new_prefix);
//copy contents of provenance record
PrivateProvPtr p_priv = (PrivateProvPtr)(p_prov->private);
- XPathQueryPtr p_xpquery = query_xpath(p_priv->doc, "/container/records");
+ XPathQueryPtr p_xpquery = query_xpath(p_priv->doc, "/prov:container/prov:records");
int size = (p_xpquery->xpathObj->nodesetval) ? p_xpquery->xpathObj->nodesetval->nodeNr : 0;
//fprintf(stdout, "xpath[%s]:numnodes[%d]\n", xpathExpr, size);
if (size==0){
@@ -574,5 +662,10 @@ int addProvAsAccount(RecordPtr p_record, const ProvPtr p_prov, const char *prefi
}
-
+int freeID(IDREF id)
+{
+ xmlFree((xmlChar*)id);
+ id = NULL;
+ return(0);
+}
#endif
View
3  src/provenance.h
@@ -50,8 +50,9 @@ IDREF newSpecializationOfRecord(RecordPtr p_record, IDREF entity1, IDREF entity2
IDREF newHasAnnotationRecord(RecordPtr p_rec, IDREF thing, IDREF note);
/* Record manipulation routines */
-int addAttribute(RecordPtr p_record, IDREF id, const char* key, const char* value);
+int addAttribute(RecordPtr p_record, IDREF id, const char * prefix, const char * type, const char* localName, const char* value);
int changeID(RecordPtr, IDREF, const char*);
int addProvAsAccount(RecordPtr p_record, const ProvPtr p_prov, const char *prefix);
+int freeID(IDREF id);
#endif
View
23 src/testneuroprov.c
@@ -22,7 +22,7 @@ main(int argc, char **argv, char** envp)
{
ProvObjectPtr p_prov = newProvenanceObject("BET");
ProcessPtr p_proc;
- REFID id, act_id;
+ REFID id, act_id, input_id;
char arg[50];
int i;
@@ -30,7 +30,7 @@ main(int argc, char **argv, char** envp)
p_proc = newProcess(p_prov,
"11/30/11 00:13:20.650432 EST",
"11/30/11 00:13:20.650550 EST",
- "ni:brain_extraction");
+ "brain_extraction");
addCommandLine(p_prov, p_proc, argc, argv);
addKeyValuePair(p_prov, p_proc, "program", argv[0]);
@@ -39,32 +39,41 @@ main(int argc, char **argv, char** envp)
//Add all input parameters. if you use getopt this can be refined further
for(i=1;i<argc; i++){
sprintf(arg, "arg%d", i);
- newProcessInput(p_prov, p_proc, arg, argv[i], NULL);
+ input_id = newProcessInput(p_prov, p_proc, arg, argv[i], NULL);
+ freeREFID(input_id);
}
- addAllEnvironVariables(p_prov, p_proc, envp);
+ //addAllEnvironVariables(p_prov, p_proc, envp);
// [TODO]: add runtime info such as walltime, cputime, host,
- id = newFile(p_prov, "./testneuroprov.c", "ni:output");
+ id = newFile(p_prov, "./testneuroprov.c", "ni:output1");
addKeyValuePair(p_prov, id, "name", "warped_file");
- addType(p_prov, id, "ni:normalized");
+ addType(p_prov, id, "ni:normalized", "xsd:QName");
addOutput(p_prov, p_proc, id);
+ freeREFID(id);
id = newProcessOutput(p_prov, p_proc, "pearson_correlation_coefficient", ".234", "ni:output");
- addType(p_prov, id, "ni:statistic");
+ addType(p_prov, id, "ni:statistic", "xsd:QName");
+ freeREFID(id);
+ freeProcess(p_proc);
/* Test i/o manipulations */
char *buffer;
int bufsize;
+ // Write to file
printProvenance(p_prov, "testneuroprov.xml");
+ // Write to string
toBuffer(p_prov, &buffer, &bufsize);
delProvenanceObject(p_prov);
+ // Create provenance object from string
p_prov = newProvenanceObjectFromBuffer(buffer, bufsize);
freeBuffer(buffer);
delProvenanceObject(p_prov);
+ // Create provenance object from file
p_prov = newProvenanceObjectFromFile("testneuroprov.xml");
ProvObjectPtr p_prov2 = newProvenanceObject("NewStuff");
+ // Add older provenance to new provenace object
addProvenanceRecord(p_prov2, p_prov, NULL);
print_provenance(p_prov2, NULL);
print_provenance(p_prov2, "testneuroprov2.xml");
View
24 src/testneuroprov.m
@@ -0,0 +1,24 @@
+loadlibrary('libneuroprov.so','neuroprovenance.h');
+
+p_prov = calllib('libneuroprov','newProvenanceObject','BET');
+
+ProcessType = 'ni:brain_extraction';
+StartTime = datestr(now);
+pause(1)
+EndTime = datestr(now);
+p_proc = calllib('libneuroprov','newProcess',p_prov,StartTime,EndTime,ProcessType);
+
+InputType = 'NIFTI Image #1';
+InputName = 'FileName';
+InputValue = '???';
+input_id = calllib('libneuroprov','newProcessInput',p_prov,p_proc,InputName,InputValue,InputType);
+
+InputType = 'NIFTI Image #2';
+InputName = 'FileName';
+InputValue = '???';
+input_id = calllib('libneuroprov','newProcessInput',p_prov,p_proc,InputName,InputValue,InputType);
+
+calllib('libneuroprov','freeProcess',p_proc);
+
+calllib('libneuroprov','printProvenance',p_prov, 'MATLABtestneuroprov.xml');
+calllib('libneuroprov','delProvenanceObject',p_prov);
View
118 src/testneuroprov.xml
@@ -1,67 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
-<container xmlns:opm="http://openprovenance.org/prov-xml#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:prov="http://openprovenance.org/prov-xml#" xmlns:incf="http://incf.org/incf-schema" xmlns:ni="https://github.com/INCF/ProvenanceLibrary/wiki/terms" id="BET">
- <records>
- <activity id="a_0">
- <startTime>11/30/11 00:13:20.650432 EST</startTime>
- <endTime>11/30/11 00:13:20.650550 EST</endTime>
- <type>ni:brain_extraction</type>
- <cmdline>/Users/satra/Dropbox/WORK/PROJECTS/INCF/ProvenanceLibrary/src/testneuroprov -c 2</cmdline>
- <program>/Users/satra/Dropbox/WORK/PROJECTS/INCF/ProvenanceLibrary/src/testneuroprov</program>
- <version>1.0.0</version>
- </activity>
- <entity id="e_0">
- <type>ni:input</type>
- <name>arg1</name>
- <value>-c</value>
- </entity>
- <dependencies>
- <used id="u_0">
- <activity ref="a_0"/>
- <entity ref="e_0"/>
- </used>
- <used id="u_1">
- <activity ref="a_0"/>
- <entity ref="e_1"/>
- </used>
- <wasGeneratedBy id="wgb_0">
- <entity ref="e_3"/>
- <activity ref="a_0"/>
- </wasGeneratedBy>
- <wasGeneratedBy id="wgb_1">
- <entity ref="e_4"/>
- <activity ref="a_0"/>
- </wasGeneratedBy>
- </dependencies>
- <entity id="e_1">
- <type>ni:input</type>
- <name>arg2</name>
- <value>2</value>
- </entity>
- <entity id="e_2">
- <type>ni:environ</type>
- <PATH>/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/opt/local/bin:/usr/local/git/bin</PATH>
- <TMPDIR>/var/folders/1l/ly3rt98n1sd4cdw03l7ncf1r0000gn/T/</TMPDIR>
- <LOGNAME>satra</LOGNAME>
- <COMMAND_MODE>unix2003</COMMAND_MODE>
- <DISPLAY>/tmp/launch-9Dx8oH/org.macosforge.xquartz:0</DISPLAY>
- <Apple_PubSub_Socket_Render>/tmp/launch-PeLnXj/Render</Apple_PubSub_Socket_Render>
- <USER>satra</USER>
- <SHELL>/bin/bash</SHELL>
- <SSH_AUTH_SOCK>/tmp/launch-hjVTaO/Listeners</SSH_AUTH_SOCK>
- <HOME>/Users/satra</HOME>
- </entity>
- <entity id="e_3">
- <type>ni:output</type>
- <path>./testneuroprov.c</path>
- <md5sum>1913486fff3eefbdb0aea05778f57ec6</md5sum>
- <name>warped_file</name>
- <type>ni:normalized</type>
- </entity>
- <entity id="e_4">
- <type>ni:output</type>
- <name>pearson_correlation_coefficient</name>
- <value>.234</value>
- <type>ni:statistic</type>
- </entity>
- </records>
-</container>
+<prov:container xmlns:prov="http://openprovenance.org/prov-xml#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ni="https://github.com/INCF/ProvenanceLibrary/wiki/terms" prov:id="BET">
+ <prov:records>
+ <prov:activity prov:id="a_0">
+ <prov:startTime>11/30/11 00:13:20.650432 EST</prov:startTime>
+ <prov:endTime>11/30/11 00:13:20.650550 EST</prov:endTime>
+ <prov:label>brain_extraction</prov:label>
+ <ni:cmdline>/Users/satra/Dropbox/WORK/PROJECTS/INCF/ProvenanceLibrary/src/testneuroprov -c 2</ni:cmdline>
+ <ni:program>/Users/satra/Dropbox/WORK/PROJECTS/INCF/ProvenanceLibrary/src/testneuroprov</ni:program>
+ <ni:version>1.0.0</ni:version>
+ </prov:activity>
+ <prov:entity prov:id="e_0">
+ <prov:type xsi:type="xsd:QName">ni:input</prov:type>
+ <ni:name xsi:type="xsd:string">arg1</ni:name>
+ <ni:value xsi:type="xsd:string">-c</ni:value>
+ </prov:entity>
+ <prov:dependencies>
+ <prov:used prov:id="u_0">
+ <prov:activity prov:ref="a_0"/>
+ <prov:entity prov:ref="e_0"/>
+ </prov:used>
+ <prov:used prov:id="u_1">
+ <prov:activity prov:ref="a_0"/>
+ <prov:entity prov:ref="e_1"/>
+ </prov:used>
+ <prov:wasGeneratedBy prov:id="wgb_0">
+ <prov:entity prov:ref="e_2"/>
+ <prov:activity prov:ref="a_0"/>
+ </prov:wasGeneratedBy>
+ <prov:wasGeneratedBy prov:id="wgb_1">
+ <prov:entity prov:ref="e_3"/>
+ <prov:activity prov:ref="a_0"/>
+ </prov:wasGeneratedBy>
+ </prov:dependencies>
+ <prov:entity prov:id="e_1">
+ <prov:type xsi:type="xsd:QName">ni:input</prov:type>
+ <ni:name xsi:type="xsd:string">arg2</ni:name>
+ <ni:value xsi:type="xsd:string">2</ni:value>
+ </prov:entity>
+ <prov:entity prov:id="e_2">
+ <prov:type xsi:type="xsd:QName">ni:output1</prov:type>
+ <ni:md5sum>c6fc61304cfff1300b9ae4b8cc1911d8</ni:md5sum>
+ <ni:name>warped_file</ni:name>
+ <prov:type xsi:type="xsd:QName">ni:normalized</prov:type>
+ </prov:entity>
+ <prov:entity prov:id="e_3">
+ <prov:type xsi:type="xsd:string">ni:output</prov:type>
+ <ni:name xsi:type="xsd:string">pearson_correlation_coefficient</ni:name>
+ <ni:value xsi:type="xsd:string">.234</ni:value>
+ <prov:type xsi:type="xsd:QName">ni:statistic</prov:type>
+ </prov:entity>
+ </prov:records>
+</prov:container>
View
126 src/testneuroprov2.xml
@@ -1,71 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
-<container xmlns:opm="http://openprovenance.org/prov-xml#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:prov="http://openprovenance.org/prov-xml#" xmlns:incf="http://incf.org/incf-schema" xmlns:ni="https://github.com/INCF/ProvenanceLibrary/wiki/terms" id="NewStuff">
- <records>
- <account id="ac_0">
- <records>
- <activity id="ac_0_a_0">
- <startTime>11/30/11 00:13:20.650432 EST</startTime>
- <endTime>11/30/11 00:13:20.650550 EST</endTime>
- <type>ni:brain_extraction</type>
- <cmdline>/Users/satra/Dropbox/WORK/PROJECTS/INCF/ProvenanceLibrary/src/testneuroprov -c 2</cmdline>
- <program>/Users/satra/Dropbox/WORK/PROJECTS/INCF/ProvenanceLibrary/src/testneuroprov</program>
- <version>1.0.0</version>
- </activity>
- <entity id="ac_0_e_0">
- <type>ni:input</type>
- <name>arg1</name>
- <value>-c</value>
- </entity>
- <dependencies>
- <used id="ac_0_u_0">
- <activity ref="ac_0_a_0"/>
- <entity ref="ac_0_e_0"/>
- </used>
- <used id="ac_0_u_1">
- <activity ref="ac_0_a_0"/>
- <entity ref="ac_0_e_1"/>
- </used>
- <wasGeneratedBy id="ac_0_wgb_0">
- <entity ref="ac_0_e_3"/>
- <activity ref="ac_0_a_0"/>
- </wasGeneratedBy>
- <wasGeneratedBy id="ac_0_wgb_1">
- <entity ref="ac_0_e_4"/>
- <activity ref="ac_0_a_0"/>
- </wasGeneratedBy>
- </dependencies>
- <entity id="ac_0_e_1">
- <type>ni:input</type>
- <name>arg2</name>
- <value>2</value>
- </entity>
- <entity id="ac_0_e_2">
- <type>ni:environ</type>
- <PATH>/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/opt/local/bin:/usr/local/git/bin</PATH>
- <TMPDIR>/var/folders/1l/ly3rt98n1sd4cdw03l7ncf1r0000gn/T/</TMPDIR>
- <LOGNAME>satra</LOGNAME>
- <COMMAND_MODE>unix2003</COMMAND_MODE>
- <DISPLAY>/tmp/launch-9Dx8oH/org.macosforge.xquartz:0</DISPLAY>
- <Apple_PubSub_Socket_Render>/tmp/launch-PeLnXj/Render</Apple_PubSub_Socket_Render>
- <USER>satra</USER>
- <SHELL>/bin/bash</SHELL>
- <SSH_AUTH_SOCK>/tmp/launch-hjVTaO/Listeners</SSH_AUTH_SOCK>
- <HOME>/Users/satra</HOME>
- </entity>
- <entity id="ac_0_e_3">
- <type>ni:output</type>
- <path>./testneuroprov.c</path>
- <md5sum>1913486fff3eefbdb0aea05778f57ec6</md5sum>
- <name>warped_file</name>
- <type>ni:normalized</type>
- </entity>
- <entity id="ac_0_e_4">
- <type>ni:output</type>
- <name>pearson_correlation_coefficient</name>
- <value>.234</value>
- <type>ni:statistic</type>
- </entity>
- </records>
- </account>
- </records>
-</container>
+<prov:container xmlns:prov="http://openprovenance.org/prov-xml#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ni="https://github.com/INCF/ProvenanceLibrary/wiki/terms" prov:id="NewStuff">
+ <prov:records>
+ <prov:account prov:id="ac_0">
+ <prov:records xmlns:prov="http://openprovenance.org/prov-xml#" xmlns:ni="https://github.com/INCF/ProvenanceLibrary/wiki/terms" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <prov:activity prov:id="ac_0_a_0">
+ <prov:startTime>11/30/11 00:13:20.650432 EST</prov:startTime>
+ <prov:endTime>11/30/11 00:13:20.650550 EST</prov:endTime>
+ <prov:label>brain_extraction</prov:label>
+ <ni:cmdline>/Users/satra/Dropbox/WORK/PROJECTS/INCF/ProvenanceLibrary/src/testneuroprov -c 2</ni:cmdline>
+ <ni:program>/Users/satra/Dropbox/WORK/PROJECTS/INCF/ProvenanceLibrary/src/testneuroprov</ni:program>
+ <ni:version>1.0.0</ni:version>
+ </prov:activity>
+ <prov:entity prov:id="ac_0_e_0">
+ <prov:type xsi:type="xsd:QName">ni:input</prov:type>
+ <ni:name xsi:type="xsd:string">arg1</ni:name>
+ <ni:value xsi:type="xsd:string">-c</ni:value>
+ </prov:entity>
+ <prov:dependencies>
+ <prov:used prov:id="ac_0_u_0">
+ <prov:activity prov:ref="ac_0_a_0"/>
+ <prov:entity prov:ref="ac_0_e_0"/>
+ </prov:used>
+ <prov:used prov:id="ac_0_u_1">
+ <prov:activity prov:ref="ac_0_a_0"/>
+ <prov:entity prov:ref="ac_0_e_1"/>
+ </prov:used>
+ <prov:wasGeneratedBy prov:id="ac_0_wgb_0">
+ <prov:entity prov:ref="ac_0_e_2"/>
+ <prov:activity prov:ref="ac_0_a_0"/>
+ </prov:wasGeneratedBy>
+ <prov:wasGeneratedBy prov:id="ac_0_wgb_1">
+ <prov:entity prov:ref="ac_0_e_3"/>
+ <prov:activity prov:ref="ac_0_a_0"/>
+ </prov:wasGeneratedBy>
+ </prov:dependencies>
+ <prov:entity prov:id="ac_0_e_1">
+ <prov:type xsi:type="xsd:QName">ni:input</prov:type>
+ <ni:name xsi:type="xsd:string">arg2</ni:name>
+ <ni:value xsi:type="xsd:string">2</ni:value>
+ </prov:entity>
+ <prov:entity prov:id="ac_0_e_2">
+ <prov:type xsi:type="xsd:QName">ni:output1</prov:type>
+ <ni:md5sum>c6fc61304cfff1300b9ae4b8cc1911d8</ni:md5sum>
+ <ni:name>warped_file</ni:name>
+ <prov:type xsi:type="xsd:QName">ni:normalized</prov:type>
+ </prov:entity>
+ <prov:entity prov:id="ac_0_e_3">
+ <prov:type xsi:type="xsd:string">ni:output</prov:type>
+ <ni:name xsi:type="xsd:string">pearson_correlation_coefficient</ni:name>
+ <ni:value xsi:type="xsd:string">.234</ni:value>
+ <prov:type xsi:type="xsd:QName">ni:statistic</prov:type>
+ </prov:entity>
+ </prov:records>
+ </prov:account>
+ </prov:records>
+</prov:container>
View
48 src/testprov.c
@@ -35,30 +35,34 @@ main(int argc, char **argv, char** envp)
{
ProvPtr p_prov = newProvenanceFactory("1");
RecordPtr p_record = p_prov->p_record;
- IDREF id, act_id;
+ IDREF id, act_id, used_id, genby_id;
char arg[50];
int i;
+ addNamespace(p_prov, "https://github.com/INCF/ProvenanceLibrary/wiki/terms", "ni");
+
// Add program information
act_id = newActivity(p_record, NULL, "11/30/11 00:13:20.650432 EST", "11/30/11 00:13:20.650550 EST");
- addAttribute(p_record, act_id, "type", "program");
- addAttribute(p_record, act_id, "name", argv[0]);
- addAttribute(p_record, act_id, "version", version);
+ addAttribute(p_record, act_id, "prov", "xsd:string", "type", "program");
+ addAttribute(p_record, act_id, "ni", NULL, "name", argv[0]);
+ addAttribute(p_record, act_id, "ni", NULL, "version", version);
char * cmdline = get_cmdline(argc, argv);
- addAttribute(p_record, act_id, "cmdline", cmdline);
+ addAttribute(p_record, act_id, "ni", NULL, "cmdline", cmdline);
free(cmdline);
//Add all input parameters. if you use getopt this can be refined further
for(i=1;i<argc; i++){
id = newEntity(p_record);
- addAttribute(p_record, id, "type", "input");
+ addAttribute(p_record, id, "prov", "xsd:string", "type", "input");
sprintf(arg, "arg%d", i);
- addAttribute(p_record, id, arg, argv[i]);
- newUsedRecord(p_record, act_id, id, NULL);
+ addAttribute(p_record, id, NULL, NULL, arg, argv[i]);
+ used_id = newUsedRecord(p_record, act_id, id, NULL);
+ freeID(used_id);
+ freeID(id);
}
id = newEntity(p_record);
- addAttribute(p_record, id, "type", "environment");
+ addAttribute(p_record, id, "prov", "xsd:string", "type", "environment");
// add all environment variables
char** env;
for (env = envp; *env != 0; env++)
@@ -70,27 +74,36 @@ main(int argc, char **argv, char** envp)
while (thisEnv[pos++] != '=');
name = strndup(thisEnv, pos-1);
if (name[0] != '_')
- addAttribute(p_record, id, name, &thisEnv[pos]);
+ addAttribute(p_record, id, "ni", "xsd:string", name, &thisEnv[pos]);
free(name);
}
+ freeID(id);
id = newEntity(p_record);
- addAttribute(p_record, id, "type", "runtime");
+ addAttribute(p_record, id, "prov", "xsd:string", "type", "runtime");
// add runtime info such as walltime, cputime, host,
+ freeID(id);
id = newEntity(p_record);
- addAttribute(p_record, id, "type", "output:file");
- addAttribute(p_record, id, "warped_file", "/full/path/to/file");
- newGeneratedByRecord(p_record, id, act_id, NULL);
+ addAttribute(p_record, id, "prov", "xsd:string", "type", "output:file");
+ addAttribute(p_record, id, "ni", NULL, "warped_file", "/full/path/to/file");
+ genby_id = newGeneratedByRecord(p_record, id, act_id, NULL);
+ freeID(id);
+ freeID(genby_id);
id = newEntity(p_record);
- addAttribute(p_record, id, "type", "output:stat");
- addAttribute(p_record, id, "pearson_correlation_coefficient", ".234");
- newGeneratedByRecord(p_record, id, act_id, NULL);
+ addAttribute(p_record, id, "prov", "xsd:string", "type", "output:stat");
+ addAttribute(p_record, id, "ni", NULL, "pearson_correlation_coefficient", ".234");
+ genby_id = newGeneratedByRecord(p_record, id, act_id, NULL);
+ freeID(id);
+ freeID(genby_id);
+ freeID(act_id);
/* Test i/o manipulations */
char *buffer;
int bufsize;
+ //print_provenance(p_prov, NULL);
+ //fprintf(stdout, "==============\n");
print_provenance(p_prov, "testprov.xml");
dumpToMemoryBuffer(p_prov, &buffer, &bufsize);
delProvenanceFactory(p_prov);
@@ -104,6 +117,5 @@ main(int argc, char **argv, char** envp)
print_provenance(p_prov2, "testprov2.xml");
delProvenanceFactory(p_prov);
delProvenanceFactory(p_prov2);
-
return(0);
}
View
132 src/testprov.xml
@@ -1,71 +1,63 @@
<?xml version="1.0" encoding="UTF-8"?>
-<container xmlns:opm="http://openprovenance.org/prov-xml#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:prov="http://openprovenance.org/prov-xml#" xmlns:incf="http://incf.org/incf-schema" id="1">
- <records>
- <activity id="a_0">
- <startTime>11/30/11 00:13:20.650432 EST</startTime>
- <endTime>11/30/11 00:13:20.650550 EST</endTime>
- <type>program</type>
- <name>/Users/satra/Dropbox/WORK/PROJECTS/INCF/ProvenanceLibrary/src/testprov</name>
- <version>1.0.0</version>
- <cmdline>/Users/satra/Dropbox/WORK/PROJECTS/INCF/ProvenanceLibrary/src/testprov -c 2 -m</cmdline>
- </activity>
- <entity id="e_0">
- <type>input</type>
- <arg1>-c</arg1>
- </entity>
- <dependencies>
- <used id="u_0">
- <activity ref="a_0"/>
- <entity ref="e_0"/>
- </used>
- <used id="u_1">
- <activity ref="a_0"/>
- <entity ref="e_1"/>
- </used>
- <used id="u_2">
- <activity ref="a_0"/>
- <entity ref="e_2"/>
- </used>
- <wasGeneratedBy id="wgb_0">
- <entity ref="e_5"/>
- <activity ref="a_0"/>
- </wasGeneratedBy>
- <wasGeneratedBy id="wgb_1">
- <entity ref="e_6"/>
- <activity ref="a_0"/>
- </wasGeneratedBy>
- </dependencies>
- <entity id="e_1">
- <type>input</type>
- <arg2>2</arg2>
- </entity>
- <entity id="e_2">
- <type>input</type>
- <arg3>-m</arg3>
- </entity>
- <entity id="e_3">
- <type>environment</type>
- <PATH>/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/opt/local/bin:/usr/local/git/bin</PATH>
- <TMPDIR>/var/folders/1l/ly3rt98n1sd4cdw03l7ncf1r0000gn/T/</TMPDIR>
- <LOGNAME>satra</LOGNAME>
- <COMMAND_MODE>unix2003</COMMAND_MODE>
- <DISPLAY>/tmp/launch-9Dx8oH/org.macosforge.xquartz:0</DISPLAY>
- <Apple_PubSub_Socket_Render>/tmp/launch-PeLnXj/Render</Apple_PubSub_Socket_Render>
- <USER>satra</USER>
- <SHELL>/bin/bash</SHELL>
- <SSH_AUTH_SOCK>/tmp/launch-hjVTaO/Listeners</SSH_AUTH_SOCK>
- <HOME>/Users/satra</HOME>
- </entity>
- <entity id="e_4">
- <type>runtime</type>
- </entity>
- <entity id="e_5">
- <type>output:file</type>
- <warped_file>/full/path/to/file</warped_file>
- </entity>
- <entity id="e_6">
- <type>output:stat</type>
- <pearson_correlation_coefficient>.234</pearson_correlation_coefficient>
- </entity>
- </records>
-</container>
+<prov:container xmlns:prov="http://openprovenance.org/prov-xml#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ni="https://github.com/INCF/ProvenanceLibrary/wiki/terms" prov:id="1">
+ <prov:records>
+ <prov:activity prov:id="a_0">
+ <prov:startTime>11/30/11 00:13:20.650432 EST</prov:startTime>
+ <prov:endTime>11/30/11 00:13:20.650550 EST</prov:endTime>
+ <prov:type xsi:type="xsd:string">program</prov:type>
+ <ni:name>/Users/satra/Dropbox/WORK/PROJECTS/INCF/ProvenanceLibrary/src/testprov</ni:name>
+ <ni:version>1.0.0</ni:version>
+ <ni:cmdline>/Users/satra/Dropbox/WORK/PROJECTS/INCF/ProvenanceLibrary/src/testprov -c 2</ni:cmdline>
+ </prov:activity>
+ <prov:entity prov:id="e_0">
+ <prov:type xsi:type="xsd:string">input</prov:type>
+ <prov:arg1>-c</prov:arg1>
+ </prov:entity>
+ <prov:dependencies>
+ <prov:used prov:id="u_0">
+ <prov:activity prov:ref="a_0"/>
+ <prov:entity prov:ref="e_0"/>
+ </prov:used>
+ <prov:used prov:id="u_1">
+ <prov:activity prov:ref="a_0"/>
+ <prov:entity prov:ref="e_1"/>
+ </prov:used>
+ <prov:wasGeneratedBy prov:id="wgb_0">
+ <prov:entity prov:ref="e_4"/>
+ <prov:activity prov:ref="a_0"/>
+ </prov:wasGeneratedBy>
+ <prov:wasGeneratedBy prov:id="wgb_1">
+ <prov:entity prov:ref="e_5"/>
+ <prov:activity prov:ref="a_0"/>
+ </prov:wasGeneratedBy>
+ </prov:dependencies>
+ <prov:entity prov:id="e_1">
+ <prov:type xsi:type="xsd:string">input</prov:type>
+ <prov:arg2>2</prov:arg2>
+ </prov:entity>
+ <prov:entity prov:id="e_2">
+ <prov:type xsi:type="xsd:string">environment</prov:type>
+ <ni:PATH xsi:type="xsd:string">/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/opt/local/bin:/usr/local/git/bin</ni:PATH>
+ <ni:TMPDIR xsi:type="xsd:string">/var/folders/1l/ly3rt98n1sd4cdw03l7ncf1r0000gn/T/</ni:TMPDIR>
+ <ni:LOGNAME xsi:type="xsd:string">satra</ni:LOGNAME>
+ <ni:COMMAND_MODE xsi:type="xsd:string">unix2003</ni:COMMAND_MODE>
+ <ni:DISPLAY xsi:type="xsd:string">/tmp/launch-bug33A/org.macosforge.xquartz:0</ni:DISPLAY>
+ <ni:Apple_PubSub_Socket_Render xsi:type="xsd:string">/tmp/launch-XEFcEy/Render</ni:Apple_PubSub_Socket_Render>
+ <ni:USER xsi:type="xsd:string">satra</ni:USER>
+ <ni:SHELL xsi:type="xsd:string">/bin/bash</ni:SHELL>
+ <ni:SSH_AUTH_SOCK xsi:type="xsd:string">/tmp/launch-PkTLDH/Listeners</ni:SSH_AUTH_SOCK>
+ <ni:HOME xsi:type="xsd:string">/Users/satra</ni:HOME>
+ </prov:entity>
+ <prov:entity prov:id="e_3">
+ <prov:type xsi:type="xsd:string">runtime</prov:type>
+ </prov:entity>
+ <prov:entity prov:id="e_4">
+ <prov:type xsi:type="xsd:string">output:file</prov:type>
+ <ni:warped_file>/full/path/to/file</ni:warped_file>
+ </prov:entity>
+ <prov:entity prov:id="e_5">
+ <prov:type xsi:type="xsd:string">output:stat</prov:type>
+ <ni:pearson_correlation_coefficient>.234</ni:pearson_correlation_coefficient>
+ </prov:entity>
+ </prov:records>
+</prov:container>
View
140 src/testprov2.xml
@@ -1,75 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
-<container xmlns:opm="http://openprovenance.org/prov-xml#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:prov="http://openprovenance.org/prov-xml#" xmlns:incf="http://incf.org/incf-schema" id="1">
- <records>
- <account id="ac_0">
- <records>
- <activity id="ac_0_a_0">
- <startTime>11/30/11 00:13:20.650432 EST</startTime>
- <endTime>11/30/11 00:13:20.650550 EST</endTime>
- <type>program</type>
- <name>/Users/satra/Dropbox/WORK/PROJECTS/INCF/ProvenanceLibrary/src/testprov</name>
- <version>1.0.0</version>
- <cmdline>/Users/satra/Dropbox/WORK/PROJECTS/INCF/ProvenanceLibrary/src/testprov -c 2 -m</cmdline>
- </activity>
- <entity id="ac_0_e_0">
- <type>input</type>
- <arg1>-c</arg1>
- </entity>
- <dependencies>
- <used id="ac_0_u_0">
- <activity ref="ac_0_a_0"/>
- <entity ref="ac_0_e_0"/>
- </used>
- <used id="ac_0_u_1">
- <activity ref="ac_0_a_0"/>
- <entity ref="ac_0_e_1"/>
- </used>
- <used id="ac_0_u_2">
- <activity ref="ac_0_a_0"/>
- <entity ref="ac_0_e_2"/>
- </used>
- <wasGeneratedBy id="ac_0_wgb_0">
- <entity ref="ac_0_e_5"/>
- <activity ref="ac_0_a_0"/>
- </wasGeneratedBy>
- <wasGeneratedBy id="ac_0_wgb_1">
- <entity ref="ac_0_e_6"/>
- <activity ref="ac_0_a_0"/>
- </wasGeneratedBy>
- </dependencies>
- <entity id="ac_0_e_1">
- <type>input</type>
- <arg2>2</arg2>
- </entity>
- <entity id="ac_0_e_2">
- <type>input</type>
- <arg3>-m</arg3>
- </entity>
- <entity id="ac_0_e_3">
- <type>environment</type>
- <PATH>/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/opt/local/bin:/usr/local/git/bin</PATH>
- <TMPDIR>/var/folders/1l/ly3rt98n1sd4cdw03l7ncf1r0000gn/T/</TMPDIR>
- <LOGNAME>satra</LOGNAME>
- <COMMAND_MODE>unix2003</COMMAND_MODE>
- <DISPLAY>/tmp/launch-9Dx8oH/org.macosforge.xquartz:0</DISPLAY>
- <Apple_PubSub_Socket_Render>/tmp/launch-PeLnXj/Render</Apple_PubSub_Socket_Render>
- <USER>satra</USER>
- <SHELL>/bin/bash</SHELL>
- <SSH_AUTH_SOCK>/tmp/launch-hjVTaO/Listeners</SSH_AUTH_SOCK>
- <HOME>/Users/satra</HOME>
- </entity>
- <entity id="ac_0_e_4">
- <type>runtime</type>
- </entity>
- <entity id="ac_0_e_5">
- <type>output:file</type>
- <warped_file>/full/path/to/file</warped_file>
- </entity>
- <entity id="ac_0_e_6">
- <type>output:stat</type>
- <pearson_correlation_coefficient>.234</pearson_correlation_coefficient>
- </entity>
- </records>
- </account>
- </records>
-</container>
+<prov:container xmlns:prov="http://openprovenance.org/prov-xml#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" prov:id="1">
+ <prov:records>
+ <prov:account prov:id="ac_0">
+ <prov:records xmlns:prov="http://openprovenance.org/prov-xml#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ni="https://github.com/INCF/ProvenanceLibrary/wiki/terms">
+ <prov:activity prov:id="ac_0_a_0">
+ <prov:startTime>11/30/11 00:13:20.650432 EST</prov:startTime>
+ <prov:endTime>11/30/11 00:13:20.650550 EST</prov:endTime>
+ <prov:type xsi:type="xsd:string">program</prov:type>
+ <ni:name>/Users/satra/Dropbox/WORK/PROJECTS/INCF/ProvenanceLibrary/src/testprov</ni:name>
+ <ni:version>1.0.0</ni:version>
+ <ni:cmdline>/Users/satra/Dropbox/WORK/PROJECTS/INCF/ProvenanceLibrary/src/testprov -c 2</ni:cmdline>
+ </prov:activity>
+ <prov:entity prov:id="ac_0_e_0">
+ <prov:type xsi:type="xsd:string">input</prov:type>
+ <prov:arg1>-c</prov:arg1>
+ </prov:entity>
+ <prov:dependencies>
+ <prov:used prov:id="ac_0_u_0">
+ <prov:activity prov:ref="ac_0_a_0"/>
+ <prov:entity prov:ref="ac_0_e_0"/>
+ </prov:used>
+ <prov:used prov:id="ac_0_u_1">
+ <prov:activity prov:ref="ac_0_a_0"/>
+ <prov:entity prov:ref="ac_0_e_1"/>
+ </prov:used>
+ <prov:wasGeneratedBy prov:id="ac_0_wgb_0">
+ <prov:entity prov:ref="ac_0_e_4"/>
+ <prov:activity prov:ref="ac_0_a_0"/>
+ </prov:wasGeneratedBy>
+ <prov:wasGeneratedBy prov:id="ac_0_wgb_1">
+ <prov:entity prov:ref="ac_0_e_5"/>
+ <prov:activity prov:ref="ac_0_a_0"/>
+ </prov:wasGeneratedBy>
+ </prov:dependencies>
+ <prov:entity prov:id="ac_0_e_1">
+ <prov:type xsi:type="xsd:string">input</prov:type>
+ <prov:arg2>2</prov:arg2>
+ </prov:entity>
+ <prov:entity prov:id="ac_0_e_2">
+ <prov:type xsi:type="xsd:string">environment</prov:type>
+ <ni:PATH xsi:type="xsd:string">/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/opt/local/bin:/usr/local/git/bin</ni:PATH>
+ <ni:TMPDIR xsi:type="xsd:string">/var/folders/1l/ly3rt98n1sd4cdw03l7ncf1r0000gn/T/</ni:TMPDIR>
+ <ni:LOGNAME xsi:type="xsd:string">satra</ni:LOGNAME>
+ <ni:COMMAND_MODE xsi:type="xsd:string">unix2003</ni:COMMAND_MODE>
+ <ni:DISPLAY xsi:type="xsd:string">/tmp/launch-bug33A/org.macosforge.xquartz:0</ni:DISPLAY>
+ <ni:Apple_PubSub_Socket_Render xsi:type="xsd:string">/tmp/launch-XEFcEy/Render</ni:Apple_PubSub_Socket_Render>
+ <ni:USER xsi:type="xsd:string">satra</ni:USER>
+ <ni:SHELL xsi:type="xsd:string">/bin/bash</ni:SHELL>
+ <ni:SSH_AUTH_SOCK xsi:type="xsd:string">/tmp/launch-PkTLDH/Listeners</ni:SSH_AUTH_SOCK>
+ <ni:HOME xsi:type="xsd:string">/Users/satra</ni:HOME>
+ </prov:entity>
+ <prov:entity prov:id="ac_0_e_3">
+ <prov:type xsi:type="xsd:string">runtime</prov:type>
+ </prov:entity>
+ <prov:entity prov:id="ac_0_e_4">
+ <prov:type xsi:type="xsd:string">output:file</prov:type>
+ <ni:warped_file>/full/path/to/file</ni:warped_file>
+ </prov:entity>
+ <prov:entity prov:id="ac_0_e_5">
+ <prov:type xsi:type="xsd:string">output:stat</prov:type>
+ <ni:pearson_correlation_coefficient>.234</ni:pearson_correlation_coefficient>
+ </prov:entity>
+ </prov:records>
+ </prov:account>
+ </prov:records>
+</prov:container>

No commit comments for this range

Something went wrong with that request. Please try again.