Skip to content

Commit

Permalink
Merge pull request #47 from CBIIT/sts-related-updates
Browse files Browse the repository at this point in the history
Sts related updates
  • Loading branch information
majensen committed Jul 25, 2023
2 parents 285385e + 3599152 commit c6a50e0
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 40 deletions.
6 changes: 3 additions & 3 deletions cypher/mdb-indexes.4.4.cypher
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ create fulltext index termValueDefn for (t:term) on each [t.value, t.origin_defi

create fulltext index tagKeyValue for (g:tag) on each [g.key, g.value];

create fulltext index nodeHandle on (n:node) on each [n.handle];
create fulltext index edgeHandle on (n:relationship) on each [n.handle];
create fulltext index propHandle on (n:property) on each [n.handle];
create fulltext index nodeHandle for (n:node) on each [n.handle];
create fulltext index edgeHandle for (n:relationship) on each [n.handle];
create fulltext index propHandle for (n:property) on each [n.handle];


4 changes: 2 additions & 2 deletions docs/_modules/bento_meta/mdb/mdb.html
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,8 @@ <h1>Source code for bento_meta.mdb.mdb</h1><div class="highlight"><pre>
<span class="n">qry</span> <span class="o">=</span> <span class="p">(</span>
<span class="s2">&quot;match (t:term {nanoid:$nanoid}) &quot;</span>
<span class="s2">&quot;where not exists(t._to) &quot;</span>
<span class="s2">&quot;with t &quot;</span>
<span class="s2">&quot;optional match (t)-[:has_origin]-&gt;(o:origin) &quot;</span>
<span class="s2">&quot;with t, t.origin_name as origin_name &quot;</span>
<span class="s2">&quot;optional match (o:origin {name: origin_name}) &quot;</span>
<span class="s2">&quot;where not exists(o._to) &quot;</span>
<span class="s2">&quot;return t as term, o as origin &quot;</span>
<span class="p">)</span>
Expand Down
46 changes: 23 additions & 23 deletions docs/_modules/bento_meta/object_map.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/_sources/mdb-conventions.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ _______________________________________________

For integration with the STS, and for performance, the Neo4j instance
of an MDB requires certain indexes to be established. These are
specified in `these Cypher statements <githubref>`_. The primary
specified in `these Cypher statements <https://github.com/CBIIT/bento-mdb/blob/main/changelogs/mdb_setup_changelog.xml>`_. The primary
requirement is that fulltext, Lucene-based indexes should be created
on entity ``description`` and Term ``origin_definition`` properties to
enable "search box" like queries over the the entire graph. Regular
Expand Down Expand Up @@ -120,7 +120,7 @@ on `Cypher <https://neo4j.com/docs/cypher-manual/current/>`_.)

* *Concept*: For any `(c:concept)` and `(k:concept)` where `(n)--(c)` and `(n)--(k)` return exactly the same graph nodes `[n1, n2, ...]`, one of `c` or `k` should be removed from the database.

* *Tag*: For two tag nodes, all of whose properties except nanoid are identical in key and value, and which are linked to exactly the same graph nodes, one must be removed.
* *Tag*: Any node should have *at most one* Tag node with a given pair of values for `key` and `value` properties. Tags should attach to at most one node; that is, the `()-[:has_tag]->(:tag)` relationship is one-to-many, not many-to-many. Practically, this means that to use Tags to group a set of different nodes with a key-value pair, a separate Tag with that key-value pair should be created and linked to each nodes.

* *Nanoid*: Each unique unversioned graph node as defined above must have a unique nanoid.

