Project

General

Profile

1
.. raw:: latex
2

    
3
  \newpage
4
  
5

    
6
ORE Model for Derived Data Packages
7
===================================
8

    
9
.. index:: Derived Resources
10
.. index:: PROV
11

    
12
Author
13
  Lauren Walker
14

    
15
Date
16
  - 20140513 Initial draft of RDF model expansion for derived data packages
17

    
18
Goal
19
  Accurately describe the relationships of resources that are derived from other resources.
20

    
21
Summary 
22
  This proposed expansion of the Metacat RDF schema uses the `PROV ontology <http://www.w3.org/TR/prov-overview/>`_ to describe
23
  the relationships between generated or derived resources and the resources used to generate them.
24
  Other provenance, such as agent, can be added to the Metacat RDFs to store information about how a resource
25
  was produced.
26
  
27
Overview
28
---------------------------------------
29
There are two main concepts that are being introduced to Metacat - derived data resources and the activities that create them.
30

    
31
A derived resource is defined as a entity, usually a data file, that is produced by transforming one entity into another or is the production of an activity that generates a new entity from an existing one. 
32
In Metacat, derived data could be a data table that was composed from analyzing one or more existing data tables. 
33
It could also be a visualization of another resource, such as a graph, chart, or map.
34

    
35
Because derived data is the product of a transformation activity, Metacat's ORE model will need to have the capability to store information on these activities. 
36
These activities could be a script (e.g. an R script) that is used to create a visualization from a data table or to compose a new data table from one or more existing data tables. 
37

    
38
These new resources will be documented by metadata, most likely EML.
39

    
40

    
41
Ontology and Model
42
------------------
43
The `PROV ontology <http://www.w3.org/TR/prov-overview/>`_ will be used to describe the following relationships:
44
  * Derived resources and the original resources used to create them 
45
  * Derived resources and the activities used to create them
46

    
47
.. figure:: images/PROV-simple-diagram.png
48

    
49
   Figure 1. A simple diagram illustrating the PROV ontology Metacat will use
50
   
51
This model will allow the original data file to remain unchanged as all assertions made about the derived data can be 
52
described in the derived data RDF.
53

    
54

    
55
The terms from the PROV ontology that will be introduced to Metacat to describe these relationships:
56
   * `wasGeneratedBy <http://www.w3.org/ns/prov#wasGeneratedBy>`_ : Generation is the completion of production of a new entity by an activity. This entity did not exist before generation and becomes available for usage after this generation.
57
   * `generated <http://www.w3.org/ns/prov#generated>`_ : Generation is the completion of production of a new entity by an activity. This entity did not exist before generation and becomes available for usage after this generation.
58
   * `wasDerivedFrom <http://www.w3.org/ns/prov#wasDerivedFrom>`_ : A derivation is a transformation of an entity into another, an update of an entity resulting in a new one, or the construction of a new entity based on a pre-existing entity.
59
   * `used <http://www.w3.org/ns/prov#used>`_ : Usage is the beginning of utilizing an entity by an activity. Before usage, the activity had not begun to utilize this entity and could not have been affected by the entity.
60
   * `wasInformedBy <http://www.w3.org/ns/prov#wasInformedBy>`_ : Communication is the exchange of an entity by two activities, one activity using the entity generated by the other.
61
   
62
The following diagram fully represents the new model for derived resources. New terms and resources are highlighted in purple.
63

    
64
.. figure:: images/Derived-data-packages-model.png
65

    
66
   Figure 2. The model for derived data sets with new terms highlighted in purple.
67

    
68

    
69
Examples
70
---------
71
Derived data using scripts
72
__________________________
73
John Smith is a scientist who has uploaded two data tables and an EML file to a Metacat repository. His package of data is represented below.
74

    
75
.. figure:: images/derived-data-smith-package.png
76

    
77
	Figure 3. Smith's original data package using the ORE model Metacat has now
78
	
79
Jessica Couture is an analyst who wants to create a graph of John's Smith data. She creates an R script that grabs the data files smith_data.1.1 and smith_data.2.1,
80
performs some sort of analysis on them and transforms them into a single data file, couture_data.1.1. She then creates another R script to visualize this composed data
81
into a chart. She describes her process and the data in an EML file and uploads all five files to Metacat. Below is the model that describes Couture's new data package:
82

    
83
.. figure:: images/Derived-data-example.png
84

    
85
	Figure 4. Couture's derived data package with the existing Metacat ORE notation in blue and the new PROV notation in purple.
