sord.h   sord.h 
skipping to change at line 160 skipping to change at line 160
sord_world_new(void); sord_world_new(void);
/** /**
Free @c world. Free @c world.
*/ */
SORD_API SORD_API
void void
sord_world_free(SordWorld* world); sord_world_free(SordWorld* world);
/** /**
Set a function to be called when errors occur.
The @p error_sink will be called with @p handle as its first argument.
If
no error function is set, errors are printed to stderr.
*/
SORD_API
void
sord_world_set_error_sink(SordWorld* world,
SerdErrorSink error_sink,
void* handle);
/**
@} @}
@name Node @name Node
@{ @{
*/ */
/** /**
Get a URI node from a string. Get a URI node from a string.
Note this function measures @c str, which is a common bottleneck. Note this function measures @c str, which is a common bottleneck.
Use sord_node_from_serd_node instead if @c str is already measured. Use sord_node_from_serd_node instead if @c str is already measured.
 End of changes. 1 change blocks. 
0 lines changed or deleted 13 lines changed or added


 sordmm.hpp   sordmm.hpp 
skipping to change at line 174 skipping to change at line 174
inline bool is_valid() const { return type() != UNKNOWN; } inline bool is_valid() const { return type() != UNKNOWN; }
inline bool operator<(const Node& other) const { inline bool operator<(const Node& other) const {
if (type() != other.type()) { if (type() != other.type()) {
return type() < other.type(); return type() < other.type();
} else { } else {
return to_string() < other.to_string(); return to_string() < other.to_string();
} }
} }
const Node& operator=(const Node& other) { Node& operator=(const Node& other) {
if (_c_obj) { if (&other != this) {
sord_node_free(_world->c_obj(), _c_obj); if (_c_obj) {
sord_node_free(_world->c_obj(), _c_obj);
}
_world = other._world;
_c_obj = other._c_obj ? sord_node_copy(other._c_obj)
: NULL;
} }
_world = other._world;
_c_obj = other._c_obj ? sord_node_copy(other._c_obj) : NULL;
return *this; return *this;
} }
inline bool operator==(const Node& other) const { inline bool operator==(const Node& other) const {
return sord_node_equals(_c_obj, other._c_obj); return sord_node_equals(_c_obj, other._c_obj);
} }
inline const uint8_t* to_u_string() const; inline const uint8_t* to_u_string() const;
inline const char* to_c_string() const; inline const char* to_c_string() const;
inline std::string to_string() const; inline std::string to_string() const;
skipping to change at line 249 skipping to change at line 251
inline Literal(World& world, const std::string& s) inline Literal(World& world, const std::string& s)
: Node(world, Node::LITERAL, s) {} : Node(world, Node::LITERAL, s) {}
}; };
inline inline
Node::Node(World& world, Type type, const std::string& s) Node::Node(World& world, Type type, const std::string& s)
: _world(&world) : _world(&world)
{ {
switch (type) { switch (type) {
case URI: case URI:
assert(s.find(":") == std::string::npos
|| s.substr(0, 5) == "http:"
|| s.substr(0, 5) == "file:"
|| s.substr(0, 4) == "urn:");
_c_obj = sord_new_uri( _c_obj = sord_new_uri(
world.world(), (const unsigned char*)s.c_str()); world.world(), (const unsigned char*)s.c_str());
break; break;
case LITERAL: case LITERAL:
_c_obj = sord_new_literal( _c_obj = sord_new_literal(
world.world(), NULL, (const unsigned char*)s.c_str() , NULL); world.world(), NULL, (const unsigned char*)s.c_str() , NULL);
break; break;
case BLANK: case BLANK:
_c_obj = sord_new_blank( _c_obj = sord_new_blank(
world.world(), (const unsigned char*)s.c_str()); world.world(), (const unsigned char*)s.c_str());
skipping to change at line 392 skipping to change at line 390
sord_iter_get(_c_obj, quad); sord_iter_get(_c_obj, quad);
return Node(_world, quad[SORD_OBJECT]); return Node(_world, quad[SORD_OBJECT]);
} }
World& _world; World& _world;
}; };
/** An RDF Model (collection of triples). /** An RDF Model (collection of triples).
*/ */
class Model : public Noncopyable, public Wrapper<SordModel*> { class Model : public Noncopyable, public Wrapper<SordModel*> {
public: public:
inline Model(World& world, const std::string& base_uri="."); inline Model(World& world,
const std::string& base_uri,
unsigned indices = (SORD_SPO | SORD_OPS),
bool graphs = true);
inline ~Model(); inline ~Model();
inline const Node& base_uri() const { return _base; } inline const Node& base_uri() const { return _base; }
size_t num_quads() const { return sord_num_quads(_c_obj); } size_t num_quads() const { return sord_num_quads(_c_obj); }
inline void load_file(SerdEnv* env, inline void load_file(SerdEnv* env,
SerdSyntax syntax, SerdSyntax syntax,
const std::string& uri, const std::string& uri,
const std::string& base_uri=""); const std::string& base_uri="");
skipping to change at line 444 skipping to change at line 446
private: private:
World& _world; World& _world;
Node _base; Node _base;
SerdWriter* _writer; SerdWriter* _writer;
size_t _next_blank_id; size_t _next_blank_id;
}; };
/** Create an empty in-memory RDF model. /** Create an empty in-memory RDF model.
*/ */
inline inline
Model::Model(World& world, const std::string& base_uri) Model::Model(World& world,
const std::string& base_uri,
unsigned indices,
bool graphs)
: _world(world) : _world(world)
, _base(world, Node::URI, base_uri) , _base(world, Node::URI, base_uri)
, _writer(NULL) , _writer(NULL)
{ {
// FIXME: parameters _c_obj = sord_new(_world.world(), indices, graphs);
_c_obj = sord_new(_world.world(), SORD_SPO|SORD_OPS, true);
} }
inline void inline void
Model::load_string(SerdEnv* env, Model::load_string(SerdEnv* env,
SerdSyntax syntax, SerdSyntax syntax,
const char* str, const char* str,
size_t len, size_t len,
const std::string& base_uri) const std::string& base_uri)
{ {
SerdReader* reader = sord_new_reader(_c_obj, env, syntax, NULL); SerdReader* reader = sord_new_reader(_c_obj, env, syntax, NULL);
 End of changes. 6 change blocks. 
13 lines changed or deleted 18 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/