Clojure API

Namespaces

collection - a container for all the items that you'd like to be organized and searched together.

taxonomy - a hierarchical organization of categories to organize the items in a collection. A collection may have many taxonomies and they are independent of each other.

item - any resource that's been stored in a particular collection. Items may also be organized in one or more taxonomies.

common - a common set of functions for everything that's stored in FCMS. You won't often use these functions directly.

The full set of reference documentation is available.

Quick-Start from the Interactive REPL

Download the latest CouchDB, install it (it's a 1-click installer) and run it (it's a 1-click app).

Clone the Falkland CMS repo:

git clone https://github.com/SnootyMonkey/Falkland-CMS.git

Then initialize the DB:

cd Falkland-CMS
lein init-db

Start the REPL with:

lein repl

Require the base resource namespaces you'll be using:

(require '[fcms.resources.collection :as collection])
(require '[fcms.resources.item :as item])
(require '[fcms.resources.taxonomy :as taxonomy])

Create a couple new collections:

(collection/create-collection "Mudskippers")

(collection/create-collection "Fortune 500")

List the collections that exist:

(pprint (collection/all-collections))

Create a very basic item:

(item/create-item "mudskippers" "Fish with Legs!")

Create some more typical items:

(item/create-item "mudskippers" "Amazing animals - Mudskipper" {:creator "BBC Life episode", :url "https://www.youtube.com/watch?v=KurTiX4FDuQ"})

(item/create-item "fortune-500" "Apple" {:creator ["Steve Jobs", "Steve Wozniak"], :url ["http://apple.com", "http://en.wikipedia.org/wiki/Apple_Inc."]})

List all the items in each collection:

(pprint (item/all-items "mudskippers"))

(pprint (item/all-items "fortune-500"))

Create a taxonomy:

(taxonomy/create-taxonomy "mudskippers" "media-types")
(taxonomy/create-taxonomy "mudskippers" "Topics")

(taxonomy/create-taxonomy "fortune-500" "Topics")

List all the taxonomies in each collection:

(pprint (taxonomy/all-taxonomies "mudskippers"))

(pprint (taxonomy/all-taxonomies "fortune-500"))

Create some categories in the taxonomies:

(taxonomy/create-category "mudskippers" "media-types/web-pages/wikipedia" "Wikipedia Pages")
(taxonomy/create-category "mudskippers" "media-types/videos/youtube" "YouTube Videos")
(taxonomy/create-category "mudskippers" "media-types/videos/vimeo" "Vimeo Videos")

(taxonomy/create-category "mudskippers" "topics/reproduction")
(taxonomy/create-category "mudskippers" "topics/feeding")

(taxonomy/create-category "fortune-500" "topics/companies" "Companies")
(taxonomy/create-category "fortune-500" "topics/ceos" "CEOs")

Look at the updated taxonomies with categories:

(pprint (taxonomy/all-taxonomies "mudskippers"))

(pprint (taxonomy/get-taxonomy "fortune-500" "topics"))

Categorize the items in some categories:

(taxonomy/categorize-item "mudskippers" "amazing-animals-mudskipper" "media-types/videos/youtube")
(taxonomy/categorize-item "mudskippers" "amazing-animals-mudskipper" "topics/reproduction")

(taxonomy/categorize-item "fortune-500" "apple" "topics/companies")

List all items categorized in a particular taxonomy:

(taxonomy/items-for-taxonomy "mudskippers" "media-types")

(taxonomy/items-for-taxonomy "fortune-500" "topics")

List all items categorized in a particular category of a taxonomy:

(taxonomy/items-for-category "mudskippers" "media-types/videos")
(taxonomy/items-for-category "mudskippers" "media-types/web-pages/wikipedia")

(taxonomy/items-for-category "fortune-500" "topics/companies")

Delete an item:

(item/delete-item "fortune-500" "apple")

Try retrieving a deleted item:

(item/get-item "fortune-500" "apple")

(taxonomy/items-for-taxonomy "fortune-500" "topics")

Delete a taxonomy:

(taxonomy/delete-taxonomy "mudskippers" "topics")

Congratulations! You've completed a whirlwind tour of the Falkland CMS Clojure API. You're all done for now:

quit