/usr/include/lv2-c++-tools/rdf.hpp is in libpaq-dev 1.0.5-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | /****************************************************************************
rdf.hpp - Data structures for RDF data
Copyright (C) 2006-2007 Lars Luthman <lars.luthman@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 01222-1307 USA
****************************************************************************/
#ifndef RDF_HPP
#define RDF_HPP
#include <iostream>
#include <map>
#include <set>
#include <sstream>
#include <string>
#include <vector>
namespace PAQ {
struct Triple;
struct RDFTerm;
/** A Variable is an object that can be bound to an RDF resource. */
struct Variable {
static Variable nil;
};
/** A Namespace is a class that works as a Turtle URI prefix. */
class Namespace {
public:
/** Create a namespace for the prefix @c str. */
Namespace(const std::string& str);
/** Return the expanded URI for the qname @c PREFIX:str where @c PREFIX
is the constructor parameter for this Namespace object. */
std::string operator()(const std::string& str);
protected:
std::string m_prefix;
};
/** Compare two RDFTerm objects for equality. */
struct RDFTermCompare {
bool operator()(const RDFTerm* a, const RDFTerm* b);
};
/** An RDFTerm is a node or edge in an RDF graph. */
struct RDFTerm {
enum Type {
URIRef,
Literal,
BNode,
Variable
};
/** Create a new RDFTerm with the type @c t, the name @c n, and the
RDF datatype @c d. */
RDFTerm(Type t, const std::string& n = "", RDFTerm* d = 0);
virtual ~RDFTerm();
/** Return the numeric value of this term. */
double get_numeric_value() const;
Type type;
std::string name;
RDFTerm* datatype;
std::string lang;
typedef std::map<RDFTerm*, std::set<RDFTerm*> > tmap;
tmap s_triples_;
tmap o_triples_;
size_t index;
};
/** A RDFVariable is a term type that can be used for variables in query
patterns. */
struct RDFVariable : public RDFTerm {
RDFVariable();
};
/** This class represents a single RDF triple. */
struct Triple {
Triple(RDFTerm* s, RDFTerm* p, RDFTerm* o);
RDFTerm* subject;
RDFTerm* predicate;
RDFTerm* object;
};
/** This class holds a RDF dataset. */
struct RDFData {
/** Create a new emtpy dataset. */
RDFData();
~RDFData();
/** Add an URI reference to the dataset. */
RDFTerm* add_uriref(const std::string& name);
/** Add a blank node to the dataset. */
RDFTerm* add_bnode(const std::string& name = "");
/** Add a literal to the dataset. */
RDFTerm* add_literal(const std::string& name, RDFTerm* datatype = 0);
/** Add an unbound variable node to the dataset. */
RDFTerm* add_variable(PAQ::Variable* var);
/** Add a new triple to the dataset. */
void add_triple(RDFTerm* subject, RDFTerm* predicate, RDFTerm* object);
const std::vector<RDFTerm*>& get_terms() const;
std::map<std::string, RDFTerm*> urirefs;
std::map<std::string, RDFTerm*> literals;
std::map<std::string, RDFTerm*> bnodes;
std::map<PAQ::Variable*, RDFTerm*> variables;
std::vector<RDFTerm*> terms;
std::vector<Triple*> triples;
unsigned long bnode_counter;
};
}
#endif
|