Skip to content

Instantly share code, notes, and snippets.

@Jaretbinford
Created January 30, 2017 18:53
Show Gist options
  • Save Jaretbinford/a274c8fe1b9dd2be3bfa1460c346a21a to your computer and use it in GitHub Desktop.
Save Jaretbinford/a274c8fe1b9dd2be3bfa1460c346a21a to your computer and use it in GitHub Desktop.
Merge attributes/add FULLTEXT to an attribute
/target
/classes
/checkouts
pom.xml
pom.xml.asc
*.jar
*.class
/.lein-*
/.nrepl-port
.hgignore
.hg/
syntax: glob
pom.xml
pom.xml.asc
*.jar
*.class
.gitignore
.git/**
syntax: regexp
^.nrepl-port
^.lein-.*
^target/
^classes/
^checkouts/
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<resourceExtensions />
<wildcardResourcePatterns>
<entry name="!dev-resources:*" />
<entry name="!resources:*" />
<entry name="!?*.java" />
<entry name="!?*.form" />
<entry name="!?*.class" />
<entry name="!?*.groovy" />
<entry name="!?*.scala" />
<entry name="!?*.flex" />
<entry name="!?*.kt" />
<entry name="!?*.clj" />
<entry name="!?*.aj" />
</wildcardResourcePatterns>
<annotationProcessing>
<profile default="true" name="Default" enabled="false">
<processorPath useClasspath="true" />
</profile>
</annotationProcessing>
</component>
</project>
<component name="InspectionProjectProfileManager">
<settings>
<option name="PROJECT_PROFILE" value="Project Default" />
<option name="USE_PROJECT_PROFILE" value="true" />
<version value="1.0" />
</settings>
</component>
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="ClUnusedImport" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="ClUnusedRequire" enabled="true" level="WARNING" enabled_by_default="true" />
</profile>
</component>
<component name="libraryTable">
<library name="Leiningen: clojure-complete:0.2.4">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/clojure-complete/clojure-complete/0.2.4/clojure-complete-0.2.4.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
<component name="libraryTable">
<library name="Leiningen: com.cognitect/cognitect-anomalies:0.1.7">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/cognitect/cognitect-anomalies/0.1.7/cognitect-anomalies-0.1.7.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
<component name="libraryTable">
<library name="Leiningen: com.cognitect/hmac-authn:0.1.181">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/cognitect/hmac-authn/0.1.181/hmac-authn-0.1.181.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
<component name="libraryTable">
<library name="Leiningen: com.cognitect/http-client:0.1.62">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/cognitect/http-client/0.1.62/http-client-0.1.62.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
<component name="libraryTable">
<library name="Leiningen: com.cognitect/transit-clj:0.8.285">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/cognitect/transit-clj/0.8.285/transit-clj-0.8.285.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
<component name="libraryTable">
<library name="Leiningen: com.cognitect/transit-java:0.8.311">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/cognitect/transit-java/0.8.311/transit-java-0.8.311.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
<component name="libraryTable">
<library name="Leiningen: com.datomic/client.wire-specs:0.1.21">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/datomic/client.wire-specs/0.1.21/client.wire-specs-0.1.21.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
<component name="libraryTable">
<library name="Leiningen: com.datomic/clj-client:0.8.606">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/datomic/clj-client/0.8.606/clj-client-0.8.606.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
<component name="libraryTable">
<library name="Leiningen: com.datomic/datomic-free:0.9.5554">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/datomic/datomic-free/0.9.5554/datomic-free-0.9.5554.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
<component name="libraryTable">
<library name="Leiningen: com.datomic/datomic-lucene-core:3.3.0">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/datomic/datomic-lucene-core/3.3.0/datomic-lucene-core-3.3.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
<component name="libraryTable">
<library name="Leiningen: com.fasterxml.jackson.core/jackson-core:2.3.2">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-core/2.3.2/jackson-core-2.3.2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
<component name="libraryTable">
<library name="Leiningen: com.google.guava/guava:18.0">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/google/guava/guava/18.0/guava-18.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
<component name="libraryTable">
<library name="Leiningen: com.googlecode.json-simple/json-simple:1.1.1">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/googlecode/json-simple/json-simple/1.1.1/json-simple-1.1.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
<component name="libraryTable">
<library name="Leiningen: com.h2database/h2:1.3.171">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/h2database/h2/1.3.171/h2-1.3.171.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
<component name="libraryTable">
<library name="Leiningen: commons-beanutils:1.9.2">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/commons-beanutils/commons-beanutils/1.9.2/commons-beanutils-1.9.2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
<component name="libraryTable">
<library name="Leiningen: commons-codec:1.5">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/commons-codec/commons-codec/1.5/commons-codec-1.5.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
<component name="libraryTable">
<library name="Leiningen: commons-collections:3.2.1">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
<component name="libraryTable">
<library name="Leiningen: io.netty/netty-all:4.0.39.Final">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/io/netty/netty-all/4.0.39.Final/netty-all-4.0.39.Final.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
<component name="libraryTable">
<library name="Leiningen: org.apache.activemq/artemis-commons:1.4.0">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/activemq/artemis-commons/1.4.0/artemis-commons-1.4.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
<component name="libraryTable">
<library name="Leiningen: org.apache.activemq/artemis-core-client:1.4.0">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/activemq/artemis-core-client/1.4.0/artemis-core-client-1.4.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
<component name="libraryTable">
<library name="Leiningen: org.apache.geronimo.specs/geronimo-json_1.0_spec:1.0-alpha-1">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/geronimo/specs/geronimo-json_1.0_spec/1.0-alpha-1/geronimo-json_1.0_spec-1.0-alpha-1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
<component name="libraryTable">
<library name="Leiningen: org.apache.johnzon/johnzon-core:0.9.4">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/johnzon/johnzon-core/0.9.4/johnzon-core-0.9.4.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
<component name="libraryTable">
<library name="Leiningen: org.apache.tomcat/tomcat-jdbc:7.0.27">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/tomcat/tomcat-jdbc/7.0.27/tomcat-jdbc-7.0.27.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
<component name="libraryTable">
<library name="Leiningen: org.apache.tomcat/tomcat-juli:7.0.27">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/tomcat/tomcat-juli/7.0.27/tomcat-juli-7.0.27.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
<component name="libraryTable">
<library name="Leiningen: org.clojure/clojure:1.8.0">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/clojure/clojure/1.8.0/clojure-1.8.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
<component name="libraryTable">
<library name="Leiningen: org.clojure/core.async:0.2.395">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/clojure/core.async/0.2.395/core.async-0.2.395.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
<component name="libraryTable">
<library name="Leiningen: org.clojure/core.cache:0.6.5">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/clojure/core.cache/0.6.5/core.cache-0.6.5.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
<component name="libraryTable">
<library name="Leiningen: org.clojure/core.memoize:0.5.9">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/clojure/core.memoize/0.5.9/core.memoize-0.5.9.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
<component name="libraryTable">
<library name="Leiningen: org.clojure/data.priority-map:0.0.7">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/clojure/data.priority-map/0.0.7/data.priority-map-0.0.7.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
<component name="libraryTable">
<library name="Leiningen: org.clojure/tools.analyzer:0.6.9">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/clojure/tools.analyzer/0.6.9/tools.analyzer-0.6.9.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
<component name="libraryTable">
<library name="Leiningen: org.clojure/tools.analyzer.jvm:0.6.10">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/clojure/tools.analyzer.jvm/0.6.10/tools.analyzer.jvm-0.6.10.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
<component name="libraryTable">
<library name="Leiningen: org.clojure/tools.cli:0.3.5">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/clojure/tools.cli/0.3.5/tools.cli-0.3.5.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
<component name="libraryTable">
<library name="Leiningen: org.clojure/tools.nrepl:0.2.12">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/clojure/tools.nrepl/0.2.12/tools.nrepl-0.2.12.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
<component name="libraryTable">
<library name="Leiningen: org.clojure/tools.reader:1.0.0-beta2">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/clojure/tools.reader/1.0.0-beta2/tools.reader-1.0.0-beta2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
<component name="libraryTable">
<library name="Leiningen: org.codehaus.janino/commons-compiler:2.6.1">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/codehaus/janino/commons-compiler/2.6.1/commons-compiler-2.6.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
<component name="libraryTable">
<library name="Leiningen: org.codehaus.janino/commons-compiler-jdk:2.6.1">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/codehaus/janino/commons-compiler-jdk/2.6.1/commons-compiler-jdk-2.6.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
<component name="libraryTable">
<library name="Leiningen: org.eclipse.jetty/jetty-client:9.3.7.v20160115">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/eclipse/jetty/jetty-client/9.3.7.v20160115/jetty-client-9.3.7.v20160115.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
<component name="libraryTable">
<library name="Leiningen: org.eclipse.jetty/jetty-http:9.3.7.v20160115">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/eclipse/jetty/jetty-http/9.3.7.v20160115/jetty-http-9.3.7.v20160115.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
<component name="libraryTable">
<library name="Leiningen: org.eclipse.jetty/jetty-io:9.3.7.v20160115">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/eclipse/jetty/jetty-io/9.3.7.v20160115/jetty-io-9.3.7.v20160115.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
<component name="libraryTable">
<library name="Leiningen: org.eclipse.jetty/jetty-util:9.3.7.v20160115">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/eclipse/jetty/jetty-util/9.3.7.v20160115/jetty-util-9.3.7.v20160115.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
<component name="libraryTable">
<library name="Leiningen: org.fressian/fressian:0.6.5">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/fressian/fressian/0.6.5/fressian-0.6.5.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
<component name="libraryTable">
<library name="Leiningen: org.javassist/javassist:3.18.1-GA">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/javassist/javassist/3.18.1-GA/javassist-3.18.1-GA.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
<component name="libraryTable">
<library name="Leiningen: org.jboss.logging/jboss-logging:3.3.0.Final">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/jboss/logging/jboss-logging/3.3.0.Final/jboss-logging-3.3.0.Final.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
<component name="libraryTable">
<library name="Leiningen: org.msgpack/msgpack:0.6.10">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/msgpack/msgpack/0.6.10/msgpack-0.6.10.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
<component name="libraryTable">
<library name="Leiningen: org.ow2.asm/asm-all:4.2">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/ow2/asm/asm-all/4.2/asm-all-4.2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
<component name="libraryTable">
<library name="Leiningen: org.slf4j/jcl-over-slf4j:1.7.7">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/slf4j/jcl-over-slf4j/1.7.7/jcl-over-slf4j-1.7.7.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
<component name="libraryTable">
<library name="Leiningen: org.slf4j/jul-to-slf4j:1.7.7">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/slf4j/jul-to-slf4j/1.7.7/jul-to-slf4j-1.7.7.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
<component name="libraryTable">
<library name="Leiningen: org.slf4j/log4j-over-slf4j:1.7.7">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/slf4j/log4j-over-slf4j/1.7.7/log4j-over-slf4j-1.7.7.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
<component name="libraryTable">
<library name="Leiningen: org.slf4j/slf4j-api:1.7.7">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/slf4j/slf4j-api/1.7.7/slf4j-api-1.7.7.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
<component name="libraryTable">
<library name="Leiningen: org.slf4j/slf4j-nop:1.7.7">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/slf4j/slf4j-nop/1.7.7/slf4j-nop-1.7.7.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="LeiningenProjectsManager">
<option name="projectFiles">
<list>
<option value="file://$PROJECT_DIR$/project.clj" />
</list>
</option>
</component>
<component name="MavenImportPreferences">
<option name="generalSettings">
<MavenGeneralSettings>
<option name="mavenHome" value="Bundled (Maven 3)" />
</MavenGeneralSettings>
</option>
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
<OptionsSetting value="true" id="Add" />
<OptionsSetting value="true" id="Remove" />
<OptionsSetting value="true" id="Checkout" />
<OptionsSetting value="true" id="Update" />
<OptionsSetting value="true" id="Status" />
<OptionsSetting value="true" id="Edit" />
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="IDE SDK" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/classes" />
</component>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/merge.iml" filepath="$PROJECT_DIR$/merge.iml" />
</modules>
</component>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ReplState" timestamp="1485801371855">{:repl-history {:ide [], :local [&quot;(ns merge.TempID\n (require [datomic.api :as d]\n [clojure.java.io :as io]\n ))&quot; &quot;(require '[clojure.core.async :refer (&lt;!!)]\n '[datomic.client :as client])&quot; &quot;(let [db (-&gt; (c/with (&lt;!! (c/with-db conn)) {:tx-data [{:db/ident :customer/name\n :db/valueType :db.type/string\n :db/cardinality :db.cardinality/one}]})\n &lt;!!\n :db-after)\n db2 (-&gt; (c/with db {:tx-data [{:customer/name \&quot;John\&quot;}]})\n &lt;!!\n :db-after)]\n (&lt;!! (c/q conn {:query '[:find ?c\n :where [?c :customer/name _]]\n :args [db2]})))&quot; &quot;(def schema-tx (read-string (slurp \&quot;/Users/jbin/Desktop/Jaret/Projects/merge/resources/schema.edn\&quot;)))&quot; &quot;b&quot; &quot;(let [db (-&gt; (client/with (&lt;!! (client/with-db conn)) {:tx-data [{:db/ident :customer/name\n :db/valueType :db.type/string\n :db/cardinality :db.cardinality/one}]})\n &lt;!!\n :db-after)\n db2 (-&gt; (client/with db {:tx-data [{:customer/name \&quot;John\&quot;}]})\n &lt;!!\n :db-after)]\n (&lt;!! (client/q conn {:query '[:find ?c\n :where [?c :customer/name _]]\n :args [db2]})))&quot; &quot;(&lt;!! (client/transact conn {:tx-data [{:db/doc \&quot;hello world\&quot;}]}))&quot; &quot;(def db (client/db conn))&quot; &quot;(&lt;!! (client/q conn {:query '[:find ?e :where [?e :db/doc \&quot;hello world\&quot;]]\n :args [db]}))&quot; &quot;(&lt;!! (client/q conn {:query '[:find (count ?e) :where [?e :db/doc]]\n :args [db]}))&quot; &quot;(ns merge.TempID\n (require [datomic.api :as d]\n [clojure.java.io :as io]\n [datomic.client :as client]\n [clojure.core.async :refer (&lt;!!)]))&quot; &quot;(def schema-tx (read-string (slurp \&quot;/Users/jbin/Desktop/Jaret/Projects/workproof/merge/resources/tempiddata.edn\&quot;)))&quot; &quot;(def conn\n (&lt;!! (client/connect\n {:db-name \&quot;firstdb\&quot;\n :account-id client/PRO_ACCOUNT\n :secret \&quot;mysecret\&quot;\n :region \&quot;none\&quot;\n :endpoint \&quot;localhost:8998\&quot;\n :service \&quot;peer-server\&quot;\n :access-key \&quot;myaccesskey\&quot;})))&quot; &quot;conn&quot; &quot;(def uri \&quot;datomic:dev://localhost:4334/mbrainz-1968-1973\&quot;)&quot; &quot;(d/create-database uri)&quot; &quot;(require '[datomic.api :as d])\n\n(d/get-database-names \&quot;datomic:dev://localhost:4334/*\&quot;)\n(def uri \&quot;datomic:dev://localhost:4334/mbrainz-1968-1973\&quot;)\n(def conn (d/connect uri))\n(def db (d/db conn))\n(d/q '[:find ?title\n :in $ ?artist-name\n :where\n [?a :artist/name ?artist-name]\n [?t :track/artists ?a]\n [?t :track/name ?title]]\n db\n \&quot;John Lennon\&quot;)&quot; &quot;q&quot; &quot;(d/q [:find ?from ?d0 ?d1 ?d2\n :in $ %?e0 ?e1 ?e2\n :where\n (exists-path? ?e0 ?from ?d0)\n (exists-path? ?e1 ?from ?d1)\n (exists-path? ?e2 ?from ?d2)\n ]\n; Query params\n[db, rules, :scalarDouble/a, :scalarDouble/b, :scalarDouble/c])&quot; &quot;(def rules\n '[\n ;base case\n [(exists-path? (?to) ?from ?depth)\n [(ground 1) ?depth]\n [?v ?to _]\n [_ ?from ?v]\n [?from :db/valueType :db.type/ref]\n ]\n ; recursive case\n [(exists-path? (?to) ?from ?depth)\n [?from :db/valueType :db.type/ref]\n [_ ?from ?v]\n [?v ?via _]\n [?via :db/valueType :db.type/ref]\n (exists-path? ?to ?via ?subDepth)\n [(+ 1 ?subDepth) ?depth]\n ]])&quot; &quot;(d/q '[:find ?from ?d0 ?d1 ?d2\n :in $ %?e0 ?e1 ?e2\n :where\n (exists-path? ?e0 ?from ?d0)\n (exists-path? ?e1 ?from ?d1)\n (exists-path? ?e2 ?from ?d2)\n ]\n; Query params\n[db, rules, :scalarDouble/a, :scalarDouble/b, :scalarDouble/c])&quot; &quot;(d/q '[:find ?from ?d0 ?d1 ?d2\n :in $ % ?e0 ?e1 ?e2\n :where\n (exists-path? ?e0 ?from ?d0)\n (exists-path? ?e1 ?from ?d1)\n (exists-path? ?e2 ?from ?d2)]\n \n ; Query params\n db, rules, :scalarDouble/a, :scalarDouble/b, :scalarDouble/c)&quot; &quot;(def db-uri \&quot;datomic:dev://localhost:4334/intlong\&quot;)&quot; &quot;(def data [{:group/root\n {:group/sub\n {:group/inner {:scalarDouble/a 1, :scalarDouble/b 2, :scalarDouble/c 3}}\n }}])&quot; &quot;result&quot; &quot;(last result)&quot; &quot;(type (second (last result)))&quot; &quot;(into [] result)&quot; &quot;(def result *1)&quot; &quot;(type (second (nth result 2)))&quot; &quot;(type (second (nth result 3\n )))&quot; &quot;(equal? (last result) (nth result 2))&quot; &quot;(= (last result) (nth result 3))&quot; &quot;(= (last result) (nth result 4))&quot; &quot;(= (last result) (nth result 1))&quot; &quot;(= (last result) (nth result 0))&quot; &quot;(= (last result) (nth result 2))&quot; &quot;(type (last result))&quot; &quot;(= (nth result 2) (nth result 3))&quot; &quot;(def rules1\n '[\n ;base case\n [(exists-path? (?to) ?from ?depth)\n [(ground 1) ?depth]\n [?v ?to _]\n [_ ?from ?v]\n [?from :db/valueType :db.type/ref]]\n ])&quot; &quot;(d/q '[:find ?from ?d0 ?d1 ?d2\n :in $ % ?e0 ?e1 ?e2\n :where\n (exists-path? ?e0 ?from ?d0)\n (exists-path? ?e1 ?from ?d1)\n (exists-path? ?e2 ?from ?d2)]\n\n ; Query params\n db, rules1, :scalarDouble/a, :scalarDouble/b, :scalarDouble/c)&quot; &quot;(def rules2\n '[\n ; recursive case\n [(exists-path? (?to) ?from ?depth)\n [?from :db/valueType :db.type/ref]\n [_ ?from ?v]\n [?v ?via _]\n [?via :db/valueType :db.type/ref]\n (exists-path? ?to ?via ?subDepth)\n [(+ 1 ?subDepth) ?depth]]\n ])&quot; &quot;(def rules2\n '[(exists-path? (?to) ?from ?depth)\n [?from :db/valueType :db.type/ref]\n [_ ?from ?v]\n [?v ?via _]\n [?via :db/valueType :db.type/ref]\n (exists-path? ?to ?via ?subDepth)\n [(+ 1 ?subDepth) ?depth]]\n )&quot; &quot;(def rules2\n '[[(exists-path? (?to) ?from ?depth)\n [?from :db/valueType :db.type/ref]\n [_ ?from ?v]\n [?v ?via _]\n [?via :db/valueType :db.type/ref]\n (exists-path? ?to ?via ?subDepth)\n [(+ 1 ?subDepth) ?depth]]])&quot; &quot;(d/q '[:find ?from ?d0 ?d1 ?d2\n :in $ % ?e0 ?e1 ?e2\n :where\n (exists-path? ?e0 ?from ?d0)\n (exists-path? ?e1 ?from ?d1)\n (exists-path? ?e2 ?from ?d2)]\n\n ; Query params\n db, rules2, :scalarDouble/a, :scalarDouble/b, :scalarDouble/c)&quot; &quot;@(d/transact conn\n [[:db/add \&quot;a\&quot; :foo/name \&quot;x\&quot;]\n [:db/add \&quot;b\&quot; :foo/name \&quot;y\&quot;]\n [:myAdd \&quot;a\&quot; :foo/ref \&quot;b\&quot;]])&quot; &quot;(deref\n (d/transact conn\n [[:db/add \&quot;a\&quot; :foo/name \&quot;x\&quot;]\n [:db/add \&quot;b\&quot; :foo/name \&quot;y\&quot;]\n [:myAdd [:foo/name \&quot;x\&quot;] :foo/ref \&quot;b\&quot;]]))&quot; &quot;(deref\n (d/transact conn\n [{:db/ident :foo/name\n :db/valueType :db.type/string\n :db/cardinality :db.cardinality/one\n :db/unique :db.unique/identity}\n {:db/ident :foo/ref\n :db/valueType :db.type/ref\n :db/cardinality :db.cardinality/one}\n {:db/ident :myAdd\n :db/fn #db/fn {:lang :clojure\n :params [db e a v]\n :code [[:db/add (:db/id (d/entity db e)) a v]]}}]))&quot; &quot;(d/transact conn\n [{:db/ident :foo/name\n :db/valueType :db.type/string\n :db/cardinality :db.cardinality/one\n :db/unique :db.unique/identity}\n {:db/ident :foo/ref\n :db/valueType :db.type/ref\n :db/cardinality :db.cardinality/one}\n {:db/ident :myAdd\n :db/fn #db/fn {:lang :clojure\n :params [db e a v]\n :code [[:db/add (:db/id (d/entity db e)) a v]]}}])&quot; &quot;@(d/transact conn\n [[:db/add \&quot;a\&quot; :foo/name \&quot;x\&quot;]\n [:db/add \&quot;b\&quot; :foo/name \&quot;y\&quot;]\n [:db/add \&quot;a\&quot; :foo/ref \&quot;b\&quot;]])&quot; &quot;(def schema [{:db/id \&quot;communities\&quot;\n :db/ident :communities}\n [:db/add :db.part/db :db.install/partition \&quot;communities\&quot;]])&quot; &quot;@(d/transact conn\n [{:db/id \&quot;communities\&quot;\n :db/ident :communities}\n [:db/add :db.part/db :db.install/partition \&quot;communities\&quot;]])&quot; &quot;(def schema (read-string (slurp \&quot;/Users/jbin/Desktop/Jaret/Projects/workproof/merge/resources/stringschema.edn\&quot;)))&quot; &quot;(ns stringtemp.core\n (:import datomic.Util)\n (require [datomic.api :as d]\n [clojure.java.io :as io]))&quot; &quot;(def db-uri \&quot;datomic:dev://localhost:4334/stringtemp\&quot;)&quot; &quot;(let [a (d/tempid :db.part/user)]\n @(d/transact conn\n [[:db/add a :foo/name \&quot;x\&quot;]\n [:db/add \&quot;b\&quot; :foo/name \&quot;y\&quot;]\n [:myAdd a :foo/ref \&quot;b\&quot;]]))&quot; &quot;(d/entity -9223350046623220290)&quot; &quot;(d/pull -9223350046623220290)&quot; &quot;(d/pull '[*] -9223350046623220290)&quot; &quot;(d/ident -9223350046623220290)&quot; &quot;(d/ident db -9223350046623220290)&quot; &quot;(def test-data-tx (read-string (slurp \&quot;/Users/jbin/Desktop/Jaret/Projects/workproof/merge/resources/intlong.edn\&quot;)))&quot; &quot;(def data [{:group/root\n {:group/sub\n {:group/inner {:scalarDouble/a 1.0, :scalarDouble/b 2.0, :scalarDouble/c 3.0}}\n }}])&quot; &quot;@(d/transact conn data)&quot; &quot;(d/q '[:find ?e :where [?e]] [[(long 42)] [(int 42)]])&quot; &quot;(datomic/q '[:find ?e :where [?e]] [[(long 42)] [(int 42)]])&quot; &quot;(d/q '[:find ?x\n :where\n [?e :db/valueType :db.type/ref]\n (or\n [?x ?e]\n [?e ?x])]\n )&quot; &quot;(require [datomic.api :as d])&quot; &quot;(ns intlong.core\n (:import datomic.Util)\n (require [datomic.api :as d]\n [clojure.java.io :as io]))&quot; &quot;(def db-uri \&quot;datomic:free://localhost:4334/intlong\&quot;)&quot; &quot;(def rules\n '[\n ;base case\n [(exists-path? (?to) ?from ?depth)\n [(ground 1) ?depth]\n [?v ?to _]\n [_ ?from ?v]\n [?from :db/valueType :db.type/ref]]\n ; recursive case\n [(exists-path? (?to) ?from ?depth)\n [?from :db/valueType :db.type/ref]\n [_ ?from ?v]\n [?v ?via _]\n [?via :db/valueType :db.type/ref]\n (exists-path? ?to ?via ?subDepth)\n [(+ 1 ?subDepth) ?depth]]\n ])&quot; &quot;(d/q '[:find ?from ?d0 ?d1 ?d2\n :in $ % ?e0 ?e1 ?e2\n :where\n (exists-path? ?e0 ?from ?d0)\n (exists-path? ?e1 ?from ?d1)\n (exists-path? ?e2 ?from ?d2)]\n\n ; Query params\n db, rules, :scalarDouble/a, :scalarDouble/b, :scalarDouble/c)&quot; &quot;(d/q '[:find ?x\n :where\n [?e :db/valueType :db.type/ref]\n (or\n [?x ?e]\n [?e ?x])]\n (d/db conn))&quot; &quot;(d/q '[:find ?x\n :where\n [?e :db/valueType :db.type/ref]\n (or\n [?x ?e]\n [?e ?x])]\n db)&quot; &quot;(require '[clojure.core.async :refer (&lt;!!)]\n          '[datomic.client :as client])&quot; &quot;(require '[datomic.api :as d])&quot; &quot;(d/get-database-names \&quot;datomic:free://localhost:4334/*\&quot;)&quot; &quot;(ns merge.core\n (:import datomic.Util)\n (require [datomic.api :as d]\n [clojure.java.io :as io]))&quot; &quot;(d/create-database db-uri)&quot; &quot;(def schema-tx (read-string (slurp \&quot;/Users/jbin/Desktop/Jaret/Projects/workproof/merge/resources/schema.edn\&quot;)))&quot; &quot;@(d/transact conn schema-tx)&quot; &quot;(d/pull (d/db conn) '[*] 3)&quot; &quot;(d/pull (d/db conn) '[*] 251)&quot; &quot;(def test-data-tx (read-string (slurp \&quot;/Users/jbin/Desktop/Jaret/Projects/workproof/merge/Data.edn\&quot;)))&quot; &quot;@(d/transact conn test-data-tx)&quot; &quot;(def schema [{:db/id #db/id [:db.part/db 250],\n :db/ident :user/email-deprecated,\n :db.alter/_attribute :db.part/db}])&quot; &quot;@(d/transact conn schema)&quot; &quot;(d/q '[:find ?e ?email\n :where [?e :user/email-deprecated ?email]] (d/db conn))&quot; &quot;@(d/transact conn (merge-all db))&quot; &quot;(def db )&quot; &quot;(d/q '[:find ?e ?email\n :where [?e :user/username ?email]] (d/db conn))&quot; &quot;(defn merge-all\n \&quot;Merge all mapped results\&quot;\n [db]\n (-&gt;&gt; (d/q '[:find ?e ?email\n :where c\n [?e :user/email-deprecated ?email]]\n db)\n (mapcat (fn[[e email]]\n [[:db/add e :user/username email]\n [:db/retract e :user/email-deprecated email]]))\n ))&quot; &quot;(def db (d/db conn))&quot; &quot;(merge-all db)&quot; &quot;(def db-uri \&quot;datomic:dev://localhost:4334/merge\&quot;)&quot; &quot;(delete-database db-uri)&quot; &quot;(delete-database \&quot;datomic:dev://localhost:4334/merge\&quot;)&quot; &quot;(d/delete-database \&quot;datomic:dev://localhost:4334/merge\&quot;)&quot; &quot;(d/get-database-names \&quot;datomic:dev://localhost:4334/*\&quot;)&quot; &quot;(def conn (d/connect db-uri))&quot; &quot;(d/gc-storage conn)&quot;], :remote []}}</component>
</project>
https://cognitect.atlassian.net/browse/DATOMIC-1909
DATOMIC-1909 -------STEPS AND RESULTS--------
Step 1: Launch instances using SUPPORT AMI (m3.medium). 2 transactors and 5 peers using a starter license.
-IAM - Marshall TXOR
-IAM - Marshall Peer
-Security group - Marshall Testing
-Key pair - Datomic-ops.pem
Step 2: Connect to each instance
-ssh -i ~/.ssh/datomic-ops.pem ec2-user@instance-you-get-from-ec2M
-Download datomic version we are testing
*s3cmd get s3://deploy-a0dbc565-faf2-4760-9b7e-29a8e45f428e/client-spi.5466/datomic-pro-client-spi.5466.zip
-Install datomic on the transactor instances using bin/maven-install
Step 3: Update ddb license with Starter and AWS info and launch txors
-HOST is IP for txor instance
-AWS-dynamodb-table=marshall-ddb-sandbox
-AWS-dynamodb-region=us-east-1
-AWS-transactor-role=marshall-txor
-AWS-peer-role=marshall-peer
-bin/transactor ~/datomic-pro-client-spi.5466/config/samples/ddb-transactor-template.properties
Step 4: connect on all 5 peers
- (require '[datomic.api :as d])
(def db-uri "datomic:ddb://us-east-1/marshall-ddb-sandbox/test")
(d/create-database db-uri)
(def conn (d/connect db-uri))
- (d/pull (d/db conn) '[*] 2)
RESULTS IN LOG:
"datomic.transactor - {:event :transactor/remote-ips, :ips #{"10.165.99.57" "10.69.30.111" "10.67.164.130" "10.143.16.150" "10.101.217.87"}..."
STEP 5: Test failover
-Kill one transactor
-Transact after failover
RESULTS IN LOG:
"2016-10-25 15:00:43.046 INFO default datomic.lifecycle-ext -
{:event :transactor/standby, :rev 1235, :missed 1, :timestamp 1477407634077, :pid 24080, :tid 15}"
-(d/transact conn [[:db/add (d/tempid :db.part/user) :db/doc "Testing"]])
#object[datomic.promise$settable_future$reify__8357 0x74960e9d {:status :ready, :val
{:db-before datomic.db.Db@ca0d9ea8, :db-after datomic.db.Db@e420026d, :tx-data
[#datom[13194139534314 50 #inst "2016-10-25T15:02:16.574-00:00" 13194139534314 true]
#datom[17592186045419 62 "Testing" 13194139534314 true]], :tempids {-9223350046623220290 17592186045419}}}]
user=> (deref *1)
{:db-before datomic.db.Db@ca0d9ea8, :db-after datomic.db.Db@e420026d, :tx-data
[#datom[13194139534314 50 #inst "2016-10-25T15:02:16.574-00:00" 13194139534314 true]
#datom[17592186045419 62 "Testing" 13194139534314 true]], :tempids {-9223350046623220290 17592186045419}}
Step 6: Test Memcached by creating an Memcached cluster
-Elasticahe > CREATE with memcached
-Set transactor.properties file to configuration endpoint "jaretcache.rfcgig.cfg.use1.cache.amazonaws.com:11211"
-restart transactor and look for memcached connections
-Configure Memcached cluster with security group access by default to "Marshall.."
*EC2 Security Group Name: marshall-testing -- AUTHORIZED
-Start peer with Memcached to confirm peer logging:
*rlwrap bin/repl -Ddatomic.memcachedServers="jaretcache.rfcgig.cfg.use1.cache.amazonaws.com:11211
RESULTS IN LOG:
2016-10-25 18:25:20.866 WARN default
n.spy.memcached.MemcachedConnection - Closing, and reopening
{QA sa=jaretcache.rfcgig.cfg.use1.cache.amazonaws.com/10.234.66.205:11211,
#Rops=0, #Wops=44, #iq=0, topRop=null, topWop=Cmd: 0 Opaque: 1 Key: 580f70a2-ecc9-43c2-89c6-eeea4a6a4b9e, toWrite=0, interested=0}, attempt 5.
LOG AFTER ADDING SECURITY GROUP:
":WriterMemcachedPutMusec {:lo 172, :hi 25300, :sum 50000, :count 32},"
":Memcache {:lo 0, :hi 0, :sum 0, :count 19},"
PEER LOG:
"2016-10-26 14:38:15.802 INFO default datomic.process-monitor -
{:tid 10, :AvailableMB 792.0, :ReaderMemcachedPutMusec {:lo 29800, :hi 29800, :sum 29800, :count 1}, :Memcache {:lo 0, :hi 1, :sum 25,...."

Change Log

All notable changes to this project will be documented in this file. This change log follows the conventions of keepachangelog.com.

Changed

  • Add a new arity to make-widget-async to provide a different widget shape.

0.1.1 - 2016-08-23

Changed

  • Documentation on how to make the widgets.

Removed

  • make-widget-sync - we're all async, all the time.

Fixed

  • Fixed widget maker to keep working when daylight savings switches over.

0.1.0 - 2016-08-23

Added

  • Files from the new template.
  • Widget maker public API - make-widget-sync.
THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC
LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM
CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
1. DEFINITIONS
"Contribution" means:
a) in the case of the initial Contributor, the initial code and
documentation distributed under this Agreement, and
b) in the case of each subsequent Contributor:
i) changes to the Program, and
ii) additions to the Program;
where such changes and/or additions to the Program originate from and are
distributed by that particular Contributor. A Contribution 'originates' from
a Contributor if it was added to the Program by such Contributor itself or
anyone acting on such Contributor's behalf. Contributions do not include
additions to the Program which: (i) are separate modules of software
distributed in conjunction with the Program under their own license
agreement, and (ii) are not derivative works of the Program.
"Contributor" means any person or entity that distributes the Program.
"Licensed Patents" mean patent claims licensable by a Contributor which are
necessarily infringed by the use or sale of its Contribution alone or when
combined with the Program.
"Program" means the Contributions distributed in accordance with this
Agreement.
"Recipient" means anyone who receives the Program under this Agreement,
including all Contributors.
2. GRANT OF RIGHTS
a) Subject to the terms of this Agreement, each Contributor hereby grants
Recipient a non-exclusive, worldwide, royalty-free copyright license to
reproduce, prepare derivative works of, publicly display, publicly perform,
distribute and sublicense the Contribution of such Contributor, if any, and
such derivative works, in source code and object code form.
b) Subject to the terms of this Agreement, each Contributor hereby grants
Recipient a non-exclusive, worldwide, royalty-free patent license under
Licensed Patents to make, use, sell, offer to sell, import and otherwise
transfer the Contribution of such Contributor, if any, in source code and
object code form. This patent license shall apply to the combination of the
Contribution and the Program if, at the time the Contribution is added by the
Contributor, such addition of the Contribution causes such combination to be
covered by the Licensed Patents. The patent license shall not apply to any
other combinations which include the Contribution. No hardware per se is
licensed hereunder.
c) Recipient understands that although each Contributor grants the licenses
to its Contributions set forth herein, no assurances are provided by any
Contributor that the Program does not infringe the patent or other
intellectual property rights of any other entity. Each Contributor disclaims
any liability to Recipient for claims brought by any other entity based on
infringement of intellectual property rights or otherwise. As a condition to
exercising the rights and licenses granted hereunder, each Recipient hereby
assumes sole responsibility to secure any other intellectual property rights
needed, if any. For example, if a third party patent license is required to
allow Recipient to distribute the Program, it is Recipient's responsibility
to acquire that license before distributing the Program.
d) Each Contributor represents that to its knowledge it has sufficient
copyright rights in its Contribution, if any, to grant the copyright license
set forth in this Agreement.
3. REQUIREMENTS
A Contributor may choose to distribute the Program in object code form under
its own license agreement, provided that:
a) it complies with the terms and conditions of this Agreement; and
b) its license agreement:
i) effectively disclaims on behalf of all Contributors all warranties and
conditions, express and implied, including warranties or conditions of title
and non-infringement, and implied warranties or conditions of merchantability
and fitness for a particular purpose;
ii) effectively excludes on behalf of all Contributors all liability for
damages, including direct, indirect, special, incidental and consequential
damages, such as lost profits;
iii) states that any provisions which differ from this Agreement are offered
by that Contributor alone and not by any other party; and
iv) states that source code for the Program is available from such
Contributor, and informs licensees how to obtain it in a reasonable manner on
or through a medium customarily used for software exchange.
When the Program is made available in source code form:
a) it must be made available under this Agreement; and
b) a copy of this Agreement must be included with each copy of the Program.
Contributors may not remove or alter any copyright notices contained within
the Program.
Each Contributor must identify itself as the originator of its Contribution,
if any, in a manner that reasonably allows subsequent Recipients to identify
the originator of the Contribution.
4. COMMERCIAL DISTRIBUTION
Commercial distributors of software may accept certain responsibilities with
respect to end users, business partners and the like. While this license is
intended to facilitate the commercial use of the Program, the Contributor who
includes the Program in a commercial product offering should do so in a
manner which does not create potential liability for other Contributors.
Therefore, if a Contributor includes the Program in a commercial product
offering, such Contributor ("Commercial Contributor") hereby agrees to defend
and indemnify every other Contributor ("Indemnified Contributor") against any
losses, damages and costs (collectively "Losses") arising from claims,
lawsuits and other legal actions brought by a third party against the
Indemnified Contributor to the extent caused by the acts or omissions of such
Commercial Contributor in connection with its distribution of the Program in
a commercial product offering. The obligations in this section do not apply
to any claims or Losses relating to any actual or alleged intellectual
property infringement. In order to qualify, an Indemnified Contributor must:
a) promptly notify the Commercial Contributor in writing of such claim, and
b) allow the Commercial Contributor tocontrol, and cooperate with the
Commercial Contributor in, the defense and any related settlement
negotiations. The Indemnified Contributor may participate in any such claim
at its own expense.
For example, a Contributor might include the Program in a commercial product
offering, Product X. That Contributor is then a Commercial Contributor. If
that Commercial Contributor then makes performance claims, or offers
warranties related to Product X, those performance claims and warranties are
such Commercial Contributor's responsibility alone. Under this section, the
Commercial Contributor would have to defend claims against the other
Contributors related to those performance claims and warranties, and if a
court requires any other Contributor to pay any damages as a result, the
Commercial Contributor must pay those damages.
5. NO WARRANTY
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON
AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER
EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR
CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the
appropriateness of using and distributing the Program and assumes all risks
associated with its exercise of rights under this Agreement , including but
not limited to the risks and costs of program errors, compliance with
applicable laws, damage to or loss of data, programs or equipment, and
unavailability or interruption of operations.
6. DISCLAIMER OF LIABILITY
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY
CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION
LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE
EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY
OF SUCH DAMAGES.
7. GENERAL
If any provision of this Agreement is invalid or unenforceable under
applicable law, it shall not affect the validity or enforceability of the
remainder of the terms of this Agreement, and without further action by the
parties hereto, such provision shall be reformed to the minimum extent
necessary to make such provision valid and enforceable.
If Recipient institutes patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Program itself
(excluding combinations of the Program with other software or hardware)
infringes such Recipient's patent(s), then such Recipient's rights granted
under Section 2(b) shall terminate as of the date such litigation is filed.
All Recipient's rights under this Agreement shall terminate if it fails to
comply with any of the material terms or conditions of this Agreement and
does not cure such failure in a reasonable period of time after becoming
aware of such noncompliance. If all Recipient's rights under this Agreement
terminate, Recipient agrees to cease use and distribution of the Program as
soon as reasonably practicable. However, Recipient's obligations under this
Agreement and any licenses granted by Recipient relating to the Program shall
continue and survive.
Everyone is permitted to copy and distribute copies of this Agreement, but in
order to avoid inconsistency the Agreement is copyrighted and may only be
modified in the following manner. The Agreement Steward reserves the right to
publish new versions (including revisions) of this Agreement from time to
time. No one other than the Agreement Steward has the right to modify this
Agreement. The Eclipse Foundation is the initial Agreement Steward. The
Eclipse Foundation may assign the responsibility to serve as the Agreement
Steward to a suitable separate entity. Each new version of the Agreement will
be given a distinguishing version number. The Program (including
Contributions) may always be distributed subject to the version of the
Agreement under which it was received. In addition, after a new version of
the Agreement is published, Contributor may elect to distribute the Program
(including its Contributions) under the new version. Except as expressly
stated in Sections 2(a) and 2(b) above, Recipient receives no rights or
licenses to the intellectual property of any Contributor under this
Agreement, whether expressly, by implication, estoppel or otherwise. All
rights in the Program not expressly granted under this Agreement are
reserved.
This Agreement is governed by the laws of the State of New York and the
intellectual property laws of the United States of America. No party to this
Agreement will bring a legal action under this Agreement more than one year
after the cause of action arose. Each party waives its rights to a jury trial
in any resulting litigation.
<?xml version="1.0" encoding="UTF-8"?>
<module cursive.leiningen.project.LeiningenProjectsManager.displayName="merge:0.1.0-SNAPSHOT" cursive.leiningen.project.LeiningenProjectsManager.isLeinModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/target/base+system+user+dev/classes" />
<output-test url="file://$MODULE_DIR$/target/base+system+user+dev/classes" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/resources" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/dev-resources" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/target/base+system+user+dev" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Leiningen: clojure-complete:0.2.4" level="project" />
<orderEntry type="library" name="Leiningen: com.cognitect/cognitect-anomalies:0.1.7" level="project" />
<orderEntry type="library" name="Leiningen: com.cognitect/hmac-authn:0.1.181" level="project" />
<orderEntry type="library" name="Leiningen: com.cognitect/http-client:0.1.62" level="project" />
<orderEntry type="library" name="Leiningen: com.cognitect/transit-clj:0.8.285" level="project" />
<orderEntry type="library" name="Leiningen: com.cognitect/transit-java:0.8.311" level="project" />
<orderEntry type="library" name="Leiningen: com.datomic/client.wire-specs:0.1.21" level="project" />
<orderEntry type="library" name="Leiningen: com.datomic/clj-client:0.8.606" level="project" />
<orderEntry type="library" name="Leiningen: com.datomic/datomic-free:0.9.5554" level="project" />
<orderEntry type="library" name="Leiningen: com.datomic/datomic-lucene-core:3.3.0" level="project" />
<orderEntry type="library" name="Leiningen: com.fasterxml.jackson.core/jackson-core:2.3.2" level="project" />
<orderEntry type="library" name="Leiningen: com.google.guava/guava:18.0" level="project" />
<orderEntry type="library" name="Leiningen: com.googlecode.json-simple/json-simple:1.1.1" level="project" />
<orderEntry type="library" name="Leiningen: com.h2database/h2:1.3.171" level="project" />
<orderEntry type="library" name="Leiningen: commons-beanutils:1.9.2" level="project" />
<orderEntry type="library" name="Leiningen: commons-codec:1.5" level="project" />
<orderEntry type="library" name="Leiningen: commons-collections:3.2.1" level="project" />
<orderEntry type="library" name="Leiningen: io.netty/netty-all:4.0.39.Final" level="project" />
<orderEntry type="library" name="Leiningen: org.apache.activemq/artemis-commons:1.4.0" level="project" />
<orderEntry type="library" name="Leiningen: org.apache.activemq/artemis-core-client:1.4.0" level="project" />
<orderEntry type="library" name="Leiningen: org.apache.geronimo.specs/geronimo-json_1.0_spec:1.0-alpha-1" level="project" />
<orderEntry type="library" name="Leiningen: org.apache.johnzon/johnzon-core:0.9.4" level="project" />
<orderEntry type="library" name="Leiningen: org.apache.tomcat/tomcat-jdbc:7.0.27" level="project" />
<orderEntry type="library" name="Leiningen: org.apache.tomcat/tomcat-juli:7.0.27" level="project" />
<orderEntry type="library" name="Leiningen: org.clojure/clojure:1.8.0" level="project" />
<orderEntry type="library" name="Leiningen: org.clojure/core.async:0.2.395" level="project" />
<orderEntry type="library" name="Leiningen: org.clojure/core.cache:0.6.5" level="project" />
<orderEntry type="library" name="Leiningen: org.clojure/core.memoize:0.5.9" level="project" />
<orderEntry type="library" name="Leiningen: org.clojure/data.priority-map:0.0.7" level="project" />
<orderEntry type="library" name="Leiningen: org.clojure/tools.analyzer.jvm:0.6.10" level="project" />
<orderEntry type="library" name="Leiningen: org.clojure/tools.analyzer:0.6.9" level="project" />
<orderEntry type="library" name="Leiningen: org.clojure/tools.cli:0.3.5" level="project" />
<orderEntry type="library" name="Leiningen: org.clojure/tools.nrepl:0.2.12" level="project" />
<orderEntry type="library" name="Leiningen: org.clojure/tools.reader:1.0.0-beta2" level="project" />
<orderEntry type="library" name="Leiningen: org.codehaus.janino/commons-compiler-jdk:2.6.1" level="project" />
<orderEntry type="library" name="Leiningen: org.codehaus.janino/commons-compiler:2.6.1" level="project" />
<orderEntry type="library" name="Leiningen: org.eclipse.jetty/jetty-client:9.3.7.v20160115" level="project" />
<orderEntry type="library" name="Leiningen: org.eclipse.jetty/jetty-http:9.3.7.v20160115" level="project" />
<orderEntry type="library" name="Leiningen: org.eclipse.jetty/jetty-io:9.3.7.v20160115" level="project" />
<orderEntry type="library" name="Leiningen: org.eclipse.jetty/jetty-util:9.3.7.v20160115" level="project" />
<orderEntry type="library" name="Leiningen: org.fressian/fressian:0.6.5" level="project" />
<orderEntry type="library" name="Leiningen: org.javassist/javassist:3.18.1-GA" level="project" />
<orderEntry type="library" name="Leiningen: org.jboss.logging/jboss-logging:3.3.0.Final" level="project" />
<orderEntry type="library" name="Leiningen: org.msgpack/msgpack:0.6.10" level="project" />
<orderEntry type="library" name="Leiningen: org.ow2.asm/asm-all:4.2" level="project" />
<orderEntry type="library" name="Leiningen: org.slf4j/jcl-over-slf4j:1.7.7" level="project" />
<orderEntry type="library" name="Leiningen: org.slf4j/jul-to-slf4j:1.7.7" level="project" />
<orderEntry type="library" name="Leiningen: org.slf4j/log4j-over-slf4j:1.7.7" level="project" />
<orderEntry type="library" name="Leiningen: org.slf4j/slf4j-api:1.7.7" level="project" />
<orderEntry type="library" name="Leiningen: org.slf4j/slf4j-nop:1.7.7" level="project" />
</component>
</module>
(defproject merge "0.1.0-SNAPSHOT"
:description "Show the ability to merge attributes in Datomic"
:url "www.datomic.com"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.8.0"]
[com.datomic/datomic-pro "0.9.5554"]]
:target-path "target/%s"
:profiles {:uberjar {:aot :all}})

merge

FIXME: description

Installation

Download from http://example.com/FIXME.

Usage

FIXME: explanation

$ java -jar merge-0.1.0-standalone.jar [args]

Options

FIXME: listing of options this app accepts.

Examples

...

Bugs

...

Any Other Sections

That You Think

Might be Useful

License

Copyright © 2016 FIXME

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

[{:db/id #db/id[:db.part/user -1000001], :user/email "user1@gmail.com"}
{:db/id #db/id[:db.part/user -1000002], :user/username "JBIN0204"}
{:db/id #db/id[:db.part/user -1000003], :user/email "user2@gmail.com"}
{:db/id #db/id[:db.part/user -1000004], :user/username "Datomicfan"}
{:db/id #db/id[:db.part/user -1000005], :user/email "user3@gmail.com"}
{:db/id #db/id[:db.part/user -1000006], :user/username "Parenpower"}
{:db/id #db/id[:db.part/user -1000007], :user/email "user4@gmail.com"}
{:db/id #db/id[:db.part/user -1000008], :user/email "user5@gmail.com"}]
[{:db/valueType ":db.type/ref"
:db/isComponent true
:db/cardinality ":db.cardinality/one"
:db/doc "sub (Group)"
:db/ident :group/sub}
{:db/index true
:db/valueType ":db.type/double"
:db/cardinality ":db.cardinality/one"
:db/doc "a (ScalarDouble)"
:db/ident :scalarDouble/a}
{:db/index true
:db/valueType ":db.type/double"
:db/cardinality ":db.cardinality/one"
:db/doc "b (ScalarDouble)"
:db/ident :scalarDouble/b}
{:db/index true
:db/valueType ":db.type/double"
:db/cardinality ":db.cardinality/one"
:db/doc "c (ScalarDouble)"
:db/ident :scalarDouble/c}
{:db/valueType ":db.type/ref"
:db/isComponent true
:db/cardinality ":db.cardinality/one"
:db/doc "root (Group)"
:db/ident :group/root}
{:db/valueType ":db.type/ref"
:db/isComponent true
:db/cardinality ":db.cardinality/one"
:db/doc "inner (Group)"
:db/ident :group/inner}
]
[{:db/ident :user/email,
:db/valueType :db.type/string,
:db/cardinality :db.cardinality/one,
:db/doc "E-mail of user",
:db.install/_attribute :db.part/db,
:db/id #db/id[:db.part/db 250]}
{:db/ident :user/username,
:db/valueType :db.type/string,
:db/cardinality :db.cardinality/one,
:db/doc "Username of user",
:db.install/_attribute :db.part/db,
:db/id #db/id[:db.part/db 251]}]
[{:db/id "communities"
:db/ident :communities}
[:db/add :db.part/db :db.install/partition "communities"]]
[
;; a partition
{:db/id "a"
:db/ident :db.part/a}
[:db/add :db.part/db :db.install/partition "a"]
;; b partition
{:db/id "b"
:db/ident :db.part/b}
[:db/add :db.part/db :db.install/partition "b"]
]
;****How to Merge two attributes in Datomic.****
;
;Our database has recorded two attributes for a user. The user's e-mail and the users username.
;The username is required to be the e-mail for the user. Due to a design decision, e-mails will no longer
;be recorded. As such we need to depricate the e-mail attribute and merge it to our username attribute to ensure
;all e-mails represent usernames.
;
;The steps to this process are as follows:
;
;1. Rename the old attribute (i.e. :user/email to :user/email-deprecated)
;2. Make the new attribute (:user/username)
;3. Migrate values from the old attribute to the new attribute
;
;It should be noted that if you have a lot of data to merge you will want to appropriately batch the
;merge transactions. This is also not a solution for bad schema design and it should not be relied upon
;to correct what are in reality schema design problems. d/history will still point to the previous entry
; and :db/ident is not t-aware.
;
; Please see Stu's blog post http://blog.datomic.com/2017/01/the-ten-rules-of-schema-growth.html
(ns merge.core
(:import datomic.Util)
(require [datomic.api :as d]
[clojure.java.io :as io]))
;;Create the DB
(def db-uri "datomic:dev://localhost:4334/merge")
(d/create-database db-uri)
(def conn (d/connect db-uri))
;; slurp in the schema.edn file which contains:
;; [{:db/ident :user/email,
;; :db/valueType :db.type/string,
;; :db/cardinality :db.cardinality/one,
;; :db/doc "E-mail of user",
;; :db.install/_attribute :db.part/db,
;; :db/id #db/id[:db.part/db 250]}
;;{:db/ident :user/username,
;; :db/valueType :db.type/string,
;; :db/cardinality :db.cardinality/one,
;; :db/doc "Username of user",
;; :db.install/_attribute :db.part/db,
;; :db/id #db/id[:db.part/db 251]}]
(def schema-tx (read-string (slurp "/Users/jbin/Desktop/Jaret/Projects/workproof/merge/resources/schema.edn")))
@(d/transact conn schema-tx)
;; Pull the attributes I have inserted.
(d/pull (d/db conn) '[*] 250)
(d/pull (d/db conn) '[*] 251)
;;Transact some data against e-mails and usernames. We will then merge this data.
;;Here are the contents of Data.edn which will be slurped
;;
;;[{:db/id #db/id[:db.part/user -1000001], :user/email "user1@gmail.com"}
;; {:db/id #db/id[:db.part/user -1000002], :user/username "JBIN0204"}
;; {:db/id #db/id[:db.part/user -1000003], :user/email "user2@gmail.com"}
;; {:db/id #db/id[:db.part/user -1000004], :user/username "Datomicfan"}
;; {:db/id #db/id[:db.part/user -1000005], :user/email "user3@gmail.com"}
;; {:db/id #db/id[:db.part/user -1000006], :user/username "Parenpower"}
;; {:db/id #db/id[:db.part/user -1000007], :user/email "user4@gmail.com"}
;; {:db/id #db/id[:db.part/user -1000008], :user/email "user5@gmail.com"}]
(def test-data-tx (read-string (slurp "/Users/jbin/Desktop/Jaret/Projects/workproof/merge/resources/Data.edn")))
@(d/transact conn test-data-tx)
;;create alter email-depricated
(def db (d/db conn))
(def schema [{:db/id #db/id [:db.part/db 250],
:db/ident :user/email-deprecated,
:db.alter/_attribute :db.part/db}])
@(d/transact conn schema)
;;query all the emails and IDs
(d/q '[:find ?e ?email
:where [?e :user/email-deprecated ?email]] (d/db conn))
;; Move all e-mail-depricated to the username attribute
(def db (d/db conn))
(defn merge-all
"Merge all mapped results"
[db]
(->> (d/q '[:find ?e ?email
:where
[?e :user/email-deprecated ?email]]
db)
(mapcat (fn[[e email]]
[[:db/add e :user/username email]
[:db/retract e :user/email-deprecated email]]))
))
;;Call the function to merge-all
(merge-all db)
@(d/transact conn (merge-all db))
;; Review all usernames and note they are now merged under one attribute!
(def db (d/db conn) )
(d/q '[:find ?e ?email
:where [?e :user/username ?email]] (d/db conn))
;;This process can be applied when needing to implement :db/fulltext. But instead of altering existing
;;schema we need to add a new attribute and transact with fulltext enabled. We will then want to pour in
;;/import our data and use the new attribute going forward
;;Create the new username with fulltext attribute
(def db (d/db conn))
(def schema [{:db/ident :user/usernamefulltext,
:db/valueType :db.type/string,
:db/fulltext true,
:db/cardinality :db.cardinality/one,
:db/doc "username with fulltext search",
:db.install/_attribute :db.part/db,
:db/id #db/id[:db.part/db 252]}])
@(d/transact conn schema)
(d/pull (d/db conn) '[*] 252)
;;Next transact all usernames to the new usernamefulltext and retract the previous usernames:
(defn merge-all
"Merge all mapped results"
[db]
(->> (d/q '[:find ?e ?email
:where
[?e :user/username ?email]]
db)
(mapcat (fn[[e email]]
[[:db/add e :user/usernamefulltext email]
[:db/retract e :user/username email]]))
))
;;Call the function to merge-all and review
(merge-all db)
;;transact it
@(d/transact conn (merge-all db))
(def db (d/db conn) )
(d/q '[:find ?e ?email
:where [?e :user/usernamefulltext ?email]] (d/db conn))
(ns merge.errortesting)
;;Tests for Google group
@(d/transact conn [{:db/ident :user/conflict,
:db/valueType :db.type/string,
:db/cardinality :db.cardinality/one,
:db/unique :db.unique/identity
:db/doc "unique username",
:db.install/_attribute :db.part/db,
:db/id #db/id[:db.part/db 254]}])
@(d/transact conn [{:db/ident :user/lookup,
:db/valueType :db.type/ref,
:db/cardinality :db.cardinality/one,
:db/unique :db.unique/identity
:db/doc "ref",
:db.install/_attribute :db.part/db,
:db/id #db/id[:db.part/db 256]}])
;;Unique-conflict
(def conflict
[:db/add 17592186045447 :user/conflict "user5@gmail.com"])
(def conflict2
[:db/add 17592186045448 :user/conflict "user5@gmail.com"])
(def db (d/db conn))
@(d/transact conn [conflict])
@(d/transact conn [conflict2])
CompilerException java.util.concurrent.ExecutionException: java.lang.IllegalStateException: :db.error/unique-conflict Unique conflict: :user/conflict, value: user5@gmail.com already held by: 17592186045447 asserted for: 17592186045448, compiling:(/Users/jbin/Desktop/Jaret/Projects/merge/src/merge/core.clj:125:1)
;;lookup ref
(d/q '[:find ?e
:where
[?e :user/conflict "user5@gmail.com"]](d/db conn))
(d/q '[:find ?e
:where
[?e :user/conflict "user6@gmail.com"]](d/db conn))
(def conflict2
[[:db/add 17592186045447 :user/conflict "user5@gmail.com"]
[:db/add 17592186045446 :user/conflict "user6@gmail.com"]])
@(d/transact conn conflict2)
[{:db/id #db/id[:db.part/user]
:user/conflict "user5@gmail.com",
:user/lookup :blue}])
(def conflict2
[[:db/add [:user/conflict "user6@gmail.com" 1] :user/conflict "user5"]])
;;Wrong-type-for-attribute
(def wrongtype
[:db/add 17592186045449 :user/conflict 74])
@(d/transact conn [wrongtype])
CompilerException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: :db.error/wrong-type-for-attribute Value 74 is not a valid :string for attribute :user/conflict, compiling:(/Users/jbin/Desktop/Jaret/Projects/merge/src/merge/core.clj:133:1)
;;Datoms conflict assert and retract at same time e a with 2 different V's
(d/transact conn
[[:db/add 17592186045447 :user/conflict "user5@gmail.com"]
[:db/add 17592186045447 :user/conflict "user6@gmail.com"]])
(d/transact conn
[[:db/add 17592186045447 :user/conflict "user5@gmail.com"]
[:db/add 17592186045447 :user/conflict "user6@gmail.com"]])
=> #datomic.promise/settable-future/reify--6487[{:status :failed, :val #error {
:cause ":db.error/datoms-conflict Two datoms in the same transaction conflict\n{:d1\n [17592186045447 :user/conflict \"user5@gmail.com\" 13194139534353 true],\n :d2\n [17592186045447 :user/conflict \"user6@gmail.com\" 13194139534353 true]}\n"
(ns intlong.core
(:import datomic.Util)
(require [datomic.api :as d]
[clojure.java.io :as io]))
(def db-uri "datomic:free://localhost:4334/intlong")
(d/create-database db-uri)
(def conn (d/connect db-uri))
; Schema
; I placed this in intlong.edn file
(def test-data-tx (read-string (slurp "/Users/jbin/Desktop/Jaret/Projects/workproof/merge/resources/intlong.edn")))
@(d/transact conn test-data-tx)
; data:
(def db (d/db conn))
(def data [{:group/root
{:group/sub
{:group/inner {:scalarDouble/a 1.0, :scalarDouble/b 2.0, :scalarDouble/c 3.0}}
}}])
@(d/transact conn data)
; Rules
(def rules
'[
;base case
[(exists-path? (?to) ?from ?depth)
[(ground 1) ?depth]
[?v ?to _]
[_ ?from ?v]
[?from :db/valueType :db.type/ref]]
; recursive case
[(exists-path? (?to) ?from ?depth)
[?from :db/valueType :db.type/ref]
[_ ?from ?v]
[?v ?via _]
[?via :db/valueType :db.type/ref]
(exists-path? ?to ?via ?subDepth)
[(+ 1 ?subDepth) ?depth]]
])
; Query
(def db (d/db conn))
(d/q '[:find ?from ?d0 ?d1 ?d2
:in $ % ?e0 ?e1 ?e2
:where
(exists-path? ?e0 ?from ?d0)
(exists-path? ?e1 ?from ?d1)
(exists-path? ?e2 ?from ?d2)]
; Query params
db, rules, :scalarDouble/a, :scalarDouble/b, :scalarDouble/c)
(def result *1)
(into [] result)
(def result *1)
(type (second (nth result 2)))
long
(type (second (nth result 3)))
long
(= (last result) (nth result 2))
=> true
(= (last result) (nth result 3))
=> true
(= (nth result 2) (nth result 3))
=> true
(def rules1
'[
;base case
[(exists-path? (?to) ?from ?depth)
[(ground 1) ?depth]
[?v ?to _]
[_ ?from ?v]
[?from :db/valueType :db.type/ref]]
])
(d/q '[:find ?from ?d0 ?d1 ?d2
:in $ % ?e0 ?e1 ?e2
:where
(exists-path? ?e0 ?from ?d0)
(exists-path? ?e1 ?from ?d1)
(exists-path? ?e2 ?from ?d2)]
; Query params
db, rules1, :scalarDouble/a, :scalarDouble/b, :scalarDouble/c)
#{[68 1 1 1]}
(def rules2
'[[(exists-path? (?to) ?from ?depth)
[?from :db/valueType :db.type/ref]
[_ ?from ?v]
[?v ?via _]
[?via :db/valueType :db.type/ref]
(exists-path? ?to ?via ?subDepth)
[(+ 1 ?subDepth) ?depth]]])
(d/q '[:find ?from ?d0 ?d1 ?d2
:in $ % ?e0 ?e1 ?e2
:where
(exists-path? ?e0 ?from ?d0)
(exists-path? ?e1 ?from ?d1)
(exists-path? ?e2 ?from ?d2)]
; Query params
db, rules2, :scalarDouble/a, :scalarDouble/b, :scalarDouble/c)
(ns stringtemp.core
(:import datomic.Util)
(require [datomic.api :as d]
[clojure.java.io :as io]))
(def db-uri "datomic:dev://localhost:4334/stringtemp")
(d/create-database db-uri)
(def conn (d/connect db-uri))
(d/q '[:find ?e :where [?e]] [[(long 42)] [(int 42)]])
(d/q '[:find ?x
:where
[?e :db/valueType :db.type/ref]
(or
[?x ?e]
[?e ?x])]
(d/db conn))
(require '[datomic.api :as d])
;;google group discussion link https://groups.google.com/forum/#!topic/datomic/m6vSa6CjqjQ
(ns stringtemp.core
(:import datomic.Util)
(require [datomic.api :as d]
[clojure.java.io :as io]))
;;Create the DB
(def db-uri "datomic:dev://localhost:4334/stringtemp")
(d/create-database db-uri)
(def conn (d/connect db-uri))
;; Schema
;[{:db/ident :foo/name
; :db/valueType :db.type/string
; :db/cardinality :db.cardinality/one}
; {:db/ident :foo/ref
; :db/valueType :db.type/ref
; :db/cardinality :db.cardinality/one}
; {:db/ident :myAdd
; :db/fn #db/fn {:lang :clojure
; :params [db e a v]
; :code [[:db/add (:db/id (d/entity db e)) a v]]}}]
(def schema (read-string (slurp "/Users/jbin/Desktop/Jaret/Projects/workproof/merge/resources/stringschema.edn")))
@(d/transact conn schema)
(def schema [{:db/id "communities"
:db/ident :communities}
[:db/add :db.part/db :db.install/partition "communities"]])
@(d/transact conn schema)
@(d/transact conn
[{:db/id "communities"
:db/ident :communities}
[:db/add :db.part/db :db.install/partition "communities"]])
{:db/id (d/tempid :db.part/db),
:db/ident :communities,
:db.install/_partition :db.part/db}
;; The other examples are indirectly this.
@(d/transact conn
[[:db/add "a" :foo/name "x"]
[:db/add "b" :foo/name "y"]
[:db/add "a" :foo/ref "b"]]))
;; Works! Note that d/entity resolves tempid.
(let [a (d/tempid :db.part/user)]
@(d/transact conn
[[:db/add a :foo/name "x"]
[:db/add "b" :foo/name "y"]
[:myAdd a :foo/ref "b"]]))
;; Fails with :db.error/not-a-keyword.
@(d/transact conn
[[:db/add "a" :foo/name "x"]
[:db/add "b" :foo/name "y"]
[:myAdd "a" :foo/ref "b"]])
(def db (d/db conn))
(d/ident db -9223350046623220290)
;;-----Tests
(ns merge.TempID
(require [datomic.api :as d]
[clojure.java.io :as io]
[datomic.client :as client]
[clojure.core.async :refer (<!!)]))
;
;Some fantastic updates in Datomic 0.9.5530!
;However, the string tempids don't always seem to work for me.
;As a basic example, this transaction:
;
;[
;
; ;; a partition
; {:db/id "a"
; :db/ident :db.part/a}
; [:db/add :db.part/db :db.install/partition "a"]
;
; ;; b partition
; {:db/id "b"
; :db/ident :db.part/b}
; [:db/add :db.part/db :db.install/partition "b"]
;
; ]
;(slurp)ed from a file and sent through (read-string ...) and then into
;the transactor via (datomic.api/transact ...), throws the following exception:
(def db-uri "datomic:dev://localhost:4334/merge")
(d/create-database db-uri)
(def conn (d/connect db-uri))
conn
(def schema-tx (read-string (slurp "/Users/jbin/Desktop/Jaret/Projects/workproof/merge/resources/tempiddata.edn")))
@(d/transact conn schema-tx)
(use 'clojure.repl)
(pst)
(require '[clojure.core.async :refer (<!!)]
'[datomic.client :as client])
;bin/run -m datomic.peer-server -p 8998 -a myaccesskey,mysecret -d firstdb,datomic:dev://localhost:4334/merge
;Serving datomic:dev://localhost:4334/merge as firstdb
(def conn
(<!! (client/connect
{:db-name "firstdb"
:account-id client/PRO_ACCOUNT
:secret "mysecret"
:region "none"
:endpoint "localhost:8998"
:service "peer-server"
:access-key "myaccesskey"})))
conn
(<!! (client/transact conn {:tx-data [{:db/doc "hello world"}]}))
(def db (client/db conn))
(<!! (client/q conn {:query '[:find ?e :where [?e :db/doc "hello world"]]
:args [db]}))
(<!! (client/q conn {:query '[:find (count ?e) :where [?e :db/doc]]
:args [db]}))
(let [db (-> (client/with (<!! (client/with-db conn)) {:tx-data [{:db/ident :customer/name
:db/valueType :db.type/string
:db/cardinality :db.cardinality/one}]})
<!!
:db-after)
db2 (-> (client/with db {:tx-data [{:customer/name "John"}]})
<!!
:db-after)]
(<!! (client/q conn {:query '[:find ?c
:where [?c :customer/name _]]
:args [db2]})))
(ns testingpart.core
(:import datomic.Util)
(require [datomic.api :as d]
[clojure.java.io :as io]))
(def db-uri "datomic:dev://localhost:4334/mbrainz-1968-1973")
(d/create-database db-uri)
(def conn (d/connect db-uri))
@(d/transact conn [{:db/ident :user/conflict,
:db/valueType :db.type/string,
:db/cardinality :db.cardinality/one,
:db/unique :db.unique/identity
:db/doc "unique username",
:db.install/_attribute :db.part/db,
:db/id #db/id[:db.part/db 254]}])
@(d/transact conn [{:db/id #db/id[:db.part/db -1]
:db/ident :db.part/custom}
[:db/add :db.part/db :db.install/partition #db/id[:db.part/db -1]]])
@(d/transact conn [[:db/add 17592186045447 :user/conflict "user5@gmail.com"]])
@(d/transact conn [[:db/add 17592186045437 :user/conflict "user6@gmail.com"]])
(d/part 13194139663970)
(d/part 17592186045437)
(d/part 13194139663961)
3
(d/pull (d/db conn) '[*] 3)
(d/pull (d/db conn) '[*] 4)
(d/part 13194139663963)
(d/part 17592186045447)
(d/part 13194139663965)
(d/part 17592186045447)
(d/pull (d/db conn) '[*] 255)
(d/pull (d/db conn) '[*] 254)
(d/pull (d/db conn) '[*] 256)
--------REPL RESULTS--------------
@(d/transact conn [[:db/add 17592186045447 :user/conflict "user5@gmail.com"]])
=>
{:db-before datomic.db.Db,
@bb93fdd9 :db-after,
datomic.db.Db @e2392ec4,
:tx-data [#datom[13194139663961 50 #inst"2016-11-22T14:34:30.247-00:00" 13194139663961 true]
#datom[17592186045447 254 "user5@gmail.com" 13194139663961 true]],
:tempids {}}
(d/part 13194139663961)
=> 3
(d/pull (d/db conn) '[*] 3)
=>
{:db/id 3,
:db/ident :db.part/tx,
:db/doc "Partition used to store data about transactions. Transaction data always includes a :db/txInstant which is the transaction's timestamp, and can be extended to store other information at transaction granularity."}
(d/part 17592186045447)
=> 4
(d/pull (d/db conn) '[*] 4)
=>
{:db/id 4,
:db/ident :db.part/user,
:db/doc "Name of the user partition. The user partition is analogous to the default namespace in a programming language, and should be used as a temporary home for data during interactive development."}
#Leiningen
#Mon Jan 30 09:57:59 EST 2017
version=0.1.0-SNAPSHOT
groupId=merge
artifactId=merge
[{:dependencies {org.clojure/clojure {:vsn "1.8.0", :native-prefix nil}, net.spy/spymemcached {:vsn "2.11.4", :native-prefix nil}, org.apache.tomcat/tomcat-juli {:vsn "7.0.27", :native-prefix nil}, org.clojure/tools.cli {:vsn "0.3.5", :native-prefix nil}, org.slf4j/jcl-over-slf4j {:vsn "1.7.7", :native-prefix nil}, com.datomic/datomic-pro {:vsn "0.9.5554", :native-prefix nil}, com.h2database/h2 {:vsn "1.3.171", :native-prefix nil}, org.apache.johnzon/johnzon-core {:vsn "0.9.4", :native-prefix nil}, org.apache.activemq/artemis-commons {:vsn "1.4.0", :native-prefix nil}, org.apache.tomcat/tomcat-jdbc {:vsn "7.0.27", :native-prefix nil}, org.jboss.logging/jboss-logging {:vsn "3.3.0.Final", :native-prefix nil}, org.slf4j/jul-to-slf4j {:vsn "1.7.7", :native-prefix nil}, org.apache.httpcomponents/httpcore {:vsn "4.4.4", :native-prefix nil}, org.apache.geronimo.specs/geronimo-json_1.0_spec {:vsn "1.0-alpha-1", :native-prefix nil}, org.clojure/tools.nrepl {:vsn "0.2.12", :native-prefix nil}, commons-codec {:vsn "1.5", :native-prefix nil}, clojure-complete {:vsn "0.2.4", :native-prefix nil}, com.google.guava/guava {:vsn "18.0", :native-prefix nil}, org.slf4j/slf4j-nop {:vsn "1.7.7", :native-prefix nil}, org.fressian/fressian {:vsn "0.6.5", :native-prefix nil}, org.apache.httpcomponents/httpclient {:vsn "4.5.2", :native-prefix nil}, commons-beanutils {:vsn "1.9.2", :native-prefix nil}, org.codehaus.janino/commons-compiler {:vsn "2.6.1", :native-prefix nil}, org.apache.activemq/artemis-core-client {:vsn "1.4.0", :native-prefix nil}, org.slf4j/slf4j-api {:vsn "1.7.7", :native-prefix nil}, org.codehaus.janino/commons-compiler-jdk {:vsn "2.6.1", :native-prefix nil}, commons-collections {:vsn "3.2.1", :native-prefix nil}, io.netty/netty-all {:vsn "4.0.39.Final", :native-prefix nil}, org.slf4j/log4j-over-slf4j {:vsn "1.7.7", :native-prefix nil}, com.datomic/datomic-lucene-core {:vsn "3.3.0", :native-prefix nil}}, :native-path "target/base+system+user+dev/native"} {:native-path "target/base+system+user+dev/native", :dependencies {org.clojure/clojure {:vsn "1.8.0", :native-prefix nil, :native? false}, net.spy/spymemcached {:vsn "2.11.4", :native-prefix nil, :native? false}, org.apache.tomcat/tomcat-juli {:vsn "7.0.27", :native-prefix nil, :native? false}, org.clojure/tools.cli {:vsn "0.3.5", :native-prefix nil, :native? false}, org.slf4j/jcl-over-slf4j {:vsn "1.7.7", :native-prefix nil, :native? false}, com.datomic/datomic-pro {:vsn "0.9.5554", :native-prefix nil, :native? false}, com.h2database/h2 {:vsn "1.3.171", :native-prefix nil, :native? false}, org.apache.johnzon/johnzon-core {:vsn "0.9.4", :native-prefix nil, :native? false}, org.apache.activemq/artemis-commons {:vsn "1.4.0", :native-prefix nil, :native? false}, org.apache.tomcat/tomcat-jdbc {:vsn "7.0.27", :native-prefix nil, :native? false}, org.jboss.logging/jboss-logging {:vsn "3.3.0.Final", :native-prefix nil, :native? false}, org.slf4j/jul-to-slf4j {:vsn "1.7.7", :native-prefix nil, :native? false}, org.apache.httpcomponents/httpcore {:vsn "4.4.4", :native-prefix nil, :native? false}, org.apache.geronimo.specs/geronimo-json_1.0_spec {:vsn "1.0-alpha-1", :native-prefix nil, :native? false}, org.clojure/tools.nrepl {:vsn "0.2.12", :native-prefix nil, :native? false}, commons-codec {:vsn "1.5", :native-prefix nil, :native? false}, clojure-complete {:vsn "0.2.4", :native-prefix nil, :native? false}, com.google.guava/guava {:vsn "18.0", :native-prefix nil, :native? false}, org.slf4j/slf4j-nop {:vsn "1.7.7", :native-prefix nil, :native? false}, org.fressian/fressian {:vsn "0.6.5", :native-prefix nil, :native? false}, org.apache.httpcomponents/httpclient {:vsn "4.5.2", :native-prefix nil, :native? false}, commons-beanutils {:vsn "1.9.2", :native-prefix nil, :native? false}, org.codehaus.janino/commons-compiler {:vsn "2.6.1", :native-prefix nil, :native? false}, org.apache.activemq/artemis-core-client {:vsn "1.4.0", :native-prefix nil, :native? false}, org.slf4j/slf4j-api {:vsn "1.7.7", :native-prefix nil, :native? false}, org.codehaus.janino/commons-compiler-jdk {:vsn "2.6.1", :native-prefix nil, :native? false}, commons-collections {:vsn "3.2.1", :native-prefix nil, :native? false}, io.netty/netty-all {:vsn "4.0.39.Final", :native-prefix nil, :native? false}, org.slf4j/log4j-over-slf4j {:vsn "1.7.7", :native-prefix nil, :native? false}, com.datomic/datomic-lucene-core {:vsn "3.3.0", :native-prefix nil, :native? false}}}]
(ns merge.core-test
(:require [clojure.test :refer :all]
[merge.core :refer :all]))
(deftest a-test
(testing "FIXME, I fail."
(is (= 0 1))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment