Skip to content

Instantly share code, notes, and snippets.

@mrhanlon
Last active July 25, 2016 21:50
Show Gist options
  • Save mrhanlon/a35e96636800bd73f3b22a5c2042e2c2 to your computer and use it in GitHub Desktop.
Save mrhanlon/a35e96636800bd73f3b22a5c2042e2c2 to your computer and use it in GitHub Desktop.
Testing linking metadata together via embedded relationships instead of associationIds.

You can query against relationships using mongodb's $elemMatch syntax. E.g.,

$ metadata-list -v -Q '{"value._relationships": {"$elemMatch": {"@id": "1539251546393416166-242ac11f-0001-012"}}}'
{
"uuid": "1539251546393416166-242ac11f-0001-012",
"owner": "mrhanlon",
"schemaId": null,
"internalUsername": null,
"associationIds": [],
"lastUpdated": "2016-07-15T14:12:33.381-05:00",
"name": "mrhtest.project",
"value": {
"@dc:name": "Test Project",
"@dc:creator": "mrhanlon",
"@ids:type": "genomic",
"_relationships": [
{
"@rel:type": "HasPart",
"@id": "162136459787244006-242ac11f-0001-012"
},
{
"@rel:type": "HasPart",
"@id": "1127773956946924006-242ac11f-0001-012"
},
{
"@rel:type": "HasPart",
"@id": "5925409722952707610-242ac11f-0001-012"
},
{
"@rel:type": "HasPart",
"@id": "5223740915805187610-242ac11f-0001-012"
},
{
"@rel:type": "HasPart",
"@id": "2696410360146947610-242ac11f-0001-012"
},
{
"@rel:type": "HasPart",
"@id": "2135015184886787610-242ac11f-0001-012"
}
]
},
"created": "2016-07-15T14:12:33.381-05:00",
"_links": {
"self": {
"href": "https://agave.iplantc.org/meta/v2/data/1539251546393416166-242ac11f-0001-012"
},
"permissions": {
"href": "https://agave.iplantc.org/meta/v2/data/1539251546393416166-242ac11f-0001-012/pems"
},
"owner": {
"href": "https://agave.iplantc.org/profiles/v2/mrhanlon"
},
"associationIds": []
}
}
{
"uuid": "5925409722952707610-242ac11f-0001-012",
"owner": "mrhanlon",
"schemaId": null,
"internalUsername": null,
"associationIds": [],
"lastUpdated": "2016-07-15T14:31:08.083-05:00",
"name": "mrhtest.process",
"value": {
"@dc:name": "Sequence Specimen 1, run 1",
"@dc:creator": "mrhanlon",
"_relationships": [
{
"@rel:type": "IsPartOf",
"@id": "1539251546393416166-242ac11f-0001-012"
},
{
"@rel:type": "IsDerivedFrom",
"@id": "162136459787244006-242ac11f-0001-012"
}
]
},
"created": "2016-07-15T14:31:08.083-05:00",
"_links": {
"self": {
"href": "https://agave.iplantc.org/meta/v2/data/5925409722952707610-242ac11f-0001-012"
}
}
}
{
"uuid": "5223740915805187610-242ac11f-0001-012",
"owner": "mrhanlon",
"schemaId": null,
"internalUsername": null,
"associationIds": [],
"lastUpdated": "2016-07-15T14:31:24.421-05:00",
"name": "mrhtest.process",
"value": {
"@dc:name": "Sequence Specimen 1, run 2",
"@dc:creator": "mrhanlon",
"_relationships": [
{
"@rel:type": "IsPartOf",
"@id": "1539251546393416166-242ac11f-0001-012"
},
{
"@rel:type": "IsDerivedFrom",
"@id": "162136459787244006-242ac11f-0001-012"
}
]
},
"created": "2016-07-15T14:31:24.421-05:00",
"_links": {
"self": {
"href": "https://agave.iplantc.org/meta/v2/data/5223740915805187610-242ac11f-0001-012"
}
}
}
{
"uuid": "162136459787244006-242ac11f-0001-012",
"owner": "mrhanlon",
"schemaId": null,
"internalUsername": null,
"associationIds": [],
"lastUpdated": "2016-07-15T14:26:20.324-05:00",
"name": "mrhtest.specimen",
"value": {
"@dc:name": "ASDF1234.2",
"@dc:url": "http://example.com/specimen/ASDF1234.2",
"_relationships": [
{
"@rel:type": "IsPartOf",
"@id": "1539251546393416166-242ac11f-0001-012"
},
{
"#rel:type": "HasDerivation",
"@id": "5925409722952707610-242ac11f-0001-012"
},
{
"#rel:type": "HasDerivation",
"@id": "5223740915805187610-242ac11f-0001-012"
}
]
},
"created": "2016-07-15T14:26:20.324-05:00",
"_links": {
"self": {
"href": "https://agave.iplantc.org/meta/v2/data/162136459787244006-242ac11f-0001-012"
}
}
}
{
"uuid": "1127773956946924006-242ac11f-0001-012",
"owner": "mrhanlon",
"schemaId": null,
"internalUsername": null,
"associationIds": [],
"lastUpdated": "2016-07-15T14:26:42.807-05:00",
"name": "mrhtest.specimen",
"value": {
"@dc:name": "ASDF1234.1",
"@dc:url": "http://example.com/specimen/ASDF1234.1",
"_relationships": [
{
"@rel:type": "IsPartOf",
"@id": "1539251546393416166-242ac11f-0001-012"
},
{
"#rel:type": "HasDerivation",
"@id": "2696410360146947610-242ac11f-0001-012"
},
{
"#rel:type": "HasDerivation",
"@id": "2135015184886787610-242ac11f-0001-012"
}
]
},
"created": "2016-07-15T14:26:42.807-05:00",
"_links": {
"self": {
"href": "https://agave.iplantc.org/meta/v2/data/1127773956946924006-242ac11f-0001-012"
}
}
}
{
"uuid": "2696410360146947610-242ac11f-0001-012",
"owner": "mrhanlon",
"schemaId": null,
"internalUsername": null,
"associationIds": [],
"lastUpdated": "2016-07-15T14:32:23.265-05:00",
"name": "mrhtest.process",
"value": {
"@dc:name": "Sequence Specimen 2, run 1",
"@dc:creator": "mrhanlon",
"_relationships": [
{
"@rel:type": "IsPartOf",
"@id": "1539251546393416166-242ac11f-0001-012"
},
{
"@rel:type": "IsDerivedFrom",
"@id": "1127773956946924006-242ac11f-0001-012"
}
]
},
"created": "2016-07-15T14:32:23.265-05:00",
"_links": {
"self": {
"href": "https://agave.iplantc.org/meta/v2/data/2696410360146947610-242ac11f-0001-012"
}
}
}
{
"uuid": "2135015184886787610-242ac11f-0001-012",
"owner": "mrhanlon",
"schemaId": null,
"internalUsername": null,
"associationIds": [],
"lastUpdated": "2016-07-15T14:32:36.336-05:00",
"name": "mrhtest.process",
"value": {
"@dc:name": "Sequence Specimen 2, run 2",
"@dc:creator": "mrhanlon",
"_relationships": [
{
"@rel:type": "IsPartOf",
"@id": "1539251546393416166-242ac11f-0001-012"
},
{
"@rel:type": "IsDerivedFrom",
"@id": "1127773956946924006-242ac11f-0001-012"
}
]
},
"created": "2016-07-15T14:32:36.336-05:00",
"_links": {
"self": {
"href": "https://agave.iplantc.org/meta/v2/data/2135015184886787610-242ac11f-0001-012"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment