branch: externals/triples
commit 7d5aca3bb862c364420a6e4d32805b4e96085408
Author: Andrew Hyatt <ahy...@gmail.com>
Commit: Andrew Hyatt <ahy...@gmail.com>

    Fix issue where single element lists were not being treated as lists.
---
 triples-test.el | 7 +++++++
 triples.el      | 2 +-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/triples-test.el b/triples-test.el
index 9689a9e65e..f539727cd8 100644
--- a/triples-test.el
+++ b/triples-test.el
@@ -117,6 +117,13 @@ easily debug into it.")
     (triples-delete-subject db "foo")
     (should-not (triples-get-subject db "foo"))))
 
+(ert-deftest triples-single-element ()
+  (triples-test-with-temp-db
+   (triples-add-schema db 'named 'name)
+   (triples-set-type db "foo" 'named :name '("Name"))
+   (should (equal '(:name ("Name"))
+                  (triples-get-type db "foo" 'named)))))
+
 (ert-deftest triples-reversed ()
   (triples-test-with-temp-db
    (triples-add-schema db 'named
diff --git a/triples.el b/triples.el
index e8c95dd75e..66d2c994b7 100644
--- a/triples.el
+++ b/triples.el
@@ -194,7 +194,7 @@ PROPERTIES is a plist of properties, without TYPE prefixes."
     (append
      (cl-loop for k being the hash-keys of preds using (hash-values v)
               nconc (list (triples--encolon (cdr 
(triples--combined-to-type-and-prop k)))
-                          (if (and (cdr v)
+                          (if (and (car v)
                                    (plist-get (cdar v) :index))
                               (mapcar #'car (sort v (lambda (a b)
                                                       (< (plist-get (cdr a) 
:index)

Reply via email to