86

    
87
Derived data without scripts
88
____________________________
89
Not all derived data will be produced from a script that can be stored in Metacat. An analyst may create a composed data table through a more
90
manual process, such as transforming values in a spreadsheet program like MS Excel. Or a scientist may create a simple graph of their data with
91
MS Excel or an online graphing tool.
92

    
93
Let's say John Smith decides to create a time series chart using the data from one of his data files, smith_data.1.1. He adds this image file to
94
the original data package and edits the metadata to explain his process and the chart. His data package will essentially be using the PROV model without the activity concept.
95
Smith has the option of creating a new data package with the image and an EML file so that his metadata ID does not have to change. 
96

    
97
.. figure:: images/PROV-simple-diagram-without-activity.png
98

    
99
   Figure 4. The PROV model without an activity
100

    
101
.. figure:: images/derived-data-smith-package-with-img.png
102

    
103
   Figure 5. Smith's new data package with a data visualization. Note that the resource map and metadata have new revisions. 
104
 
105
Sample RDF
106
----------
107
A sample RDF notation for our above Couture and Smith example (Figure 4) can be :download:`downloaded <_static/resourceMap_couture.1.1.rdf>` or see below:
108

    
109
::
110

    
111
	<rdf:RDF
112
	    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
113
	    xmlns:foaf="http://xmlns.com/foaf/0.1/"
114
	    xmlns:owl="http://www.w3.org/2002/07/owl#"
115
	    xmlns:dc="http://purl.org/dc/elements/1.1/"
116
	    xmlns:ore="http://www.openarchives.org/ore/terms/"
117
	    xmlns:dcterms="http://purl.org/dc/terms/"
118
	    xmlns:j.0="http://purl.org/spar/cito/"
119
	    xmlns:prov="http://www.w3.org/ns/prov#">
120
	    
121
	  <rdf:Description rdf:about="https://cn.dataone.org/cn/v1/resolve/couture_data.1.1">
122
	    <ore:isAggregatedBy>https://cn.dataone.org/cn/v1/resolve/resourceMap_couture.1.1#aggregation</ore:isAggregatedBy>
123
	    <dcterms:identifier rdf:datatype="http://www.w3.org/2001/XMLSchema#string">couture_data.1.1</dcterms:identifier>
124
	    <j.0:isDocumentedBy rdf:resource="https://cn.dataone.org/cn/v1/resolve/resourceMap_couture.1.1"/>
125
	    <prov:wasGeneratedBy rdf:resource="https://cn.dataone.org/cn/v1/resolve/couture_composeScript.1.1"/>
126
	    <prov:wasDerivedFrom rdf:resource="https://cn.dataone.org/cn/v1/resolve/smith_data.1.1"/>
127
	    <prov:wasDerivedFrom rdf:resource="https://cn.dataone.org/cn/v1/resolve/smith_data.2.1"/>
128
	  </rdf:Description>
129
	    
130
	  <rdf:Description rdf:about="https://cn.dataone.org/cn/v1/resolve/resourceMap_couture.1.1#aggregation">
131
	    <rdf:type rdf:resource="http://www.openarchives.org/ore/terms/Aggregation"/>
132
	    <ore:isDescribedBy rdf:resource="https://cn.dataone.org/cn/v1/resolve/resourceMap_couture.1.1"/>
133
	    <dc:title>DataONE Aggregation</dc:title>
134
	    <ore:aggregates rdf:resource="https://cn.dataone.org/cn/v1/resolve/couture_data.1.1"/>
135
	    <ore:aggregates rdf:resource="https://cn.dataone.org/cn/v1/resolve/couture_metadata.1.1"/>
136
	    <ore:aggregates rdf:resource="https://cn.dataone.org/cn/v1/resolve/couture_img.1.1"/>
137
	    <ore:aggregates rdf:resource="https://cn.dataone.org/cn/v1/resolve/couture_script.1.1"/>
138
	    <ore:aggregates rdf:resource="https://cn.dataone.org/cn/v1/resolve/couture_composeScript.1.1"/>
139
	  </rdf:Description>
140
	    
141
	  <rdf:Description rdf:nodeID="A0">
142
	    <foaf:name rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Java libclient</foaf:name>
143
	    <rdf:type rdf:resource="http://purl.org/dc/terms/Agent"/>
144
	  </rdf:Description>
145
	    
146
	  <rdf:Description rdf:about="https://cn.dataone.org/cn/v1/resolve/resourceMap_couture.1.1">
147
	    <dcterms:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2013-09-03T09:54:06.392-07:00</dcterms:modified>
148
	    <ore:describes rdf:resource="https://cn.dataone.org/cn/v1/resolve/resourceMap_couture.1.1#aggregation"/>
149
	    <rdf:type rdf:resource="http://www.openarchives.org/ore/terms/ResourceMap"/>
