Syndication

statement.h
1/*
2 This file is part of the syndication library
3 SPDX-FileCopyrightText: 2006 Frank Osterfeld <osterfeld@kde.org>
4
5 SPDX-License-Identifier: LGPL-2.0-or-later
6*/
7
8#ifndef SYNDICATION_RDF_STATEMENT_H
9#define SYNDICATION_RDF_STATEMENT_H
10
11#include <syndication/rdf/property.h>
12
13class QString;
14
15namespace Syndication
16{
17namespace RDF
18{
19//@cond PRIVATE
20class Statement;
21typedef QSharedPointer<Statement> StatementPtr;
22//@endcond
23
24/**
25 * An RDF statement, consisting of a triple
26 * (subject, predicate, object).
27 */
29{
30 friend class Model;
31
32public:
33 /**
34 * creates a null statement
35 */
36 Statement();
37
38 /**
39 * creates a copy of another statement
40 *
41 * @param other the statement to copy
42 */
43 Statement(const Statement &other);
44
45 /**
46 * creates a statement
47 * Do not call this in your code, use Model::createStatement() instead.
48 *
49 * @param subject the subject resource of the statement
50 * @param predicate the predicate of the statement
51 * @param object the object node of the statement
52 */
54
55 /**
56 * destructor
57 */
58 virtual ~Statement();
59
60 /**
61 * assigns another statement
62 *
63 * @param other the statement to assign
64 */
65 Statement &operator=(const Statement &other);
66
67 /**
68 * returns whether two statements are equal.
69 * Currently statements are equal, if they are from the same model (!)
70 * and subject, predicate and object are equal.
71 *
72 * @param other the statement to compare to
73 */
74 virtual bool operator==(const Statement &other) const;
75
76 /**
77 * returns whether this statement is a null statement (i.e. was created
78 * using Statement())
79 */
80 virtual bool isNull() const;
81
82 /**
83 * the subject of the statement.
84 */
85 virtual ResourcePtr subject() const;
86
87 /**
88 * the predicate of the statement
89 */
90 virtual PropertyPtr predicate() const;
91
92 /**
93 * the object of the statement
94 */
95 virtual NodePtr object() const;
96
97 /**
98 * returns the object of this statement as resource, if possible.
99 *
100 * @return the object node as Resource, or @c null if the object
101 * is not a resource
102 */
103 virtual ResourcePtr asResource() const;
104
105 /**
106 * returns the object of this statement as string, if possible.
107 *
108 * @return the literal text as QString, or a null string if the object
109 * is not a literal
110 */
111 virtual QString asString() const;
112
113private:
114 class StatementPrivate;
116};
117
118} // namespace RDF
119} // namespace Syndication
120
121#endif // SYNDICATION_RDF_STATEMENT_H
An RDF model, a set of RDF statements.
Definition model.h:37
An RDF statement, consisting of a triple (subject, predicate, object).
Definition statement.h:29
virtual QString asString() const
returns the object of this statement as string, if possible.
virtual ~Statement()
destructor
Definition statement.cpp:59
virtual bool isNull() const
returns whether this statement is a null statement (i.e.
Definition statement.cpp:78
Statement & operator=(const Statement &other)
assigns another statement
Definition statement.cpp:63
virtual ResourcePtr subject() const
the subject of the statement.
Definition statement.cpp:83
virtual NodePtr object() const
the object of the statement
Definition statement.cpp:95
Statement()
creates a null statement
Definition statement.cpp:37
virtual PropertyPtr predicate() const
the predicate of the statement
Definition statement.cpp:89
virtual ResourcePtr asResource() const
returns the object of this statement as resource, if possible.
virtual bool operator==(const Statement &other) const
returns whether two statements are equal.
Definition statement.cpp:69
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:09:18 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.