Fetching contributors…
Cannot retrieve contributors at this time
59 lines (49 sloc) 1.5 KB
;; Copyright (c) 2011-2015 Michael S. Klishin, Alex Petrov, and The ClojureWerkz
;; Team
;; The use and distribution terms for this software are covered by the
;; Eclipse Public License 1.0 (
;; which can be found in the file epl-v10.html at the root of this distribution.
;; By using this software in any fashion, you are agreeing to be bound by
;; the terms of this license.
;; You must not remove this notice, or any other, from this software.
(:require [clj-http.util :as hutil]))
(defprotocol Identifier
(^Long to-id [input] "Coerces the input to an id that Neo4J can use to identify nodes, relationships and so on"))
(extend-protocol Identifier
(to-id [^Node node]
(:id node))
(to-id [^Long id]
(to-id [id]
(defn kw-to-string
"Converts a single keyword/string or a list of keywords/strings to string/strings"
{:no-doc true}
(if (coll? x)
(map name x)
(name x)))
(defn string-to-kw
"Converts a single string or a list of strings to keyword/keywords."
{:no-doc true}
(if (coll? x)
(map keyword x)
(keyword x)))
(defn map-values-to-kw
"Converts a subset of values of a map into keywords"
{:no-doc true}
[m keyseq]
(into m
(fn [[x y]] [x (string-to-kw y)])
(select-keys m keyseq))))
(defn encode-kw-to-string
{:no-doc true}
(hutil/url-encode (kw-to-string x)))