[polari/wip/carlosg/tracker: 435/445] data: Change ActionMessage to be a property




commit e6bcb59695dfceb146c7e376bd7c1ef6fcb9b925
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 a5f142fb..6d8da96b 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 b37616a0..bc59bb74 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 6ea42718..a5297f26 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]