cidme-cli
v0.6.1
Published
CLI for CIDME
Downloads
4
Readme
CIDME-CLI Implementation CIDME ID/URL: cidme://public/EntityContext/dcb2c99b-2fd2-4bb4-925d-32ff534705f3
CIDME-CLI
Node-based CLI for CIDME (ALPHA! INCOMPLETE!). Uses the CIDME-JS package.
Install:
- 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.js
script directly.
- NOTE: If you do not link the CLI globally you will have to manually install and/or use the
Basic Usage:
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-cli
Create a new CIDME Entity with one Entity Context:
cidme-cli createEntityAndEntityContext
Create a new CIDME Entity with three Entity Contexts:
cidme-cli createEntityAndEntityContext 3
NOTE! - jq is your friend!!! Make it pretty:
cidme-cli createEntityAndEntityContext | jq
Save a new CIDME Entity/Entity Context to a file:
cidme-cli -o test.json createEntityAndEntityContext
View a formatted summary of the contents of the file:
cidme-cli -i test.json viewFile
In 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 EntityContextDataGroup
View the formatted summary of the new file:
cidme-cli -i test2.json viewFile
There 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 viewFile
Now 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 initSqliteDb
Next we need to add our CIDME Entity to the DB.
cidme-cli.js -i test2.json -s test.db -u viewFile
Now 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 viewFile
In 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 view
There 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 view
Generate visual layout graph:
cidme-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.dot
Then use the dot
program to generate an image:
dot -x -Tjpg test.dot -o test.jpg
To generate a postscript file instead:
dot -x -Tps test.dot -o test.ps