Command Line Client/Manage Metadata

There are various dx commands available for modifying the metadata of data objects and projects on the platform and for searching them by metadata values.

General Metadata

The following metadata (tags, names, and properties) can be applied to both data objects and projects.

Name

You can set the name of an object or project with dx rename, or use dx mv to rename an object or a folder.

$ dx rename myrecord myrecord2
$ dx ls
myrecord2
$ dx mv myrecord2 myrecord
$ dx ls
myrecord

Tags

You can add and remove tags to and from an object or project using dx tag and dx untag. The following example adds and removes tags from a record and from the current project.

$ dx tag myrecord tag1 tag2
$ dx describe myrecord | grep Tags
Tags           tag1, tag2
$ dx untag myrecord tag1 tag2 tag3
$ dx describe myrecord | grep Tags
Tags           -
$ dx tag : project_tag
$ dx describe : | grep Tags
Tags            project_tag

Properties

You can set and unset properties using dx set_properties and dx unset_properties. The following sets a couple properties and removes one of them.

$ dx set_properties myrecord foo=bar baz=quux
$ dx describe myrecord | grep Properties
Properties      foo=bar, baz=quux
$ dx unset_properties myrecord foo
$ dx describe myrecord | grep Properties
Properties      baz=quux

$ dx set_properties : sampleID=12345
$ dx describe : --verbose | grep Properties
Properties      foo=bar, baz=quux

Data Object Metadata

For detailed information about the lifecycle of data objects and their metadata, see the sections in the API specification on Data Object Lifecycle and Data Object Metadata. Recall, however, that certain types of metadata (types, visibility, and details) are frozen to any further modifications once the object is closed. The other types of metadata (name, tags, and properties) can be modified at any time and are modified independently of other cloned copies of the same object existing in other projects.

Details

You can set the details of a data object using dx set_details. The following sets the JSON details of a record and then retrieves it again in pretty-printed format.

$ dx set_details myrecord '{"hello": ["world", 2, 3, true, {"foo": null}] }'
$ dx get_details myrecord
{
    "hello": [
        "world", 
        2, 
        3, 
        true, 
        {
            "foo": null
        }
    ]
}

Visibility

You can hide or unhide an object using dx set_visibility. The following example hides a record and makes it visible again.

$ dx set_visibility myrecord hidden $ dx ls $ dx ls -a ./ ../ myrecord $ dx set_visibility myrecord visible $ dx ls myrecord

Types

You can add and remove types to and from an object using dx add_types and dx remove_types. The following example adds two types and then removes one of them.

$ dx add_types myrecord foo bar
$ dx describe myrecord | grep Types
Types           foo, bar
$ dx remove_types myrecord foo
$ dx describe myrecord | grep Types
Types           bar

Closing

The command dx close closes the specified object. With the ‑‑wait, it will block until the object has finished closing.

$ dx close recordname

Last edited by Bill Agee (bagee), 2015-08-04 20:07:05

 Feedback