From 75e6d91da511384e076effa16537083ac971aaf8 Mon Sep 17 00:00:00 2001 From: Dimitri Yatsenko Date: Wed, 20 Sep 2017 16:55:51 -0500 Subject: [PATCH 1/9] minor message fix --- +dj/ERD.m | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/+dj/ERD.m b/+dj/ERD.m index c109c2e1..1608726c 100644 --- a/+dj/ERD.m +++ b/+dj/ERD.m @@ -75,7 +75,7 @@ case isnumeric(obj) n = length(ret.nodes); end otherwise - error 'invalid ERD difference' + error 'invalid ERD addition argument' end end @@ -99,11 +99,16 @@ case isnumeric(obj) n = length(ret.nodes); end otherwise - error 'invalid ERD difference' + error 'invalid ERD difference argument' end end + function display(self) + self.draw + end + + function draw(self) % draw the diagram From 4bc4102712695178b69560c4389c10fec07cb8db Mon Sep 17 00:00:00 2001 From: Dimitri Yatsenko Date: Tue, 11 Dec 2018 12:06:13 -0600 Subject: [PATCH 2/9] fix #138: correctly handle int64 and uint64 in restrictions --- +dj/+internal/GeneralRelvar.m | 8 +++++++- +dj/ERD.m | 3 ++- +dj/struct.m | 3 ++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/+dj/+internal/GeneralRelvar.m b/+dj/+internal/GeneralRelvar.m index d7d2a5bc..be241311 100644 --- a/+dj/+internal/GeneralRelvar.m +++ b/+dj/+internal/GeneralRelvar.m @@ -841,7 +841,13 @@ case isa(cond, 'dj.internal.GeneralRelvar') else assert((isnumeric(value) || islogical(value)) && isscalar(value), ... 'Value for key.%s must be a numeric scalar', field{1}); - value=sprintf('%1.16g', value); + if isa(value, 'uint64') + value = sprintf('%u', value); + elseif isa(value, 'int64') + value = sprintf('%i', value); + else + value = sprintf('%1.16g', value); + end end subcond = sprintf('%s AND `%s`=%s', subcond, field{1}, value); end diff --git a/+dj/ERD.m b/+dj/ERD.m index c109c2e1..6c48d06d 100644 --- a/+dj/ERD.m +++ b/+dj/ERD.m @@ -141,7 +141,8 @@ function draw(self) isPart = tiers(i)==6; fs = dj.set('erdFontSize')*(1 - 0.3*isPart); fc = isPart*0.3*[1 1 1]; - text(h.XData(i)+0.1,h.YData(i), self.conn.tableToClass(self.graph.Nodes.Name{i}), ... + name = self.conn.tableToClass(self.graph.Nodes.Name{i}); + text(h.XData(i)+0.1, h.YData(i), name, ... 'fontsize', fs, 'rotation', -16, 'color', fc, ... 'Interpreter', 'none'); end diff --git a/+dj/struct.m b/+dj/struct.m index 22bed5e4..67c6999c 100644 --- a/+dj/struct.m +++ b/+dj/struct.m @@ -142,6 +142,7 @@ function s = fromFields(s) % DJ.STRUCT.FROMFIELDS - construct a structure array from a % scalar structure whose fields contain same-sized arrays of values. + assert(isscalar(s) && isstruct(s), 'the input must be a scalar structure') fnames = fieldnames(s)'; lst = cell(1,length(fnames)*2); @@ -151,7 +152,7 @@ if isempty(v) lst{i*2}={}; else - if isnumeric(v) || islogical(v) + if isnumeric(v) || islogical(v) || isstring(v) lst{i*2} = num2cell(s.(fnames{i})); else lst{i*2} = s.(fnames{i}); From 0e6f6deb8a406d27516b1067ce07f4c9ef189f97 Mon Sep 17 00:00:00 2001 From: Dimitri Yatsenko Date: Thu, 13 Dec 2018 14:19:35 -0600 Subject: [PATCH 3/9] add transaction documentation for docs.datajoint.io --- .../manipulation/3-Transactions_lang1.rst | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 docs-parts/manipulation/3-Transactions_lang1.rst diff --git a/docs-parts/manipulation/3-Transactions_lang1.rst b/docs-parts/manipulation/3-Transactions_lang1.rst new file mode 100644 index 00000000..681ed21c --- /dev/null +++ b/docs-parts/manipulation/3-Transactions_lang1.rst @@ -0,0 +1,33 @@ +Transactions are formed using the methods `startTransaction`, `cancelTransaction`, and `commitTransaction` of a connection object. +A connection object may obtained from any table object. + +For example, the following code inserts mating entries for the master table `Session` and its part table `SessionExperimenter`. + +.. code-block:: matlab + + % get the connection object + session = Session + connection = session.conn + + % insert Session and Session.Experimenter entries in a transaction + connection.startTransaction + try + key.subject_id = animal_id; + key.session_time = session_time; + + session_entry = key; + session_entry.brain_region = region; + insert(Session, session_entry) + + experimenter_entry = key; + experimenter_entry.experimenter = username; + insert(SessionExperimenter, experiment_entry) + connection.commitTransaction + catch + connection.cancelTransaction + end + + +Here, to external observers, both inserts will take effect together only upon exiting from the `try-catch` block or will not have any effect at all. +For example, if the second insert fails due to an error, the first insert will be rolled back. + From 584f3ecaee2653f6323774ab07dd81942bfbc2f3 Mon Sep 17 00:00:00 2001 From: Dimitri Yatsenko Date: Thu, 13 Dec 2018 15:58:27 -0600 Subject: [PATCH 4/9] Add a reference explaning the temporary use of `makeTuples` rather than `make`: fix documentation issue 195 --- docs-parts/computation/01-autopopulate_lang1.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs-parts/computation/01-autopopulate_lang1.rst b/docs-parts/computation/01-autopopulate_lang1.rst index f2232ec6..ac0fbab0 100644 --- a/docs-parts/computation/01-autopopulate_lang1.rst +++ b/docs-parts/computation/01-autopopulate_lang1.rst @@ -17,3 +17,5 @@ end end end + +.. note:: Currently matlab uses ``makeTuples`` rather than ``make``. This will be fixed in an upcoming release: https://github.com/datajoint/datajoint-matlab/issues/141 From b35f9f2427fe5c034e078afbcbad43061de870a4 Mon Sep 17 00:00:00 2001 From: Dimitri Yatsenko Date: Thu, 13 Dec 2018 16:19:10 -0600 Subject: [PATCH 5/9] Docs: Improve description of the `make` method --- docs-parts/computation/01-autopopulate_lang1.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs-parts/computation/01-autopopulate_lang1.rst b/docs-parts/computation/01-autopopulate_lang1.rst index ac0fbab0..6ecbf940 100644 --- a/docs-parts/computation/01-autopopulate_lang1.rst +++ b/docs-parts/computation/01-autopopulate_lang1.rst @@ -19,3 +19,5 @@ end .. note:: Currently matlab uses ``makeTuples`` rather than ``make``. This will be fixed in an upcoming release: https://github.com/datajoint/datajoint-matlab/issues/141 + +The ``make`` method receives one argument: the struct ``key`` containing the primary key value of an element of :ref:`key source ` to be worked on. From 8858da5c682738b148eefe6588f3918d7fa72166 Mon Sep 17 00:00:00 2001 From: Dimitri Yatsenko Date: Thu, 13 Dec 2018 16:45:38 -0600 Subject: [PATCH 6/9] docs: begin Release Notes --- docs-parts/intro/Releases_lang1.rst | 4 ++++ docs-parts/intro/empty.txt | 0 2 files changed, 4 insertions(+) create mode 100644 docs-parts/intro/Releases_lang1.rst delete mode 100644 docs-parts/intro/empty.txt diff --git a/docs-parts/intro/Releases_lang1.rst b/docs-parts/intro/Releases_lang1.rst new file mode 100644 index 00000000..b1a13d29 --- /dev/null +++ b/docs-parts/intro/Releases_lang1.rst @@ -0,0 +1,4 @@ +Release Notes +============= + +Start of Release Notes diff --git a/docs-parts/intro/empty.txt b/docs-parts/intro/empty.txt deleted file mode 100644 index e69de29b..00000000 From 5e6650c58a7d564b3e71dc001edb6411bd55aca7 Mon Sep 17 00:00:00 2001 From: Dimitri Yatsenko Date: Thu, 13 Dec 2018 17:11:16 -0600 Subject: [PATCH 7/9] docs: improve release notes --- docs-parts/intro/Releases_lang1.rst | 3 --- 1 file changed, 3 deletions(-) diff --git a/docs-parts/intro/Releases_lang1.rst b/docs-parts/intro/Releases_lang1.rst index b1a13d29..45b878b6 100644 --- a/docs-parts/intro/Releases_lang1.rst +++ b/docs-parts/intro/Releases_lang1.rst @@ -1,4 +1 @@ -Release Notes -============= - Start of Release Notes From 7196e1d75a3daa03ee12e9ec2aecc949be52931c Mon Sep 17 00:00:00 2001 From: Dimitri Yatsenko Date: Sat, 15 Dec 2018 18:07:19 -0600 Subject: [PATCH 8/9] docs: correct documentation on transactions based on code review --- docs-parts/manipulation/3-Transactions_lang1.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs-parts/manipulation/3-Transactions_lang1.rst b/docs-parts/manipulation/3-Transactions_lang1.rst index 681ed21c..91d45f2d 100644 --- a/docs-parts/manipulation/3-Transactions_lang1.rst +++ b/docs-parts/manipulation/3-Transactions_lang1.rst @@ -1,7 +1,7 @@ -Transactions are formed using the methods `startTransaction`, `cancelTransaction`, and `commitTransaction` of a connection object. +Transactions are formed using the methods ``startTransaction``, ``cancelTransaction``, and ``commitTransaction`` of a connection object. A connection object may obtained from any table object. -For example, the following code inserts mating entries for the master table `Session` and its part table `SessionExperimenter`. +For example, the following code inserts mating entries for the master table ``Session`` and its part table ``SessionExperimenter``. .. code-block:: matlab @@ -28,6 +28,6 @@ For example, the following code inserts mating entries for the master table `Ses end -Here, to external observers, both inserts will take effect together only upon exiting from the `try-catch` block or will not have any effect at all. +Here, to external observers, both inserts will take effect together only upon exiting from the ``try-catch`` block or will not have any effect at all. For example, if the second insert fails due to an error, the first insert will be rolled back. From 46eb81fc04f7af5fa6b11dd370c7dbb99ba00b67 Mon Sep 17 00:00:00 2001 From: Austin Hilberg <40366950+austin-hilberg@users.noreply.github.com> Date: Mon, 17 Dec 2018 08:04:22 -0600 Subject: [PATCH 9/9] Update 3-Transactions_lang1.rst 'mating' to 'matching' --- docs-parts/manipulation/3-Transactions_lang1.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs-parts/manipulation/3-Transactions_lang1.rst b/docs-parts/manipulation/3-Transactions_lang1.rst index 91d45f2d..655f9741 100644 --- a/docs-parts/manipulation/3-Transactions_lang1.rst +++ b/docs-parts/manipulation/3-Transactions_lang1.rst @@ -1,7 +1,7 @@ Transactions are formed using the methods ``startTransaction``, ``cancelTransaction``, and ``commitTransaction`` of a connection object. A connection object may obtained from any table object. -For example, the following code inserts mating entries for the master table ``Session`` and its part table ``SessionExperimenter``. +For example, the following code inserts matching entries for the master table ``Session`` and its part table ``SessionExperimenter``. .. code-block:: matlab