~ubuntu-branches/ubuntu/trusty/rygel/trusty

« back to all changes in this revision

Viewing changes to src/plugins/tracker/rygel-tracker-query-triplet.vala

  • Committer: Package Import Robot
  • Author(s): Andreas Henriksson
  • Date: 2011-12-16 15:21:25 UTC
  • mfrom: (14.1.2 sid)
  • Revision ID: package-import@ubuntu.com-20111216152125-qgn31dkfmhouhrf0
Upload to unstable

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
 * Represents SPARQL Triplet
27
27
 */
28
28
public class Rygel.Tracker.QueryTriplet {
 
29
    public string graph;
29
30
    public string subject;
30
31
    public string predicate;
31
32
    public string obj;
33
34
    public QueryTriplet next;
34
35
 
35
36
    public QueryTriplet (string subject, string predicate, string obj) {
 
37
        this.graph = null;
36
38
        this.subject = subject;
37
39
        this.predicate = predicate;
38
40
        this.obj = obj;
39
41
    }
40
42
 
 
43
    public QueryTriplet.with_graph (string graph,
 
44
                                    string subject,
 
45
                                    string predicate,
 
46
                                    string object) {
 
47
        this.graph = graph;
 
48
        this.subject = subject;
 
49
        this.predicate = predicate;
 
50
        this.obj = object;
 
51
    }
 
52
 
41
53
    public QueryTriplet.chain (string       subject,
42
54
                               string       predicate,
43
55
                               QueryTriplet next) {
75
87
    public string to_string (bool include_subject = true) {
76
88
        string str = "";
77
89
 
 
90
        if (graph != null) {
 
91
            str += "GRAPH <%s> {".printf (this.graph);
 
92
        }
 
93
 
78
94
        if (include_subject) {
79
95
            str += " " + subject;
80
96
        }
87
103
            str += " " + this.obj;
88
104
        }
89
105
 
 
106
        if (graph != null) {
 
107
            str += "}";
 
108
        }
 
109
 
90
110
        return str;
91
111
    }
92
112
}