Example #1
0
void
librdf_statement_clear(librdf_statement *statement)
{
  LIBRDF_ASSERT_OBJECT_POINTER_RETURN(statement, librdf_statement);

  raptor_statement_clear(statement);
}
Example #2
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);

}