CIDME-CLI Implementation CIDME ID/URL: cidme://public/EntityContext/dcb2c99b-2fd2-4bb4-925d-32ff534705f3
Node-based CLI for CIDME (ALPHA! INCOMPLETE!). Uses the CIDME-JS package.
- Use NPM to install:
npm install cidme-cli
- If you wish to install the CLI for use globally do this (as root or sudo):
npm link cidme-cli
- NOTE: If you do not link the CLI globally you will have to manually install and/or use the
dist/cidme-cli.jsscript directly.
- NOTE: If you do not link the CLI globally you will have to manually install and/or use the
NOTE: If you did not link the CLI globally you will have to adjust the commands below to use the cidme-cli.js script itself.
Get help:
cidme-cliCreate a new CIDME Entity with one Entity Context:
cidme-cli createEntityAndEntityContextCreate a new CIDME Entity with three Entity Contexts:
cidme-cli createEntityAndEntityContext 3NOTE! - jq is your friend!!! Make it pretty:
cidme-cli createEntityAndEntityContext | jqSave a new CIDME Entity/Entity Context to a file:
cidme-cli -o test.json createEntityAndEntityContextView a formatted summary of the contents of the file:
cidme-cli -i test.json viewFileIn the above formatted output, find the CIDME Resource URI of the Entity Context. It will be in the CONTEXTS: section, to the right of - Entity Context:, will be in parenthesis, and will take the form of:
cidme://local/EntityContext/8982874a-b43e-49ce-baa2-d1a1770bf94d
Yours will have a different ID (UUID). Copy this CIDME Resource URI.
Now let's add an Entity Context Data Group to our Entity Context. In order to do so, we need to specify the parent Resource Id, which is what we just copied above.
cidme-cli -p cidme://local/EntityContext/8982874a-b43e-49ce-baa2-d1a1770bf94d -i test.json -o test2.json createResource EntityContextDataGroupView the formatted summary of the new file:
cidme-cli -i test2.json viewFileThere should now be a - EntityContextDataGroup: section under our Entity Context.
We're starting to clutter things up with all the CreatedMetadata and LastModifiedMetadata entries, but there's an easy way we can strip those out when viewing the file, using the -n option:
cidme-cli -i test2.json -n viewFileNow let's say we want to create an SQLite database and add our new CIDME Entity to it.
First we need to create a blank DB with the proper structure:
cidme-cli -s test.db initSqliteDbNext we need to add our CIDME Entity to the DB.
cidme-cli.js -i test2.json -s test.db -u viewFileNow we want to view our CIDME Entity from the SQLite DB. But what was it's CIDME Resource URI again?
cidme-cli.js -i test2.json -n viewFileIn the formatted output, find the CIDME Resource URI of the Entity. It will be at the top, to the right of Entity:, and will be in parenthesis. It will take the form of:
cidme://local/Entity/5444ca91-b9ba-41ea-87f8-f20d29b1fedc
Yours will have a different ID (UUID). Copy this CIDME Resource URI.
Now let's view our Entity from the SQLite DB. In order to do so, we need to specify the CIDME Entity Id, which is what we just copied above.
cidme-cli -g cidme://local/Entity/5444ca91-b9ba-41ea-87f8-f20d29b1fedc -s test.db viewThere it is!
We can actually query the SQLite DB by just the CIDME Entity UUID as well:
cidme-cli -g 5444ca91-b9ba-41ea-87f8-f20d29b1fedc -s test.db viewcidme-cli can be used to generate a .dot file, which can be used by graphviz to generate an image (or even a postscript file)!
First generate the .dot file from your CIDME file:
cidme-cli genGraph -i test.json -o test.dotThen use the dot program to generate an image:
dot -x -Tjpg test.dot -o test.jpgTo generate a postscript file instead:
dot -x -Tps test.dot -o test.ps
