clj-osf.core

If the application/json mime type is specified for a OSF query (it is the default format used by all the endpoints) then the JSON resultset returned by the endpoints will be transformed in a native EDN format.

Here is an example of the resultset that is returned by any endpoint:

{:prefixes {:dcterms "http://purl.org/dc/terms/"
          :ns0 "http://purl.org/ontology/bibo#"
          :xsd "http://www.w3.org/2001/XMLSchema#"
          :owl "http://www.w3.org/2002/07/owl#"
          :rdfs "http://www.w3.org/2000/01/rdf-schema#"
          :iron "http://purl.org/ontology/iron#"
          :cognonto "http://purl.org/ontology/cognonto#"
          :wsf "http://purl.org/ontology/wsf#"
          :rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#"}
:resultset {
           :subject
           [{:uri "http://techcrunch.com/?p=1081212"
             :type "ns0:Article"
             :predicate
             {:iron:prefLabel ["Microsoft's ..."]
              :cognonto:url ["http://techcrunch.com/?p=1081212"]
              :cognonto:tag [{:uri "http://purl.org/ontology/bso#interactive-computing"
                              :reify [{:type "cognonto:weight"
                                       :value "0.04369007180887"}]}
                             {:uri "http://purl.org/ontology/bso#data-migration"
                              :reify [{:type "cognonto:weight"
                                       :value "0.034965652904319"}]}
                             {:uri "http://purl.org/ontology/bso#semantic-technologies"
                              :reify [{:type "cognonto:weight"
                                       :value "0.043697216645113"}]}
                             {:uri "http://purl.org/ontology/bso#machine-learning-algorithms"
                              :reify [{:type "cognonto:weight"
                                       :value "0.056243105409715"}]}
                             :cognonto:reviewed [{:value "0"
                                                  :type "xsd:integer"}]
               :cognonto:published [{:value "Tue Nov 11 08:05:49 EST 2014"
                                     :type "xsd:dateTime"}]
               :cognonto:inDomain [{:value "0"
                                    :type "xsd:integer"},
               :cognonto:content ["Microsofts New 199 Bundle Includes ... "]
               :dcterms:isPartOf [{:uri "http://bigstructure.org/datasets/articles/"}]}}]}

The outline of this structEDN format is the same as the one of the structJSON one at the exception that all the keys are keywords. Also, the :properties attribute is composed of a map of predicates and each of them have a vector of values. More information about structEDN can be found on this wiki page.

->get

(->get)

Specify that the query is a HTTP GET query

->mime

(->mime m)

Define the mime type of the query. The mime type will be used in the Accept header of the HTTP query.

->post

(->post)

Specify that the query is a HTTP POST query

debug

(debug)

Specify that you want to have debug information displayed in the REPL for that query.

defosf

macro

(defosf osf-name options)

Macro to be used to create new OSF endpoints

Here is an example for the options parameter which includes all possible options:

{:protocol :http :domain “test.com” :api-key “…” :app-id “…”}

defuser

macro

(defuser user-name options)

Macro to be used to create new OSF user

Here is an example for the options parameter which includes all possible options:

{:uri "http://localhost/ws/users/admin"}