150
	    <dc:creator rdf:nodeID="A0"/>
151
	    <dcterms:identifier rdf:datatype="http://www.w3.org/2001/XMLSchema#string">resourceMap_couture.1.1</dcterms:identifier>
152
	  </rdf:Description>
153
	    
154
	  <rdf:Description rdf:about="https://cn.dataone.org/cn/v1/resolve/couture_metadata.1.1">
155
	    <ore:isAggregatedBy>https://cn.dataone.org/cn/v1/resolve/resourceMap_couture.1.1#aggregation</ore:isAggregatedBy>
156
	    <dcterms:identifier rdf:datatype="http://www.w3.org/2001/XMLSchema#string">couture_metadata.1.1</dcterms:identifier>
157
	    <j.0:documents rdf:resource="https://cn.dataone.org/cn/v1/resolve/couture_data.1.1"/>
158
	    <j.0:documents rdf:resource="https://cn.dataone.org/cn/v1/resolve/couture_img.1.1"/>
159
	    <j.0:documents rdf:resource="https://cn.dataone.org/cn/v1/resolve/couture_script.1.1"/>
160
	    <j.0:documents rdf:resource="https://cn.dataone.org/cn/v1/resolve/couture_composeScript.1.1"/>
161
	  </rdf:Description>
162
	    
163
	  <rdf:Description rdf:about="https://cn.dataone.org/cn/v1/resolve/couture_img.1.1">
164
	    <ore:isAggregatedBy>https://cn.dataone.org/cn/v1/resolve/resourceMap_couture.1.1#aggregation</ore:isAggregatedBy>
165
	    <dcterms:identifier rdf:datatype="http://www.w3.org/2001/XMLSchema#string">couture_img.1.1</dcterms:identifier>
166
	    <j.0:isDocumentedBy rdf:resource="https://cn.dataone.org/cn/v1/resolve/couture_metadata.1.1"/>
167
	    <prov:wasDerivedFrom rdf:resource="https://cn.dataone.org/cn/v1/resolve/couture_data.1.1"/>
168
	    <prov:wasGeneratedBy rdf:resource="https://cn.dataone.org/cn/v1/resolve/couture_script.1.1"/>
169
	  </rdf:Description>
170
	    
171
	  <rdf:Description rdf:about="https://cn.dataone.org/cn/v1/resolve/couture_script.1.1">
172
	    <ore:isAggregatedBy>https://cn.dataone.org/cn/v1/resolve/resourceMap_couture.1.1#aggregation</ore:isAggregatedBy>
173
	    <dcterms:identifier rdf:datatype="http://www.w3.org/2001/XMLSchema#string">couture_script.1.1</dcterms:identifier>
174
	    <j.0:isDocumentedBy rdf:resource="https://cn.dataone.org/cn/v1/resolve/couture_metadata.1.1"/>
175
	    <prov:used rdf:resource="https://cn.dataone.org/cn/v1/resolve/couture_data.1.1"/>
176
	    <prov:generated rdf:resource="https://cn.dataone.org/cn/v1/resolve/couture_img.1.1"/>
177
	    <prov:wasInformedby rdf:resource="https://cn.dataone.org/cn/v1/resolve/couture_composeScript.1.1" />
178
	  </rdf:Description>
179
	    
180
	  <rdf:Description rdf:about="https://cn.dataone.org/cn/v1/resolve/couture_composeScript.1.1">
181
	    <ore:isAggregatedBy>https://cn.dataone.org/cn/v1/resolve/resourceMap_couture.1.1#aggregation</ore:isAggregatedBy>
182
	    <dcterms:identifier rdf:datatype="http://www.w3.org/2001/XMLSchema#string">couture_composeScript.1.1</dcterms:identifier>
183
	    <j.0:isDocumentedBy rdf:resource="https://cn.dataone.org/cn/v1/resolve/couture_metadata.1.1"/>
184
	    <prov:used rdf:resource="https://cn.dataone.org/cn/v1/resolve/smith_data.1.1"/>
185
	    <prov:used rdf:resource="https://cn.dataone.org/cn/v1/resolve/smith_data.2.1"/>
186
	    <prov:generated rdf:resource="https://cn.dataone.org/cn/v1/resolve/couture_data.1.1"/>
187
	  </rdf:Description>
188
	    
189
	</rdf:RDF>
190

    
191
::
192

    
193
Indexing
194
--------
195
The Metacat Index will index some of these relationships mainly to inform MetacatUI.
196

    
197
New Index Fields
198
	* ``wasGeneratedBy``
199
	* ``generated``
200
	* ``used``
