sord.h   sord.h 
skipping to change at line 359 skipping to change at line 359
/** /**
Search for a triple pattern. Search for a triple pattern.
@return an iterator to the first match, or NULL if no matches found. @return an iterator to the first match, or NULL if no matches found.
*/ */
SORD_API SORD_API
SordIter* SordIter*
sord_find(SordModel* model, const SordQuad pat); sord_find(SordModel* model, const SordQuad pat);
/** /**
Check if @a model contains a triple pattern.
*/
SORD_API
bool
sord_contains(SordModel* model, const SordQuad pat);
/**
Add a quad to a model. Add a quad to a model.
*/ */
SORD_API SORD_API
bool bool
sord_add(SordModel* model, const SordQuad quad); sord_add(SordModel* model, const SordQuad quad);
/** /**
Remove a quad from a model. Remove a quad from a model.
Note that is it illegal to remove while iterating over @c model. Note that is it illegal to remove while iterating over @c model.
skipping to change at line 458 skipping to change at line 465
/** /**
Write a model to a writer. Write a model to a writer.
*/ */
SORD_API SORD_API
bool bool
sord_write(SordModel* model, sord_write(SordModel* model,
SerdWriter* writer, SerdWriter* writer,
SordNode* graph); SordNode* graph);
/** /**
Write a range to a writer.
This increments @c iter to its end, then frees it.
*/
SORD_API
bool
sord_write_iter(SordIter* iter,
SerdWriter* writer);
/**
@} @}
@} @}
*/ */
#ifdef __cplusplus #ifdef __cplusplus
} /* extern "C" */ } /* extern "C" */
#endif #endif
#endif /* SORD_SORD_H */ #endif /* SORD_SORD_H */
 End of changes. 2 change blocks. 
0 lines changed or deleted 17 lines changed or added


 sordmm.hpp   sordmm.hpp 
skipping to change at line 67 skipping to change at line 67
inline const T c_obj() const { return _c_obj; } inline const T c_obj() const { return _c_obj; }
protected: protected:
T _c_obj; T _c_obj;
}; };
/** Collection of RDF namespaces with prefixes. */ /** Collection of RDF namespaces with prefixes. */
class Namespaces : public Wrapper<SerdEnv*> { class Namespaces : public Wrapper<SerdEnv*> {
public: public:
Namespaces() : Wrapper<SerdEnv*>(serd_env_new(NULL)) {} Namespaces() : Wrapper<SerdEnv*>(serd_env_new(NULL)) {}
~Namespaces() { serd_env_free(_c_obj); }
static inline SerdNode string_to_node(SerdType type, const std::stri ng& s) { static inline SerdNode string_to_node(SerdType type, const std::stri ng& s) {
SerdNode ret = { SerdNode ret = {
(const uint8_t*)s.c_str(), s.length(), s.length(), 0 , type }; (const uint8_t*)s.c_str(), s.length(), s.length(), 0 , type };
return ret; return ret;
} }
inline void add(const std::string& name, inline void add(const std::string& name,
const std::string& uri) { const std::string& uri) {
const SerdNode name_node = string_to_node(SERD_LITERAL, name ); const SerdNode name_node = string_to_node(SERD_LITERAL, name );
const SerdNode uri_node = string_to_node(SERD_URI, uri) ; const SerdNode uri_node = string_to_node(SERD_URI, uri) ;
serd_env_set_prefix(_c_obj, &name_node, &uri_node); serd_env_set_prefix(_c_obj, &name_node, &uri_node);
} }
inline std::string qualify(std::string uri) const { inline std::string qualify(std::string uri) const {
const SerdNode uri_node = string_to_node(SERD_URI, uri); const SerdNode uri_node = string_to_node(SERD_URI, uri);
SerdNode prefix; SerdNode prefix;
SerdChunk suffix; SerdChunk suffix;
if (serd_env_qualify(_c_obj, &uri_node, &prefix, &suffix)) { if (serd_env_qualify(_c_obj, &uri_node, &prefix, &suffix)) {
std::string ret((const char*)prefix.buf, prefix.n_by tes - 1); std::string ret((const char*)prefix.buf, prefix.n_by tes);
ret.append(":").append((const char*)suffix.buf, suff ix.len); ret.append(":").append((const char*)suffix.buf, suff ix.len);
return ret; return ret;
} }
return uri; return uri;
} }
inline std::string expand(const std::string& curie) const { inline std::string expand(const std::string& curie) const {
assert(curie.find(":") != std::string::npos); assert(curie.find(":") != std::string::npos);
SerdNode curie_node = string_to_node(SERD_CURIE, curie); SerdNode curie_node = string_to_node(SERD_CURIE, curie);
SerdChunk uri_prefix; SerdChunk uri_prefix;
skipping to change at line 507 skipping to change at line 508
FILE* const fd = fopen((const char*)path, "w"); FILE* const fd = fopen((const char*)path, "w");
if (!fd) { if (!fd) {
fprintf(stderr, "Failed to open file %s\n", path); fprintf(stderr, "Failed to open file %s\n", path);
return SERD_ERR_UNKNOWN; return SERD_ERR_UNKNOWN;
} }
SerdURI base_uri = SERD_URI_NULL; SerdURI base_uri = SERD_URI_NULL;
if (serd_uri_parse((const uint8_t*)uri.c_str(), &base_uri)) { if (serd_uri_parse((const uint8_t*)uri.c_str(), &base_uri)) {
fprintf(stderr, "Invalid base URI <%s>\n", uri.c_str()); fprintf(stderr, "Invalid base URI <%s>\n", uri.c_str());
fclose(fd);
return SERD_ERR_BAD_ARG; return SERD_ERR_BAD_ARG;
} }
SerdWriter* writer = serd_writer_new(syntax, SerdWriter* writer = serd_writer_new(syntax,
style, style,
_world.prefixes().c_obj(), _world.prefixes().c_obj(),
&base_uri, &base_uri,
file_sink, file_sink,
fd); fd);
serd_env_foreach(_world.prefixes().c_obj(), serd_env_foreach(_world.prefixes().c_obj(),
(SerdPrefixSink)serd_writer_set_prefix, (SerdPrefixSink)serd_writer_set_prefix,
writer); writer);
sord_write(_c_obj, writer, 0); sord_write(_c_obj, writer, 0);
serd_writer_free(writer); serd_writer_free(writer);
fclose(fd);
return SERD_SUCCESS; return SERD_SUCCESS;
} }
static size_t static size_t
string_sink(const void* buf, size_t len, void* stream) string_sink(const void* buf, size_t len, void* stream)
{ {
std::string* str = (std::string*)stream; std::string* str = (std::string*)stream;
str->append((const char*)buf, len); str->append((const char*)buf, len);
return len; return len;
 End of changes. 4 change blocks. 
1 lines changed or deleted 4 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/