Skip to end of metadata
Go to start of metadata

You are viewing an old version of this content. View the current version.

Compare with Current View Version History

« Previous Version 30 Next »

Mediaflux concepts

Mediaflux (ref) is the underlying storage platform that pshell communicates with.
Instead of files and folders (pshell) you have:
  • assets - the file content and associated metadata
  • namespaces - remote folder structure on the mediaflux server

Mediaflux metadata is:
  • XML-based 
  • has it's own query language 

The main commands, operating on assets and asset metadata, are:
  • asset.get - display metadata for an asset
  • asset.set - alter metadata for an asset
  • asset.query - find assets based on metadata queries

Mediaflux commands

These can be run in pshell or the vendor's own client (aterm.jar)

Retrieving metadata

The general command is:

asset.get :id ASSET-ID
asset.get :id "path=FULL-PATH-TO-FILE"


If we wanted to extract a specific piece of information, such as the checksum, we use the optional xpath argument:

pawsey:/projects/Data Team/testfiles>asset.get :id 69776098 :xpath content/csum
value = 384461DE


Populating metadata

The general command is:


asset.set :id ASSET-ID <ELEMENT AND VALUE>


For example, this is equivalent to a rename:


asset.set :id 69776160 :name "new filename"
version = 2    { changed-or-created=true stime=74452766 }

Note: a new version of the asset is created - reflecting the fact that the name has been altered.


A more complex example, where we assign a geospatial location (in this case a point) to an asset:

asset.set :id 69776160 :geoshape < :point < :latitude -31.95 :longitude 115.86 :elevation 10.0 > >
version = 3    { changed-or-created=true stime=74452768 }

This last case is an example of specifying an XML document that details the xpath + value for metadata items.

It is equivalent to an XML metadata document that looks like this:

<geoshape>
	<point>
		<latitude> -31.95 </latitude>
		<longitude> 115.86 </longitude>
		<elevation> 10.0 </elevation>
	</point>
</geoshape>


Slight digression - metadata templates

The doc type shows the metadata that can be queried and specified.

Custom doc types can be made.

Asset is a special "first-order" type attached to everything.

Custom doc types get added under the <meta> element.

asset.doc.type.describe :type asset


Querying the metadata

The simple form of an asset query is:

asset.query :where "LOGICAL-EXPRESSION"


asset.query :where "namespace='/projects/Demo'"
asset.query :where "namespace>='/projects/Demo' and name='*.jpg'"
asset.query :where "namespace>='/projects/Data Team/sean' and (name='*.JPG' or name='*.PNG')"


Simple actions on the results

asset.query :where "namespace>='/projects/Data Team/sean' and name='*.jpg'" :action get-value :xpath -ename name name




Exercises

Exercise 1 - upload a file and then inspect the metadata in the system.

 Solution to exercise 1

put IMG_0222.PNG

asset.get :id "path=/projects/Data Team/sean/IMG_0222.PNG"


asset = None    { version=4 id=1377760 vid=74319092 }

    type = image/png

    namespace = /projects/Data Team/sean

    path = /projects/Data Team/sean/IMG_0222.PNG

    name = IMG_0222.PNG

    meta = None    { stime=74319092 }

etc


Exercise - querying metadata - geospatial search? TODO - import some geoshape attached 





Exercise - adding metadata - import and/or asset.set?
Exercise - doing things with queries (ie pipes) - eg move all .jpg's to a folder
  • No labels