201
	* ``wasDerivedFrom``
202
	* ``wasInformedBy``
203
	* ``hadDerivation``
204

    
205
All of these fields are taken directly from the PROV ontology, except for ``hadDerivation``. Because MetacatUI navigation is metadata-centric 
206
(i.e. metadata are retrieved and listed as search results and details on datasets are viewed via the metadata view [/#view]), it is helpful to 
207
use SparQL to infer relationships between metadata so that it isn't necessary to send multiple queries to the index to retrieve information about 
208
derived datasets.
209

    
210
SparQL will infer that the derived metadata wasDerivedFrom the primary source metadata and the Metacat index will index both this relationship and it's inverse, 
211
hadDerivation, for easier querying.	The SparQL query used to determine the derived metadata for a primary metadata would look like:
212

    
213
::
214

    
215
	SELECT ?derived_metadata
216
	WHERE {
217
		?primary_data ore:isDocumentedBy  ?primary_metadata;
218
		              prov:wasDerivedFrom ?derived_data.
219
					  
220
		?derived_data ore:isDocumentedBy ?derived_metadata.
221
	}
222
	
223
::
224

    
225
More information about inverses in PROV-O and in particular, ``hadDerivation``, see `section B of the PROV documentation <http://www.w3.org/TR/prov-o/#inverse-names>`_.
226
	
227
Example
228
_______
229

    
230
Using the above Couture and Smith example (Figure 4), the following fields and values from the PROV relationships would be indexed.
231

    
232
+---------------------------+----------------+---------------------+--------------------------------+
233
| Object                    |  Field Name    | Field Type          |             Value              |
234
+===========================+================+=====================+================================+
235
| couture_metadata.1.1      | wasDerivedFrom | string, multivalued | smith_metadata.1.1             |
236
+---------------------------+----------------+---------------------+--------------------------------+
237
| smith_metadata.1.1        | hadDerivation  | string, multivalued | couture_metadata.1.1           |
238
+---------------------------+----------------+---------------------+--------------------------------+
239
| couture_img.1.1           | wasGeneratedby | string, multivalued | couture_script.1.1             |
240
+---------------------------+----------------+---------------------+--------------------------------+
241
| couture_img.1.1           | wasDerivedFrom | string, multivalued | couture_data.1.1               |
242
+---------------------------+----------------+---------------------+--------------------------------+
243
| couture_script.1.1        | used           | string, multivalued | couture_data.1.1               |
244
+---------------------------+----------------+---------------------+--------------------------------+
245
| couture_script.1.1        | wasInformedBy  | string, multivalued | couture_composeScript.1.1      |
246
+---------------------------+----------------+---------------------+--------------------------------+
247
| couture_script.1.1        | generated      | string, multivalued | couture_img.1.1                |
248
+---------------------------+----------------+---------------------+--------------------------------+
249
| couture_data.1.1          | wasGeneratedBy | string, multivalued | couture_composeScript.1.1      |
250
+---------------------------+----------------+---------------------+--------------------------------+
251
| couture_data.1.1          | wasDerivedFrom | string, multivalued | smith_data.1.1, smith_data.2.1 |
252
+---------------------------+----------------+---------------------+--------------------------------+
253
| couture_composeScript.1.1 | used           | string, multivalued | smith_data.1.1, smith_data.2.1 |
254
+---------------------------+----------------+---------------------+--------------------------------+
255
| couture_composeScript.1.1 | generated      | string, multivalued | couture_data.1.1               |
256
+---------------------------+----------------+---------------------+--------------------------------+
257

    
258
Queries
259
_______
260
These indexed fields will be used primarily by MetacatUI to determine relationships between resources. An example use case is the MetacatUI metadata view (/#view/{pid}).
261
When a user navigates to the metadata view for a primary resource, such as smith_metadata.1.1 from the above example, MetacatUI can send a query to the index to look for
262
derived resources that the user might be interested in. Some pseduocode to describe this logic:
263

    
264
::
265

    
266
	if(this_metadata.hadDerivation){
267
		hadDerivation = this_metadata.hadDerivation;
268
		sendQuery("q=isDocumentedBy:" + hadDerivation + "+-obsoletedBy:*&fl=id");
269
	}
270

    
271

    
272

    
273
This query would retrieve the IDs of objects which are documented by metadata that is derived from the metadata currently being viewed. In the above Amith and Couture example (Figure 4), the following IDs
274
would be returned from this query:
275

    
276
* ``couture_composeScript.1.1``
277
* ``couture_script.1.1``
278
* ``couture_data.1.1``
279
* ``couture_img.1.1``
280

    
281

    
282
	
283
  
284

    
(18-18/25)