Example #1
0
void unary_op(){
	if (lookahead == LOW_BIN_OP && lexval.ival == '-')	
		match(LOW_BIN_OP);
	else if (lexval.ival == PROJECT)
		project_op();
	else if (lexval.ival == SELECT)
		select_op();
	else if (lexval.ival == EXISTS)
		exists_op();
	else if (lexval.ival == ALL)
		all_op();
	else if (lexval.ival == EXTEND)
		extend_op();	
	else if (lexval.ival == UPDATE)
		update_op();
	else if (lexval.ival == NOT)
		match(UNARY_OP);
	else //(lexval.ival == RENAME)
		rename_op();
}
static void eps_dd_intersect_list(node * list) {
node *l1, *l2;
    
for(l2=list; l2!=NULL; l2=l2->nodelink) {
 if(is_phi_access(l2))  continue;
    /* stop second loop after l1 reaches l2 */
    for( l1=list; l1 != NULL; l1 = (node *) ( l1==l2 ? NULL : l1->nodelink ) ){
	  if(is_phi_access(l1)) continue;
	  
          if ((store_op(l1->nodeop) && store_op(l2->nodeop))
            ||(update_op(l1->nodeop) && store_op(l2->nodeop))
            ||(store_op(l1->nodeop) && update_op(l2->nodeop)))
                 eps_dd_intersect(l1,l2,ddoutput,ddoutput);
           
          if ((store_op(l1->nodeop) && fetch_op(l2->nodeop))
            ||(update_op(l1->nodeop) && fetch_op(l2->nodeop))
            ||(store_op(l1->nodeop) && update_op(l2->nodeop)))
                 eps_dd_intersect(l1,l2,ddflow,ddanti);
           
          if ((fetch_op(l1->nodeop) && store_op(l2->nodeop))
            ||(fetch_op(l1->nodeop) && update_op(l2->nodeop))
            ||(update_op(l1->nodeop) && store_op(l2->nodeop)))
                 eps_dd_intersect(l1,l2,ddanti,ddflow);
          if (update_op(l1->nodeop) && update_op(l2->nodeop))
           {
              if (accesses_are_same_update_type(l1,l2))
                 eps_dd_intersect(l1,l2,ddreduce,ddreduce);
              else {
                 eps_dd_intersect(l1,l2,ddflow,ddanti);
                 eps_dd_intersect(l1,l2,ddanti,ddflow);
                 eps_dd_intersect(l1,l2,ddoutput,ddoutput);
                 }
            }
	} /* for l1 */
    }  /* for l2 */
}/* eps_dd_intersect_list */
Example #3
0
int fs_update(fs_query_state *qs, char *update, char **message, int unsafe)
{
    rasqal_query *rq = rasqal_new_query(qs->rasqal_world, "sparql11-update", NULL);
    if (!rq) {
        *message = g_strdup_printf("Unable to initialise update parser");

        return 1;
    }
    struct update_context uctxt;
    rasqal_world_set_log_handler(qs->rasqal_world, &uctxt, error_handler);

    memset(&uctxt, 0, sizeof(uctxt));
    uctxt.link = qs->link;
    uctxt.segments = fsp_link_segments(qs->link);
    uctxt.qs = qs;
    uctxt.rq = rq;
    raptor_uri *bu = raptor_new_uri(qs->raptor_world, (unsigned char *)"local:local");
    rasqal_query_prepare(rq, (unsigned char *)update, bu);
    if (uctxt.error) {
        if (uctxt.messages) {
            *message = build_update_error_message(uctxt.messages);
            g_slist_free(uctxt.messages);
        }
        return 1;
    }
    if (!quad_buffer) {
        quad_buffer = calloc(uctxt.segments, sizeof(struct quad_buf));
    }

    int ok = 1;
    for (int i=0; 1; i++) {
        rasqal_update_operation *op = rasqal_query_get_update_operation(rq, i);
        if (!op) {
            break;
        }
        uctxt.op = op;
        uctxt.opid = i;
        if (update_op(&uctxt)) {
            ok = 0;
            break;
        }
    }
    fsp_res_import_commit_all(qs->link);
    fsp_quad_import_commit_all(qs->link, FS_BIND_BY_SUBJECT);

    rasqal_free_query(rq);

    if (uctxt.messages) {
        *message = build_update_error_message(uctxt.messages);
        g_slist_free(uctxt.messages);
    }
    for (GSList *it=uctxt.freeable; it; it=it->next) {
        g_free(it->data);
    }
    g_slist_free(uctxt.freeable);

    raptor_free_uri(bu);

    if (ok) {
        return 0;
    } else {
        return 1;
    }
}
void one_sec_cmd_stats::update_ask_op(unsigned int bytes, unsigned int latency) {
    update_op(bytes, latency);
    m_ask++;
}
void one_sec_cmd_stats::update_moved_op(unsigned int bytes, unsigned int latency) {
    update_op(bytes, latency);
    m_moved++;
}
void one_sec_cmd_stats::update_op(unsigned int bytes, unsigned int latency,
                                  unsigned int hits, unsigned int misses) {
    update_op(bytes, latency);
    m_hits += hits;
    m_misses += misses;
}