emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/triples fed7932d97 09/10: Fix for issue where schema ad


From: ELPA Syncer
Subject: [elpa] externals/triples fed7932d97 09/10: Fix for issue where schema additions would overwrite existing data.
Date: Sat, 10 Jun 2023 13:00:11 -0400 (EDT)

branch: externals/triples
commit fed7932d97eee0ea2fabbc79dabb523b765702a4
Author: Andrew Hyatt <ahyatt@gmail.com>
Commit: Andrew Hyatt <ahyatt@gmail.com>

    Fix for issue where schema additions would overwrite existing data.
    
    See https://github.com/ahyatt/ekg/discussions/72 for discussion of bug 
caused by this.
---
 NEWS.org        |  1 +
 triples-test.el | 10 +++++++++-
 triples.el      |  2 +-
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/NEWS.org b/NEWS.org
index 35bee9ae6e..ffc8e7656c 100644
--- a/NEWS.org
+++ b/NEWS.org
@@ -2,6 +2,7 @@ TITLE: Changelog for the triples module for GNU Emacs.
 
 * 0.3
 - All integers are stored as integers, and not strings.  Applications using 
this library in previous versions should have users run 
~triples-upgrade-to-0.3~.
+- Fix for issue where adding schema would overwrite non-schema data on the 
same subject.
 * 0.2.7
 - Add new function =triples-db-select-pred-op=, which allows querying among 
predicates for objects with a certain relationship to values, replaces 
=triples-db-select-predicate-object-fragment=.
 - Add ability to store cons types (basically lists) as values.
diff --git a/triples-test.el b/triples-test.el
index 1e45130287..ed2008b48b 100644
--- a/triples-test.el
+++ b/triples-test.el
@@ -244,7 +244,7 @@ easily debug into it.")
             '(locale :base/unique t)
             'alternate-names
             '(nicknames :base/unique nil))
-           '(replace-subject
+           '(replace-subject-type
              .
              ((named base/type schema)
               (named schema/property name)
@@ -464,6 +464,14 @@ easily debug into it.")
     (triples-set-subject db 123 '(named :name ("Foo" "Foo")))
     (should (= 1 (length (triples-subjects-with-predicate-object db 
'named/name "Foo"))))))
 
+(ert-deftest triples-test-schema-and-data-with-same-subject ()
+  (triples-test-with-temp-db
+   (triples-add-schema db 'foo '(bar))
+   (triples-set-subject db 'foo '(foo :bar "baz"))
+   (should (equal "baz" (plist-get (triples-get-subject db 'foo) :foo/bar)))
+   (triples-add-schema db 'foo '(bar))
+   (should (equal "baz" (plist-get (triples-get-subject db 'foo) :foo/bar)))))
+
 (ert-deftest triples-readme ()
   (triples-test-with-temp-db
     (triples-add-schema db 'person
diff --git a/triples.el b/triples.el
index fdb083da53..1b32e5970e 100644
--- a/triples.el
+++ b/triples.el
@@ -447,7 +447,7 @@ definitions."
 PROPS is a list of either property symbols, or lists of
 properties of the type and the meta-properties associated with
 them."
-  (cons 'replace-subject
+  (cons 'replace-subject-type
         (cons `(,type base/type schema)
               (cl-loop for p in props
                        nconc



reply via email to

[Prev in Thread] Current Thread [Next in Thread]