当前位置: 首页>>代码示例>>C++>>正文


C++ raptor_sequence_size函数代码示例

本文整理汇总了C++中raptor_sequence_size函数的典型用法代码示例。如果您正苦于以下问题:C++ raptor_sequence_size函数的具体用法?C++ raptor_sequence_size怎么用?C++ raptor_sequence_size使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了raptor_sequence_size函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: rasqal_rowsource_sparql_xml_process

static void
rasqal_rowsource_sparql_xml_process(rasqal_rowsource_sparql_xml_context* con)
{
  if(raptor_sequence_size(con->results_sequence) && con->variables_count > 0)
    return;

  /* do some parsing - need some results */
  while(!raptor_iostream_read_eof(con->iostr)) {
    size_t read_len;
    
    read_len = raptor_iostream_read_bytes((char*)con->buffer, 1,
                                          FILE_READ_BUF_SIZE,
                                          con->iostr);
    if(read_len > 0) {
      RASQAL_DEBUG2("processing %d bytes\n", (int)read_len);
      raptor_sax2_parse_chunk(con->sax2, con->buffer, read_len, 0);
      con->locator.byte += read_len;
    }
    
    if(read_len < FILE_READ_BUF_SIZE) {
      /* finished */
      raptor_sax2_parse_chunk(con->sax2, NULL, 0, 1);
      break;
    }
    
    /* end with variables sequence done AND at least one row */
    if(con->variables_count > 0 &&
       raptor_sequence_size(con->results_sequence) > 0)
      break;
  }
  
}
开发者ID:egh,项目名称:rasqal,代码行数:32,代码来源:rasqal_format_sparql_xml.c

示例2: rasqal_new_rowsequence_rowsource

/**
 * rasqal_new_rowsequence_rowsource:
 * @world: world object
 * @query: query object
 * @vt: variables table
 * @rows_seq: input sequence of #rasqal_row
 * @vars_seq: input sequence of #rasqal_variable for all rows in @rows_seq
 *
 * INTERNAL - create a new rowsource over a sequence of rows with given variables
 *
 * This uses the number of variables in @vt to set the rowsource size
 * (order size is always 0) and then checks that all the rows in the
 * sequence are the same.  If not, construction fails and NULL is
 * returned.
 *
 * The @rows_seq and @vars_seq become owned by the new rowsource.
 *
 * Return value: new rowsource or NULL on failure
 */
rasqal_rowsource*
rasqal_new_rowsequence_rowsource(rasqal_world *world,
                                 rasqal_query* query, 
                                 rasqal_variables_table* vt,
                                 raptor_sequence* rows_seq,
                                 raptor_sequence* vars_seq)
{
  rasqal_rowsequence_rowsource_context* con;
  int flags = 0;
  
  if(!world || !query || !vt || !rows_seq || !vars_seq)
    return NULL;

  if(!raptor_sequence_size(rows_seq) || !raptor_sequence_size(vars_seq))
    return NULL;
  
  con = RASQAL_CALLOC(rasqal_rowsequence_rowsource_context*, 1, sizeof(*con));
  if(!con)
    return NULL;

  con->seq = rows_seq;
  con->vars_seq = vars_seq;

  return rasqal_new_rowsource_from_handler(world, query,
                                           con,
                                           &rasqal_rowsequence_rowsource_handler,
                                           vt,
                                           flags);
}
开发者ID:xoration,项目名称:rasqal,代码行数:48,代码来源:rasqal_rowsource_rowsequence.c

示例3: rasqal_rowsequence_rowsource_init