Expand Down
4 changes: 2 additions & 2 deletions docs/mdb-conventions.html
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ <h2>MDB entity properties required for consistency<a class="headerlink" href="#m
<h2>MDB indexes needed for additional functionality<a class="headerlink" href="#mdb-indexes-needed-for-additional-functionality" title="Permalink to this heading"></a></h2>
<p>For integration with the STS, and for performance, the Neo4j instance
of an MDB requires certain indexes to be established. These are
specified in <a class="reference external" href="githubref">these Cypher statements</a>. The primary
specified in <a class="reference external" href="https://github.com/CBIIT/bento-mdb/blob/main/changelogs/mdb_setup_changelog.xml">these Cypher statements</a>. The primary
requirement is that fulltext, Lucene-based indexes should be created
on entity <code class="docutils literal notranslate"><span class="pre">description</span></code> and Term <code class="docutils literal notranslate"><span class="pre">origin_definition</span></code> properties to
enable “search box” like queries over the the entire graph. Regular
Expand Down Expand Up @@ -200,7 +200,7 @@ <h3>Uniqueness and Existence of Entities<a class="headerlink" href="#uniqueness-
<li><p><em>Value Set</em>: For <cite>(p:property)</cite> with <cite>p.value_domain == “value_set”</cite>, then one and only one value_set <cite>v</cite> with <cite>(p)-[:has_value_set]-&gt;(v:value_set)</cite> must exist.</p></li>
<li><p><em>Term</em>: For a term <cite>(t:term)</cite>, only one graph node with <cite>[t.origin_name, t.origin_id, t.origin_version]</cite> may exist, <em>even in a versioned MDB</em>.</p></li>
<li><p><em>Concept</em>: For any <cite>(c:concept)</cite> and <cite>(k:concept)</cite> where <cite>(n)–(c)</cite> and <cite>(n)–(k)</cite> return exactly the same graph nodes <cite>[n1, n2, …]</cite>, one of <cite>c</cite> or <cite>k</cite> should be removed from the database.</p></li>
<li><p><em>Tag</em>: For two tag nodes, all of whose properties except nanoid are identical in key and value, and which are linked to exactly the same graph nodes, one must be removed.</p></li>
<li><p><em>Tag</em>: Any node should have <em>at most one</em> Tag node with a given pair of values for <cite>key</cite> and <cite>value</cite> properties. Tags should attach to at most one node; that is, the <cite>()-[:has_tag]-&gt;(:tag)</cite> relationship is one-to-many, not many-to-many. Practically, this means that to use Tags to group a set of different nodes with a key-value pair, a separate Tag with that key-value pair should be created and linked to each nodes.</p></li>
<li><p><em>Nanoid</em>: Each unique unversioned graph node as defined above must have a unique nanoid.</p>
<ul>
<li><p>The nanoid <em>shall not change</em> when a graph node is updated, provided above conditions remain satisfied upon update.</p></li>
Expand Down
2 changes: 1 addition & 1 deletion docs/searchindex.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions python/docs/mdb-conventions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ _______________________________________________

For integration with the STS, and for performance, the Neo4j instance
of an MDB requires certain indexes to be established. These are
specified in `these Cypher statements <githubref>`_. The primary
specified in `these Cypher statements <https://github.com/CBIIT/bento-mdb/blob/main/changelogs/mdb_setup_changelog.xml>`_. The primary
requirement is that fulltext, Lucene-based indexes should be created
on entity ``description`` and Term ``origin_definition`` properties to
enable "search box" like queries over the the entire graph. Regular
Expand Down Expand Up @@ -120,7 +120,7 @@ on `Cypher <https://neo4j.com/docs/cypher-manual/current/>`_.)

* *Concept*: For any `(c:concept)` and `(k:concept)` where `(n)--(c)` and `(n)--(k)` return exactly the same graph nodes `[n1, n2, ...]`, one of `c` or `k` should be removed from the database.

* *Tag*: For two tag nodes, all of whose properties except nanoid are identical in key and value, and which are linked to exactly the same graph nodes, one must be removed.
* *Tag*: Any node should have *at most one* Tag node with a given pair of values for `key` and `value` properties. Tags should attach to at most one node; that is, the `()-[:has_tag]->(:tag)` relationship is one-to-many, not many-to-many. Practically, this means that to use Tags to group a set of different nodes with a key-value pair, a separate Tag with that key-value pair should be created and linked to each nodes.

* *Nanoid*: Each unique unversioned graph node as defined above must have a unique nanoid.

Expand Down
4 changes: 2 additions & 2 deletions python/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "bento-meta"
version = "0.2.2"
version = "0.2.3"
description = "Python drivers for Bento Metamodel Database"
authors = [
{ name="Mark A. Jensen", email = "mark.jensen@nih.gov"},
Expand All @@ -20,7 +20,7 @@ classifiers = [

[tool.poetry]
name = "bento-meta"
version = "0.2.2"
version = "0.2.3"
description = "Python drivers for Bento Metamodel Database"
authors = [
"Mark A. Jensen <mark.jensen@nih.gov>",
Expand Down
4 changes: 2 additions & 2 deletions python/src/bento_meta/mdb/mdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,8 @@ def get_term_by_id(self, nanoid):
qry = (
"match (t:term {nanoid:$nanoid}) "
"where not exists(t._to) "
"with t "
"optional match (t)-[:has_origin]->(o:origin) "
"with t, t.origin_name as origin_name "
"optional match (o:origin {name: origin_name}) "
"where not exists(o._to) "
"return t as term, o as origin "
)
Expand Down
3 changes: 2 additions & 1 deletion python/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ deps = pytest
docker-compose
pytest-docker
commands =
pytest
pytest -m "not slow"


0 comments on commit c6a50e0

Please sign in to comment.