[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
- [elpa] externals/triples updated (33d78d828e -> 192da8373e), ELPA Syncer, 2023/06/10
- [elpa] externals/triples 45dc57703a 01/10: Fix emacsql/buit-in sqlite incompatibility, ELPA Syncer, 2023/06/10
- [elpa] externals/triples fed7932d97 09/10: Fix for issue where schema additions would overwrite existing data.,
ELPA Syncer <=
- [elpa] externals/triples a6cea08612 02/10: Test a variety of subject types for emacsql/builtin compatibility, ELPA Syncer, 2023/06/10
- [elpa] externals/triples d04bc2f564 05/10: Correct README reference to triples-with-predicate-object, ELPA Syncer, 2023/06/10
- [elpa] externals/triples de8867e079 07/10: Fix more fundamental differences between sqlite and emacsql, ELPA Syncer, 2023/06/10
- [elpa] externals/triples 2465cbbc7f 04/10: Update copyright to 2023, ELPA Syncer, 2023/06/10
- [elpa] externals/triples 668363c6e7 03/10: Provide triples-upgrade-to-0.3 for builtin sqlite users, ELPA Syncer, 2023/06/10
- [elpa] externals/triples 28d497ff23 06/10: Fix mangled test, triples-readme, ELPA Syncer, 2023/06/10
- [elpa] externals/triples a8dd90ce9a 08/10: Remove leftover development-only function in triples-upgrade, ELPA Syncer, 2023/06/10
- [elpa] externals/triples 192da8373e 10/10: Change text in README saying triples package is very new, ELPA Syncer, 2023/06/10