本文整理汇总了C++中raptor_new_uri函数的典型用法代码示例。如果您正苦于以下问题:C++ raptor_new_uri函数的具体用法?C++ raptor_new_uri怎么用?C++ raptor_new_uri使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了raptor_new_uri函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: assert_uri_to_relative
static int
assert_uri_to_relative(const char *base, const char *uri, const char *relative)
{
unsigned char *output;
int result;
raptor_uri* base_uri=NULL;
raptor_uri* reference_uri=raptor_new_uri((const unsigned char*)uri);
size_t length=0;
if(base)
base_uri=raptor_new_uri((const unsigned char*)base);
output=raptor_uri_to_relative_counted_uri_string(base_uri, reference_uri,
&length);
result=strcmp(relative, (const char*)output);
if (result) {
fprintf(stderr,
"%s: raptor_uri_string_to_relative_uri_string FAILED: base='%s', uri='%s', expected='%s', got='%s'\n",
program, base, uri, relative, output);
RAPTOR_FREE(cstring, output);
return 1;
}
RAPTOR_FREE(cstring, output);
raptor_free_uri(base_uri);
raptor_free_uri(reference_uri);
return 0;
}
开发者ID:Kirushanr,项目名称:audacity,代码行数:27,代码来源:raptor_uri.c
示例2: raptor_new_serializer
bool UTOPIASerializer::serialize(Serializer::Context& ctx, QIODevice& stream_, Node* node_) const
{
QMap< Node*, int > nodeIDs;
raptor_iostream_handler2 QIODeviceHandler = {
2,
qiodevice_iostream_init,
qiodevice_iostream_finish,
qiodevice_iostream_write_byte,
qiodevice_iostream_write_bytes,
qiodevice_iostream_write_end,
0,
0
};
// FIXME base uri?
// raptor_uri* base_uri = raptor_new_uri((const unsigned char*) "HAHAHA");
// raptor_serializer* rdf_serializer = raptor_new_serializer("rdfxml");
raptor_serializer* rdf_serializer = raptor_new_serializer("ntriples");
raptor_iostream* qiodevice_iostream = raptor_new_iostream_from_handler2(&stream_, &QIODeviceHandler);
raptor_serialize_set_namespace(rdf_serializer, raptor_new_uri((const unsigned char*) "http://utopia.cs.manchester.ac.uk/2007/03/utopia-system#"), (const unsigned char*) "system");
raptor_serialize_set_namespace(rdf_serializer, raptor_new_uri((const unsigned char*) "http://utopia.cs.manchester.ac.uk/2007/03/utopia-domain#"), (const unsigned char*) "domain");
raptor_serialize_start(rdf_serializer, 0 /*base_uri*/, qiodevice_iostream);
serialiseNode(rdf_serializer, nodeIDs, node_, true);
raptor_serialize_end(rdf_serializer);
return true;
}
开发者ID:project-renard-survey,项目名称:utopia-documents-mirror,代码行数:31,代码来源:utopia_serializer.cpp
示例3: raptor_new_turtle_writer
/**
* raptor_new_turtle_writer:
* @world: raptor_world object
* @base_uri: Base URI for the writer (or NULL)
* @write_base_uri: non-0 to write '@base' directive to output
* @nstack: Namespace stack for the writer to start with (or NULL)
* @iostr: I/O stream to write to
*
* Constructor - Create a new Turtle Writer writing Turtle to a raptor_iostream
*
* Return value: a new #raptor_turtle_writer object or NULL on failure
**/
raptor_turtle_writer*
raptor_new_turtle_writer(raptor_world* world,
raptor_uri* base_uri, int write_base_uri,
raptor_namespace_stack *nstack,
raptor_iostream* iostr)
{
raptor_turtle_writer* turtle_writer;
RAPTOR_CHECK_CONSTRUCTOR_WORLD(world);
if(!nstack || !iostr)
return NULL;
raptor_world_open(world);
turtle_writer = (raptor_turtle_writer*)RAPTOR_CALLOC(raptor_turtle_writer, 1,
sizeof(*turtle_writer));
if(!turtle_writer)
return NULL;
turtle_writer->world = world;
turtle_writer->nstack_depth = 0;
turtle_writer->nstack = nstack;
if(!turtle_writer->nstack) {
turtle_writer->nstack = raptor_new_namespaces(world, 1);
turtle_writer->my_nstack = 1;
}
turtle_writer->iostr = iostr;
turtle_writer->flags = 0;
turtle_writer->indent = 2;
turtle_writer->base_uri = NULL;
/* Ensure any initial base URI is not written relative */
if(base_uri && write_base_uri)
raptor_turtle_writer_base(turtle_writer, base_uri);
turtle_writer->base_uri = base_uri;
turtle_writer->xsd_boolean_uri = raptor_new_uri(world, (const unsigned char*)"http://www.w3.org/2001/XMLSchema#boolean");
turtle_writer->xsd_decimal_uri = raptor_new_uri(world, (const unsigned char*)"http://www.w3.org/2001/XMLSchema#decimal");
turtle_writer->xsd_double_uri = raptor_new_uri(world, (const unsigned char*)"http://www.w3.org/2001/XMLSchema#double");
turtle_writer->xsd_integer_uri = raptor_new_uri(world, (const unsigned char*)"http://www.w3.org/2001/XMLSchema#integer");
return turtle_writer;
}
开发者ID:nevali,项目名称:raptor,代码行数:61,代码来源:raptor_turtle_writer.c
示例4: main
int
main(int argc, char *argv[])
{
#ifdef HAVE_RAPTOR
raptor_world *world = NULL;
raptor_parser* rdf_parser = NULL;
unsigned char *uri_string;
raptor_uri *uri, *base_uri;
world = raptor_new_world();
rdf_parser = raptor_new_parser(world, "ntriples");
raptor_parser_set_statement_handler(rdf_parser, NULL, print_triple);
uri_string = raptor_uri_filename_to_uri_string(argv[1]);
uri = raptor_new_uri(world, uri_string);
base_uri = raptor_uri_copy(uri);
raptor_parser_parse_file(rdf_parser, uri, base_uri);
raptor_free_parser(rdf_parser);
raptor_free_uri(base_uri);
raptor_free_uri(uri);
raptor_free_memory(uri_string);
raptor_free_world(world);
#endif
return EXIT_SUCCESS;
}
开发者ID:rdmpage,项目名称:hdt-cpp,代码行数:32,代码来源:rdfprint.cpp
示例5: load_nquad_file
DllExport int call_conv load_nquad_file(CTXTdecl)
{
char *filename = p2c_string(reg_term(CTXTdecl 1));
unsigned char *uri_string;
raptor_uri *uri, *base_uri;
world = raptor_new_world();
rdf_parser = raptor_new_parser(world, "nquads");
raptor_parser_set_statement_handler(rdf_parser, NULL, handle_term);
uri_string = raptor_uri_filename_to_uri_string(filename);
uri = raptor_new_uri(world, uri_string);
base_uri = raptor_uri_copy(uri);
raptor_parser_parse_file(rdf_parser, uri, base_uri);
raptor_free_parser(rdf_parser);
raptor_free_uri(base_uri);
raptor_free_uri(uri);
raptor_free_memory(uri_string);
raptor_free_world(world);
return 1;
}
开发者ID:kkoch986,项目名称:XSB-B--Tree-Library,代码行数:29,代码来源:nq_parse.c
示例6: raptor_new_uri_for_retrieval
/**
* raptor_new_uri_for_retrieval - Turn a URI into one suitable for retrieval
* @old_uri: URI to transform
*
* Takes an existing URI and ensures it has a path (default /) and has
* no fragment - URI retrieval does not use the fragment part.
*
* Return value: new URI object or NULL on failure.
**/
raptor_uri*
raptor_new_uri_for_retrieval(raptor_uri* old_uri)
{
unsigned char *uri_string=raptor_uri_as_string(old_uri);
unsigned char *buffer;
size_t buffer_len=strlen((const char*)uri_string)+1;
unsigned char *scheme;
unsigned char *authority;
unsigned char *path;
unsigned char *query;
unsigned char *fragment;
unsigned char *new_uri_string;
raptor_uri* new_uri;
buffer=(unsigned char*)RAPTOR_MALLOC(cstring, buffer_len);
if(!buffer)
return NULL;
raptor_uri_parse (uri_string, buffer, buffer_len,
&scheme, &authority, &path, &query, &fragment);
if(!path)
path=(unsigned char*)"/";
new_uri_string=raptor_uri_construct(scheme, authority, path, query, NULL);
RAPTOR_FREE(cstring, buffer);
if(!new_uri_string)
return NULL;
new_uri=raptor_new_uri(new_uri_string);
RAPTOR_FREE(cstring, new_uri_string);
return new_uri;
}
开发者ID:stefanhusmann,项目名称:Amaya,代码行数:43,代码来源:raptor_uri.c
示例7: raptor_new_uri_for_retrieval
/**
* raptor_new_uri_for_retrieval:
* @old_uri: URI to transform
*
* Constructor - create a URI suitable for retrieval.
*
* Takes an existing URI and ensures it has a path (default /) and has
* no fragment - URI retrieval does not use the fragment part.
*
* Return value: new #raptor_uri object or NULL on failure.
**/
raptor_uri*
raptor_new_uri_for_retrieval(raptor_uri* old_uri)
{
unsigned char *uri_string;
unsigned char *new_uri_string;
raptor_uri* new_uri;
raptor_uri_detail *ud;
if(!old_uri)
return NULL;
uri_string=raptor_uri_as_string(old_uri);
ud=raptor_new_uri_detail(uri_string);
if(!ud)
return NULL;
if(!ud->path) {
ud->path=(unsigned char*)"/";
ud->path_len=1;
}
ud->fragment=NULL; ud->fragment_len=0;
new_uri_string=raptor_uri_detail_to_string(ud, NULL);
raptor_free_uri_detail(ud);
if(!new_uri_string)
return NULL;
new_uri=raptor_new_uri(new_uri_string);
RAPTOR_FREE(cstring, new_uri_string);
return new_uri;
}
开发者ID:Kirushanr,项目名称:audacity,代码行数:44,代码来源:raptor_uri.c
示例8: raptor_serializer_start_to_filename
/**
* raptor_serializer_start_to_filename:
* @rdf_serializer: the #raptor_serializer
* @filename: filename to serialize to
*
* Start serializing to a filename.
*
* Return value: non-0 on failure.
**/
int
raptor_serializer_start_to_filename(raptor_serializer *rdf_serializer,
const char *filename)
{
unsigned char *uri_string = raptor_uri_filename_to_uri_string(filename);
if(!uri_string)
return 1;
if(rdf_serializer->base_uri)
raptor_free_uri(rdf_serializer->base_uri);
rdf_serializer->base_uri = raptor_new_uri(rdf_serializer->world, uri_string);
rdf_serializer->locator.uri = rdf_serializer->base_uri;
rdf_serializer->locator.line = rdf_serializer->locator.column = 0;
RAPTOR_FREE(char*, uri_string);
rdf_serializer->iostream = raptor_new_iostream_to_filename(rdf_serializer->world,
filename);
if(!rdf_serializer->iostream)
return 1;
rdf_serializer->free_iostream_on_end = 1;
if(rdf_serializer->factory->serialize_start)
return rdf_serializer->factory->serialize_start(rdf_serializer);
return 0;
}
开发者ID:Distrotech,项目名称:raptor,代码行数:37,代码来源:raptor_serialize.c
示例9: rdf_database_read_file
/*****
** Lee el archivo que contiene las tripletas RDF
** y hace el llamado a la funcion save_triple() para guardarlos
*****/
void rdf_database_read_file(rdf_database db, const char *file)
{
raptor_world *world = NULL;
unsigned char *uri_string;
raptor_uri *uri, *base_uri;
// parser
world = raptor_new_world();
rdf_parser = raptor_new_parser(world, "rdfxml");
// seteo funcion handler para cada nodo
raptor_parser_set_statement_handler(rdf_parser, (void*)db, save_triple);
uri_string = raptor_uri_filename_to_uri_string(file);
uri = raptor_new_uri(world, uri_string);
base_uri = raptor_uri_copy(uri);
// empieza parseo y guardado en memoria
raptor_parser_parse_file(rdf_parser, uri, base_uri);
// liberar ram
raptor_free_parser(rdf_parser);
raptor_free_uri(base_uri);
raptor_free_uri(uri);
raptor_free_memory(uri_string);
raptor_free_world(world);
}
开发者ID:eaanaba,项目名称:rdf_project,代码行数:31,代码来源:rdf_parser.c
示例10: raptor_rss_parse_init
static int
raptor_rss_parse_init(raptor_parser* rdf_parser, const char *name) {
raptor_rss_parser_context *rss_parser=(raptor_rss_parser_context*)rdf_parser->context;
int i;
RAPTOR_RDF_type_URI(rss_parser)=raptor_new_uri_for_rdf_concept("type");
RAPTOR_RDF_Seq_URI(rss_parser)=raptor_new_uri_for_rdf_concept("Seq");
for(i=0; i<RSS_NAMESPACES_SIZE;i++) {
const char *uri_string=rss_namespace_uri_strings[i];
if(uri_string)
rss_parser->namespace_uris[i]=raptor_new_uri((const unsigned char*)uri_string);
}
for(i=0; i< RAPTOR_RSS_COMMON_SIZE; i++) {
raptor_uri *namespace_uri=rss_parser->namespace_uris[raptor_rss_types_info[i].nspace];
if(namespace_uri)
raptor_rss_types_info[i].uri=raptor_new_uri_from_uri_local_name(namespace_uri,
(const unsigned char*)raptor_rss_types_info[i].name);
}
for(i=0; i< RAPTOR_RSS_FIELDS_SIZE; i++) {
raptor_uri *namespace_uri=rss_parser->namespace_uris[raptor_rss_fields_info[i].nspace];
if(namespace_uri)
raptor_rss_fields_info[i].uri=raptor_new_uri_from_uri_local_name(namespace_uri,
(const unsigned char*)raptor_rss_fields_info[i].name);
}
xmlSubstituteEntitiesDefault(1);
return 0;
}
开发者ID:stefanhusmann,项目名称:Amaya,代码行数:32,代码来源:raptor_rss.c
示例11: main
int main(int argc, char *argv[]) {
fsp_link *link;
fs_query_state *qs;
fs_query *qr;
raptor_uri *bu;
int i;
#ifdef LINUX
mtrace();
#endif
link = fsp_open_link("ukgov_finances_cra", NULL, FS_OPEN_HINT_RW);
raptor_init();
fs_hash_init(fsp_hash_type(link));
bu = raptor_new_uri((unsigned char *)"local:");
fsp_no_op(link, 0);
qs = fs_query_init(link);
for (i=0;i<atoi(argv[1]);i++) {
//printf("--------- %d ----------\n", i);
qr = fs_query_execute(qs, link, bu, QUERY, 0, 3, 0);
fs_query_free(qr);
fs_query_cache_flush(qs, 0);
}
fs_query_fini(qs);
raptor_free_uri(bu);
raptor_finish();
fsp_close_link(link);
#ifdef LINUX
muntrace();
#endif
}
开发者ID:TomT0m,项目名称:py4s,代码行数:34,代码来源:memory_test.c
示例12: raptor_www_curl_update_status
static void
raptor_www_curl_update_status(raptor_www* www)
{
char* final_uri;
if(www->failed)
return;
if(www->checked_status++)
return;
if(!www->final_uri) {
/* If not already found in headers by
* raptor_www_curl_header_callback() which overrides what libcurl
* found in HTTP status line (3xx)
*/
if(curl_easy_getinfo(www->curl_handle, CURLINFO_EFFECTIVE_URL,
&final_uri) == CURLE_OK) {
www->final_uri = raptor_new_uri(www->world, (const unsigned char*)final_uri);
if(www->final_uri_handler)
www->final_uri_handler(www, www->final_uri_userdata, www->final_uri);
}
}
}
开发者ID:Distrotech,项目名称:raptor,代码行数:26,代码来源:raptor_www_curl.c
示例13: rasqal_xsd_init
int
rasqal_xsd_init(rasqal_world* world)
{
int i;
world->xsd_namespace_uri = raptor_new_uri(world->raptor_world_ptr,
raptor_xmlschema_datatypes_namespace_uri);
if(!world->xsd_namespace_uri)
return 1;
world->xsd_datatype_uris =
(raptor_uri**)RASQAL_CALLOC(ptrarray,
SPARQL_XSD_NAMES_COUNT + 1,
sizeof(raptor_uri*));
if(!world->xsd_datatype_uris)
return 1;
for(i = RASQAL_LITERAL_FIRST_XSD; i < SPARQL_XSD_NAMES_COUNT; i++) {
const unsigned char* name = (const unsigned char*)sparql_xsd_names[i];
world->xsd_datatype_uris[i] =
raptor_new_uri_from_uri_local_name(world->raptor_world_ptr,
world->xsd_namespace_uri, name);
if(!world->xsd_datatype_uris[i])
return 1;
}
return 0;
}
开发者ID:sengels,项目名称:rasqal,代码行数:28,代码来源:rasqal_xsd_datatypes.c
示例14: raptor_new_uri
CRDFGraph * CRDFParser::parse(std::istream & stream)
{
bool success = true;
bool done = false;
stream.imbue(std::locale::classic());
stream.precision(16);
// Create the new graph
CRDFGraph * pGraph = new CRDFGraph;
unsigned C_INT32 BUFFER_SIZE = 0xfffe;
char * pBuffer = new char[BUFFER_SIZE + 1];
stream.get(pBuffer, BUFFER_SIZE, 0);
if (stream.gcount() != 0)
{
raptor_uri * pURI = raptor_new_uri((unsigned char *) "#");
if (raptor_start_parse(mpParser, pURI))
fatalError();
raptor_set_statement_handler(mpParser, pGraph, &CRDFParser::TripleHandler);
raptor_set_namespace_handler(mpParser, pGraph, &CRDFParser::NameSpaceHandler);
raptor_set_generate_id_handler(mpParser, pGraph, &CRDFParser::GenerateIdHandler);
while (!done)
{
if (stream.eof()) done = true;
if (stream.fail() && !done)
fatalError();
if (raptor_parse_chunk(mpParser,
(unsigned char *) pBuffer,
strlen(pBuffer),
done ? 1 : 0))
{
done = true;
success = false;
}
stream.get(pBuffer, BUFFER_SIZE, 0);
}
}
delete [] pBuffer;
if (!success)
{
pdelete(pGraph);
return NULL;
}
if (pGraph)
pGraph->guessGraphRoot();
return pGraph;
}
开发者ID:mgaldzic,项目名称:copasi_api,代码行数:60,代码来源:CRDFParser.cpp
示例15: ser_emit_triple
static void
ser_emit_triple(void* user_data,
const char* subject, int subject_type,
const char* predicate_nspace, const char* predicate_name,
const char *object, int object_type,
const char *datatype_uri)
{
raptor_serializer* serializer = (raptor_serializer*)user_data;
raptor_statement s; /* static */
raptor_uri* predicate_ns_uri;
raptor_uri* predicate_uri;
raptor_statement_init(&s, rworld);
if(subject_type == FLICKCURL_TERM_TYPE_RESOURCE)
s.subject = raptor_new_term_from_uri_string(rworld, (const unsigned char*)subject);
else /* blank node */
s.subject = raptor_new_term_from_blank(rworld, (const unsigned char*)subject);
predicate_ns_uri = raptor_new_uri(rworld, (const unsigned char*)predicate_nspace);
predicate_uri = raptor_new_uri_from_uri_local_name(rworld, predicate_ns_uri,
(const unsigned char*)predicate_name);
s.predicate = raptor_new_term_from_uri(rworld, predicate_uri);
raptor_free_uri(predicate_uri);
raptor_free_uri(predicate_ns_uri);
if(object_type == FLICKCURL_TERM_TYPE_RESOURCE)
s.object = (void*)raptor_new_term_from_uri_string(rworld, (const unsigned char*)object);
else if(object_type == FLICKCURL_TERM_TYPE_BLANK)
s.object = raptor_new_term_from_blank(rworld, (const unsigned char*)subject);
else {
/* literal */
raptor_uri* raptor_datatype_uri = NULL;
if(datatype_uri)
raptor_datatype_uri = raptor_new_uri(rworld, (const unsigned char*)datatype_uri);
s.object = raptor_new_term_from_literal(rworld, (const unsigned char*)object, raptor_datatype_uri, NULL /* language */);
raptor_free_uri(raptor_datatype_uri);
}
raptor_serializer_serialize_statement(serializer, &s);
raptor_statement_clear(&s);
}
开发者ID:jcsogo,项目名称:flickcurl,代码行数:47,代码来源:flickrdf.c
示例16: fs_import_stream_start
/* ..._start and ..._finish share an int * count parameter
* the same variable should be passed by reference both times */
int fs_import_stream_start(fsp_link *link, const char *model_uri, const char *mimetype, int has_o_index, int *count)
{
if (inited == 0) {
memset(&parse_data, 0, sizeof(parse_data));
inited = 1;
}
parse_data.link = link;
parse_data.segments = fsp_link_segments(link);
parse_data.ext_count = count;
for (int i=0; i<parse_data.segments; i++) {
for (int j=0; j<RES_BUF_SIZE; j++) {
lex_tmp[i][j] = malloc(RES_BUF_SIZE);
}
}
memset(nodecache, 0, sizeof(nodecache));
parse_data.quad_fn = g_strdup(FS_TMP_PATH "/importXXXXXX");
parse_data.quad_fd = mkstemp(parse_data.quad_fn);
if (parse_data.quad_fd < 0) {
fs_error(LOG_ERR, "Cannot create tmp file “%s”", parse_data.quad_fn);
return 1;
}
parse_data.muri = raptor_new_uri((unsigned char *) model_uri);
parse_data.model = g_strdup(model_uri);
parse_data.model_hash = fs_hash_uri(model_uri);
parse_data.count_trip = 0;
parse_data.count_err = 0;
parse_data.last_count = 0;
parse_data.has_o_index = has_o_index;
/* store the model uri */
buffer_res(link, parse_data.segments, parse_data.model_hash, parse_data.model, FS_RID_NULL, parse_data.dryrun);
parse_data.parser = raptor_new_parser_for_content(NULL, mimetype, NULL, 0, (unsigned char *) parse_data.model);
if (!parse_data.parser) {
return 1;
}
/* use us as a vector for an indirect attack? no thanks */
raptor_set_feature(parse_data.parser, RAPTOR_FEATURE_NO_NET, 0);
raptor_set_fatal_error_handler(parse_data.parser, link, fatal_rdf_parser_error);
raptor_set_error_handler(parse_data.parser, link, rdf_parser_error);
raptor_set_statement_handler(parse_data.parser, &parse_data, store_stmt);
raptor_set_graph_handler(parse_data.parser, &parse_data, graph_handler);
raptor_start_parse(parse_data.parser, parse_data.muri);
fs_hash_freshen(); /* blank nodes are unique per file */
return 0;
}
开发者ID:nakao,项目名称:4store,代码行数:61,代码来源:import.c
示例17: raptor_uri_filename_to_uri_string
static raptor_uri *rdf_parser_path_to_uri(raptor_world* world,char* path) {
unsigned char *uri_string;
raptor_uri *uri;
uri_string = raptor_uri_filename_to_uri_string(path);
uri=raptor_new_uri(world,uri_string);
raptor_free_memory(uri_string);
return uri;
}
开发者ID:msalvadores,项目名称:quadindex,代码行数:8,代码来源:rdf-parser.c
示例18: main
int main (int argc, char *argv[])
{
const char *program = raptor_basename(argv[0]);
raptor_world *world;
const char *uri_string;
raptor_www *www;
const char *user_agent = "raptor_www_test/0.1";
raptor_uri *uri;
void *string = NULL;
size_t string_length = 0;
if(argc > 1)
uri_string = argv[1];
else
uri_string = "http://librdf.org/";
world = raptor_new_world();
if(!world || raptor_world_open(world))
exit(1);
uri = raptor_new_uri(world, (const unsigned char*)uri_string);
if(!uri) {
fprintf(stderr, "%s: Failed to create Raptor URI for %s\n",
program, uri_string);
exit(1);
}
www = raptor_new_www(world);
raptor_www_set_content_type_handler(www, write_content_type, (void*)stderr);
raptor_www_set_user_agent(www, user_agent);
/* start retrieval (always a GET) */
if(raptor_www_fetch_to_string(www, uri,
&string, &string_length, malloc)) {
fprintf(stderr, "%s: WWW fetch failed\n", program);
} else {
#if defined(RAPTOR_DEBUG) && RAPTOR_DEBUG > 1
fprintf(stderr, "%s: HTTP response status %d\n",
program, www->status_code);
fprintf(stderr, "%s: Returned %d bytes of content\n",
program, (int)string_length);
#endif
}
if(string)
free(string);
raptor_free_www(www);
raptor_free_uri(uri);
raptor_free_world(world);
return 0;
}
开发者ID:Distrotech,项目名称:raptor,代码行数:57,代码来源:raptor_www_test.c
示例19: rasqal_init_datatypes
static void
rasqal_init_datatypes(void) {
int i;
raptor_xpfo_base_uri = raptor_new_uri((const unsigned char*)RASQAL_XPFO_BASE_URI);
rasqal_sparql_op_namespace_uri = raptor_new_uri((const unsigned char*)RASQAL_SPARQL_OP_NAMESPACE_URI);
for(i = 0; i< RASQAL_XSD_DATATYPES_SIZE; i++) {
rasqal_xsd_datatypes[i].uri = raptor_new_uri_from_uri_local_name(raptor_xpfo_base_uri,
(const unsigned char*)rasqal_xsd_datatypes[i].name);
}
for(i = 0; i< RASQAL_XSD_DATATYPE_FNS_SIZE; i++) {
rasqal_xsd_datatype_fns[i].uri = raptor_new_uri_from_uri_local_name(rasqal_sparql_op_namespace_uri,
rasqal_xsd_datatype_fns[i].name);
}
}
开发者ID:sengels,项目名称:rasqal,代码行数:18,代码来源:rasqal_xsd_datatypes.c
示例20: calloc
fs_metadata *fs_metadata_open(const char *kb)
{
fs_metadata *m = calloc(1, sizeof(fs_metadata));
gchar *fs_md_file_uri_format;
fs_md_file_uri_format = g_strconcat("file://",
fs_get_md_file_format(),
NULL);
m->size = 16;
m->length = 0;
m->entries = calloc(m->size, sizeof(struct m_entry));
m->uri = g_strdup_printf(fs_md_file_uri_format, kb);
g_free(fs_md_file_uri_format);
int fd;
if ((fd = open(m->uri + 7, FS_O_NOATIME | O_CREAT, FS_FILE_MODE)) == -1) {
fs_error(LOG_CRIT, "failed to touch metadata file %s: %s",
m->uri, strerror(errno));
free(m);
return NULL;
}
close(fd);
m->rw = raptor_new_world();
if (!m->rw) {
fs_error(LOG_CRIT, "failed to initialise raptor");
free(m);
return NULL;
}
raptor_parser *rdf_parser = raptor_new_parser(m->rw, "turtle");
raptor_parser_set_statement_handler(rdf_parser, m, parse_stmt);
char *uri = strdup(m->uri);
raptor_uri *ruri = raptor_new_uri(m->rw, (unsigned char *) uri);
raptor_uri *muri = raptor_new_uri(m->rw, (unsigned char *) uri);
free(uri);
if (raptor_parser_parse_uri(rdf_parser, ruri, muri)) {
fs_error(LOG_ERR, "failed to parse metadata file “%s”", m->uri);
return NULL;
}
raptor_free_parser(rdf_parser);
raptor_free_uri(ruri);
raptor_free_uri(muri);
return m;
}
开发者ID:garlik,项目名称:4store,代码行数:44,代码来源:metadata.c
注:本文中的raptor_new_uri函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论