/* 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)); }
/** * librdf_new_node_from_node: * @node: #librdf_node object to copy * * Copy constructor - create a new librdf_node object from an existing librdf_node object. * * Return value: a new #librdf_node object or NULL on failure **/ librdf_node* librdf_new_node_from_node(librdf_node *node) { LIBRDF_ASSERT_OBJECT_POINTER_RETURN_VALUE(node, librdf_node, NULL); return raptor_term_copy(node); }
/* * raptor_new_rss_block: * @world: world * @type: RSS block type * @block_term: Block subject term (shared) * * INTERNAL - Create a new RSS Block such as <author> etc * * Return value: new RSS block or NULL on failure */ raptor_rss_block* raptor_new_rss_block(raptor_world* world, raptor_rss_type type, raptor_term* block_term) { raptor_rss_block *block; block = RAPTOR_CALLOC(raptor_rss_block*, 1, sizeof(*block)); if(block) { block->rss_type = type; block->node_type = world->rss_types_info_uris[type]; block->identifier = raptor_term_copy(block_term); } return block; }