...
Code Block |
---|
asset.get :id ASSET-ID asset.get :id "path=FULL-PATH-TO-FILE" |
Metadata
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.
Code Block |
---|
asset.doc.type.describe :type asset |
Code Block |
---|
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
Code Block |
---|
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.
Expand | ||
---|---|---|
| ||
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
Exercise - adding metadata - import and/or asset.set?
Exercise - doing things with queries (ie pipes) - eg move all .jpg's to a folder