[polari/wip/carlosg/tracker: 10/13] data: Change ActionMessage to be a property



commit 0892180afc42371bcf07bd98a761bafaaa38ef87
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sun Feb 24 23:16:24 2019 +0100

    data: Change ActionMessage to be a property
    
    Instead of a subclass. This avoids joins of huge tables in order
    to resolve whether a message is an action message.

 data/resources/polari.ontology | 7 ++++---
 src/lib/polari-message.c       | 6 +++---
 src/logger.js                  | 2 +-
 3 files changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/data/resources/polari.ontology b/data/resources/polari.ontology
index a5f142f..6d8da96 100644
--- a/data/resources/polari.ontology
+++ b/data/resources/polari.ontology
@@ -85,6 +85,7 @@ polari:text a rdf:Property ;
             rdfs:range xsd:string ;
             tracker:fulltextIndexed true .
 
-
-polari:ActionMessage a rdfs:Class ;
-                     rdfs:subClassOf polari:Message .
+polari:isAction a rdf:Property ;
+            nrl:maxCardinality 1 ;
+            rdfs:domain polari:Message ;
+            rdfs:range xsd:boolean .
diff --git a/src/lib/polari-message.c b/src/lib/polari-message.c
index b37616a..bc59bb7 100644
--- a/src/lib/polari-message.c
+++ b/src/lib/polari-message.c
@@ -206,10 +206,10 @@ polari_message_to_tracker_resource (PolariMessage *message,
 
   res = tracker_resource_new (NULL);
 
+  tracker_resource_set_uri (res, "rdf:type", "polari:Message");
+
   if (polari_message_is_action (message))
-    tracker_resource_set_uri (res, "rdf:type", "polari:ActionMessage");
-  else
-    tracker_resource_set_uri (res, "rdf:type", "polari:Message");
+    tracker_resource_set_boolean (res, "polari:isAction", TRUE);
 
   time = g_date_time_format (polari_message_get_time (message), "%FT%H:%M:%S");
   tracker_resource_set_string (res, "polari:time", time);
diff --git a/src/logger.js b/src/logger.js
index 80f90e8..fd4287b 100644
--- a/src/logger.js
+++ b/src/logger.js
@@ -151,7 +151,7 @@ var LogWalker = class {
                 select polari:text(?msg) as ?text
                        polari:nick(?sender) as ?sender
                        ?time
-                       (exists { ?msg a polari:ActionMessage }) as ?isAction
+                       polari:isAction(?msg) as ?isAction
                        (exists { ?sender a polari:SelfContact }) as ?isSelf
                 { ?msg a polari:Message;
                        polari:time ?time;


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