static int
rasqal_rowsequence_rowsource_init(rasqal_rowsource* rowsource, void *user_data) 
{
  rasqal_rowsequence_rowsource_context* con;
  int rows_count;
  int i;
  
  con = (rasqal_rowsequence_rowsource_context*)user_data;
  con->offset = 0;

  con->failed = 0;
  
  /* adjust offset of every row */
  rows_count = raptor_sequence_size(con->seq);
  for(i = 0; i < rows_count; i++) {
    rasqal_row* row;
    row = (rasqal_row*)raptor_sequence_get_at(con->seq, i);
    
    row->rowsource = rowsource;
    row->offset = i;
    
  }

  return 0;
}
开发者ID:xoration,项目名称:rasqal,代码行数:25,代码来源:rasqal_rowsource_rowsequence.c

示例4: rasqal_rowsource_groupby_tree_print_node

static int
#else
static void
#endif
rasqal_rowsource_groupby_tree_print_node(void *object, FILE *fh)
{
  rasqal_groupby_tree_node* node = (rasqal_groupby_tree_node*)object;
  
  fputs("Group\n  Key Sequence of literals: ", fh);
  if(node->literals)
    /* sequence of literals */
    raptor_sequence_print(node->literals, fh);
  else
    fputs("None", fh);

  fputs("\n  Value Sequence of rows:\n", fh);
  if(node->rows) {
    int i;
    int size = raptor_sequence_size(node->rows);
    
    /* sequence of rows */
    for(i = 0; i < size; i++) {
      rasqal_row* row = (rasqal_row*)raptor_sequence_get_at(node->rows, i);
      
      fprintf(fh, "    Row %d: ", i);
      rasqal_row_print(row, fh);
      fputc('\n', fh);
    }
  } else
    fputs("None\n", fh);

#ifdef HAVE_RAPTOR2_API
  return 0;
#endif
}
开发者ID:rollxx,项目名称:rasqal,代码行数:35,代码来源:rasqal_rowsource_groupby.c

示例5: rasqal_sort_rowsource_init

static int
rasqal_sort_rowsource_init(rasqal_rowsource* rowsource, void *user_data)
{
  rasqal_query *query = rowsource->query;
  rasqal_sort_rowsource_context *con;

  con = (rasqal_sort_rowsource_context*)user_data;
  
  if(con->order_seq)
    con->order_size = raptor_sequence_size(con->order_seq);
  else {
    RASQAL_DEBUG1("No order conditions for sort rowsource - passing through");
    con->order_size = -1;
  }
  
  con->map = NULL;

  if(con->order_size > 0 ) {
    /* make a row:NULL map in order to sort or do distinct
     * FIXME: should DISTINCT be separate? 
     */
    con->map = rasqal_engine_new_rowsort_map(con->distinct,
                                             query->compare_flags,
                                             con->order_seq);
    if(!con->map)
      return 1;
  }
  
  con->seq = NULL;

  return 0;
}
开发者ID:bbcarchdev,项目名称:deb-rasqal,代码行数:32,代码来源:rasqal_rowsource_sort.c

示例6: librdf_parser_raptor_namespace_handler

/*
 * librdf_parser_raptor_namespace_handler - helper callback function for raptor RDF when a namespace is seen
 * @context: context for callback
 * @statement: raptor_statement
 *
 * Adds the statement to the list of statements.
 */
