void librdf_statement_init(librdf_world *world, librdf_statement *statement) { librdf_world_open(world); LIBRDF_ASSERT_OBJECT_POINTER_RETURN(statement, librdf_statement); raptor_statement_init(statement, world->raptor_world_ptr); }
static int raptor_ntriples_parse_init(raptor_parser* rdf_parser, const char *name) { raptor_ntriples_parser_context *ntriples_parser; ntriples_parser = (raptor_ntriples_parser_context*)rdf_parser->context; raptor_statement_init(&ntriples_parser->statement, rdf_parser->world); if(!strcmp(name, "nquads")) ntriples_parser->is_nquads = 1; return 0; }
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); }
static int raptor_librdfa_parse_init(raptor_parser* rdf_parser, const char *name) { raptor_librdfa_parser_context *librdfa_parser; int rdfa_version = RAPTOR_DEFAULT_RDFA_VERSION; librdfa_parser = (raptor_librdfa_parser_context*)rdf_parser->context; raptor_statement_init(&rdf_parser->statement, rdf_parser->world); if(!strcmp(name, "rdfa11")) rdfa_version = 11; else if(!strcmp(name, "rdfa10")) rdfa_version = 10; librdfa_parser->rdfa_version = rdfa_version; return 0; }
/** * rasqal_new_query_results: * @world: rasqal world object * @query: query object (or NULL) * @type: query results (expected) type * @vars_table: variables table * * Create a new query results set * * The @query may be NULL for result set objects that are standalone * and not attached to any particular query * * Return value: a new query result object or NULL on failure **/ rasqal_query_results* rasqal_new_query_results(rasqal_world* world, rasqal_query* query, rasqal_query_results_type type, rasqal_variables_table* vars_table) { rasqal_query_results* query_results; RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(world, rasqal_world, NULL); RASQAL_ASSERT_OBJECT_POINTER_RETURN_VALUE(vars_table, rasqal_variables_table, NULL); query_results = (rasqal_query_results*)RASQAL_CALLOC(rasqal_query_results, 1, sizeof(*query_results)); if(!query_results) return NULL; query_results->world = world; query_results->type = type; query_results->finished = 0; query_results->executed = 0; query_results->failed = 0; query_results->query = query; query_results->result_count = 0; query_results->execution_data = NULL; query_results->row = NULL; query_results->ask_result = -1; query_results->store_results = 0; query_results->current_triple_result = -1; /* initialize static query_results->result_triple */ raptor_statement_init(&query_results->result_triple, world->raptor_world_ptr); query_results->triple = NULL; query_results->results_sequence = NULL; query_results->size = 0; query_results->vars_table = rasqal_new_variables_table_from_variables_table(vars_table); return query_results; }