static void
librdf_parser_raptor_namespace_handler(void* user_data,
                                       raptor_namespace *nspace)
{
  librdf_parser_raptor_context* pcontext=(librdf_parser_raptor_context*)user_data;
  const unsigned char* prefix;
  unsigned char* nprefix;
  size_t prefix_length;
  librdf_uri* uri;
  int i;

  uri=(librdf_uri*)raptor_namespace_get_uri(nspace);
  if(!uri)
    return;

  for(i=0; i < raptor_sequence_size(pcontext->nspace_uris); i++) {
    librdf_uri* u=(librdf_uri*)raptor_sequence_get_at(pcontext->nspace_uris, i);
    if(librdf_uri_equals(uri, u))
      return;
  }

  /* new namespace */
  uri=librdf_new_uri_from_uri(uri);
  raptor_sequence_push(pcontext->nspace_uris, uri);

  prefix=raptor_namespace_get_counted_prefix(nspace, &prefix_length);
  if(prefix) {
    nprefix = LIBRDF_MALLOC(unsigned char*, prefix_length + 1);
    /* FIXME: what if nprefix alloc failed? now just pushes NULL to sequence */
    if(nprefix)
      strncpy((char*)nprefix, (const char*)prefix, prefix_length+1);
  } else
开发者ID:arleincho,项目名称:librdf,代码行数:39,代码来源:rdf_parser_raptor.c

示例7: raptor_avltree_iterator_next

static int
raptor_avltree_iterator_next(raptor_avltree_iterator* iterator) 
{
  iterator->index++;

  return (iterator->index > raptor_sequence_size(iterator->tree->seq));
}
开发者ID:rollxx,项目名称:rasqal,代码行数:7,代码来源:rasqal_rowsource_groupby.c

示例8: raptor_dot_serializer_declare_namespace_from_namespace

/* add a namespace */
static int
raptor_dot_serializer_declare_namespace_from_namespace(raptor_serializer* serializer,
						       raptor_namespace *nspace)
{
  raptor_dot_context * context = (raptor_dot_context *)serializer->context;
  int i;

  for( i = 0 ; i < raptor_sequence_size(context->namespaces) ; i++ ) {
    raptor_namespace * ns;
    ns = (raptor_namespace *)raptor_sequence_get_at(context->namespaces, i);

    /* If prefix is already declared, ignore it */
    if((!ns->prefix && !nspace->prefix) ||
       (ns->prefix && nspace->prefix &&
        !strcmp((const char*)ns->prefix, (const char*)nspace->prefix)) ||
       (ns->uri && nspace->uri &&
        raptor_uri_equals(ns->uri, nspace->uri)) )
      return 1;
  }

  nspace = raptor_new_namespace_from_uri(context->nstack, nspace->prefix,
					 nspace->uri, 0);

  if(!nspace)
    return 1;
  
  raptor_sequence_push(context->namespaces, nspace);

  return 0;
}
开发者ID:Kirushanr,项目名称:audacity,代码行数:31,代码来源:raptor_serialize_dot.c

示例9: rasqal_rowsource_get_variable_offset_by_name

/**
 * rasqal_rowsource_get_variable_offset_by_name:
 * @rowsource: rasqal rowsource
 * @name: variable name
 *
 * Get the offset of a variable into the list of variables
 *
 * Return value: offset or <0 if not present or on failure
 **/
int
rasqal_rowsource_get_variable_offset_by_name(rasqal_rowsource *rowsource,
                                             const unsigned char* name)
{
  int offset= -1;
  int i;
  
  if(!rowsource)
    return -1;

  rasqal_rowsource_ensure_variables(rowsource);

  if(!rowsource->variables_sequence)
    return -1;
  
  for(i=0; i < raptor_sequence_size(rowsource->variables_sequence); i++) {
    rasqal_variable* v;
    v = (rasqal_variable*)raptor_sequence_get_at(rowsource->variables_sequence, i);
    if(!strcmp(RASQAL_GOOD_CAST(const char*, v->name),
               RASQAL_GOOD_CAST(const char*, name))) {
      offset = i;
      break;
    }
  }

  return offset;
}
开发者ID:0u812,项目名称:rasqal,代码行数:36,代码来源:rasqal_rowsource.c

示例10: raptor_dot_serializer_write_uri

static void
raptor_dot_serializer_write_uri(raptor_serializer* serializer,
				raptor_uri* uri)
{
  raptor_dot_context* context = (raptor_dot_context*)serializer->context;
  unsigned char* full = raptor_uri_as_string(uri);
  int i;

  for( i = 0 ; i < raptor_sequence_size(context->namespaces) ; i++ ) {
    raptor_namespace* ns =
      (raptor_namespace*)raptor_sequence_get_at(context->namespaces, i);
    const unsigned char* ns_uri_string;
    size_t ns_uri_string_len;
    ns_uri_string=raptor_uri_as_counted_string(ns->uri, &ns_uri_string_len);

    if(!strncmp((char*)full, (char*)ns_uri_string, ns_uri_string_len) ) {
      const unsigned char* prefix = raptor_namespace_get_prefix(ns);
      
      if(prefix) {	
        raptor_iostream_write_string(serializer->iostream, prefix);
        raptor_iostream_write_byte(serializer->iostream, ':');
      }

      raptor_iostream_write_string(serializer->iostream,
                                   full + ns_uri_string_len);

      return;
    }
  }

  raptor_iostream_write_string(serializer->iostream, full);
}
开发者ID:Kirushanr,项目名称:audacity,代码行数:32,代码来源:raptor_serialize_dot.c

示例11: rasqal_raptor_init_triples_source_common

static int
rasqal_raptor_init_triples_source_common(rasqal_world* world,
        raptor_sequence* data_graphs,
        rasqal_query* rdf_query,
        void *factory_user_data,
        void *user_data,
        rasqal_triples_source *rts,
        rasqal_triples_error_handler handler1,
        rasqal_triples_error_handler2 handler2,
        unsigned int flags)
{
    rasqal_raptor_triples_source_user_data* rtsc;
    raptor_parser *parser;
    int i;
    int rc = 0;

    rtsc = (rasqal_raptor_triples_source_user_data*)user_data;

    /* Max API version this triples source generates */
    rts->version = 2;

    rts->init_triples_match = rasqal_raptor_init_triples_match;
    rts->triple_present = rasqal_raptor_triple_present;
    rts->free_triples_source = rasqal_raptor_free_triples_source;
    rts->support_feature = rasqal_raptor_support_feature;

    if(data_graphs)
        rtsc->sources_count = raptor_sequence_size(data_graphs);
    else
        /* No data graph - assume there is just a background graph */
        rtsc->sources_count = 0;

    if(rtsc->sources_count)
        rtsc->source_literals = RASQAL_CALLOC(rasqal_literal**, rtsc->sources_count, sizeof(rasqal_literal*));
    else
开发者ID:pombredanne,项目名称:rasqal,代码行数:35,代码来源:rasqal_raptor.c

示例12: rasqal_write_sparql_bindings

static int
rasqal_write_sparql_bindings(sparql_writer_context* wc,
                             raptor_iostream* iostr,
                             rasqal_bindings* bindings)
{
  raptor_iostream_counted_string_write("BINDINGS", 8, iostr);
  rasqal_query_write_sparql_select(wc, iostr, bindings->variables);
  raptor_iostream_counted_string_write(" {\n", 3, iostr);

  if(bindings->rows) {
    int i;
  
    for(i = 0; i < raptor_sequence_size(bindings->rows); i++) {
      rasqal_row* row;
      row = raptor_sequence_get_at(bindings->rows, i);
      raptor_iostream_counted_string_write("  ", 2, iostr);
      rasqal_write_sparql_row(wc, iostr, row);
      raptor_iostream_counted_string_write("\n", 1, iostr);
    }
  }

  raptor_iostream_counted_string_write("}\n", 2, iostr);

  return 0;
}
开发者ID:egh,项目名称:rasqal,代码行数:25,代码来源:rasqal_query_write.c

示例13: rasqal_graph_rowsource_init

static int
rasqal_graph_rowsource_init(rasqal_rowsource* rowsource, void *user_data)
{
  rasqal_graph_rowsource_context *con;
  raptor_sequence* seq;

  con = (rasqal_graph_rowsource_context*)user_data;
  
  seq = rasqal_query_get_data_graph_sequence(rowsource->query);
  if(!seq)
    return 1;

  con->dg_size = raptor_sequence_size(seq);
  
  con->finished = 0;
  con->dg_offset = -1;
  con->offset = 0;

  /* Do not care if finished at this stage (it is not an
   * error). rasqal_graph_rowsource_read_row() will deal with
   * returning NULL for an empty result.
   */
  rasqal_graph_next_dg(con);

  return 0;
}
开发者ID:bbcarchdev,项目名称:deb-rasqal,代码行数:26,代码来源:rasqal_rowsource_graph.c

示例14: raptor_dot_serializer_assert_node

/* Check the list to see if the node is a duplicate. If not, add it
 * to the list.
 */
static void
raptor_dot_serializer_assert_node(raptor_serializer* serializer,
                                  raptor_term* assert_node)
{
  raptor_dot_context* context = (raptor_dot_context*)serializer->context;
  raptor_sequence* seq = NULL;
  int i;

  /* Which list are we searching? */
  switch(assert_node->type) {
    case RAPTOR_TERM_TYPE_URI:
      seq = context->resources;
      break;

    case RAPTOR_TERM_TYPE_BLANK:
      seq = context->bnodes;
      break;

    case RAPTOR_TERM_TYPE_LITERAL:
      seq = context->literals;
      break;

    case RAPTOR_TERM_TYPE_UNKNOWN:
      break;
  }

  for(i = 0 ; i < raptor_sequence_size(seq) ; i++ ) {
    raptor_term* node = (raptor_term*)raptor_sequence_get_at(seq, i);

    if(raptor_term_equals(node, assert_node))
      return;
  }

  raptor_sequence_push(seq, raptor_term_copy(assert_node));
}
开发者ID:Distrotech,项目名称:raptor,代码行数:38,代码来源:raptor_serialize_dot.c

示例15: raptor_print_subject

void
raptor_print_subject(raptor_abbrev_subject* subject) 
{
  int i;
  unsigned char *subj;
  unsigned char *pred;
  unsigned char *obj;
  raptor_avltree_iterator* iter=NULL;

  /* Note: The raptor_abbrev_node field passed as the first argument for
   * raptor_statement_part_as_string() is somewhat arbitrary, since as
   * the data structure is designed, the first word in the value union
   * is what was passed as the subject/predicate/object of the
   * statement.
   */
  subj = raptor_statement_part_as_string(subject->node->value.resource.uri,
                                         subject->node->type, NULL, NULL);

  if(subject->type) {
      obj=raptor_statement_part_as_string(subject->type->value.resource.uri,
                                          subject->type->type,
                                          subject->type->value.literal.datatype,
                                          subject->type->value.literal.language);
      fprintf(stderr,"[%s, http://www.w3.org/1999/02/22-rdf-syntax-ns#type, %s]\n", subj, obj);      
      RAPTOR_FREE(cstring, obj);
  }
  
  for(i=0; i < raptor_sequence_size(subject->elements); i++) {

    raptor_abbrev_node* o = raptor_sequence_get_at(subject->elements, i);
    if(o) {
      obj = raptor_statement_part_as_string(o->value.literal.string,
                                            o->type,
                                            o->value.literal.datatype,
                                            o->value.literal.language);
      fprintf(stderr,"[%s, [rdf:_%d], %s]\n", subj, i, obj);      
      RAPTOR_FREE(cstring, obj);
    }
    
  }


  iter=raptor_new_avltree_iterator(subject->properties, NULL, NULL, 1);
  while(iter) {
    raptor_abbrev_node** nodes;
    nodes=(raptor_abbrev_node**)raptor_avltree_iterator_get(iter);
    if(!nodes)
      break;
    raptor_print_abbrev_po(stderr, nodes);

    if(raptor_avltree_iterator_next(iter))
      break;
  }
  if(iter)
    raptor_free_avltree_iterator(iter);
  
  RAPTOR_FREE(cstring, subj);
  
}
开发者ID:Kirushanr,项目名称:audacity,代码行数:59,代码来源:raptor_abbrev.c


注:本文中的raptor_sequence_size函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。