7¤0ìå» PKY7,ú1‚dàí£¾L DéÃèƒwÜyâÍY/¼ ÓbQûG66—›Ö©ówÜP(~@_¤­féï¦ÀO`e{©º��Næ“n$�•-ãF$ò˜L$èªö ‚ ����Šı@ á@( FAÃP 1 ‡’,„””•8‚’1dŒ!t when namespace prefix/URIs are declared in during parsing a syntax such as those in XML, RDF/XML or Turtle. A handler function can be set to receive these declarations using the namespace handler method.

  raptor_namespace_handler namespaces_handler;

  raptor_parser_set_namespace_handler(rdf_parser, user_data, namespaces_handler);

The namespaces_handler takes the following signature:

void
namespaces_handler(void* user_data, raptor_namespace *nspace)
{
  /*  */
}

This may be called multiple times with the same namespace, if the namespace is declared inside different XML sub-trees.

as a first child, but since there are no parent selectors * we can't use that. */ a.footnote { position: relative; top: 0em ! important; } /* this is needed so that the local anchors are diord type="constant" name="RAPTOR_OPTION_RELATIVE_URIS" link="raptor2-section-option.html#RAPTOR-OPTION-RELATIVE-URIS:CAPS"/> name="raptor_avltree_visit_handler ()" link="raptor2-section-avltree.html#raptor-avltree-visit-handler"/> s-2-0-10-to-2-0-11.html#raptor2-changes-new-2-0-10-to-2-0-11"/> OI‹9A‰ÀH� ›1Ò¾1Àè•bÿÿ¸éDN1íé PH‹} L‰îèØnÿÿ…Àu2H‹mH…íuçHƒÃI9Üt éÆO1íéÛOH‹\$L‹d$L‹l$ éÇOH‹\$L‹d$L‹l$ é³Oƒ¿uAƒ¿t8H‹‡XH…Àt,H� ’L‹GH9ÈuL‰Çé¨/H‹¿8‰ÑH‰òH‰þL‰ÇÿàøÃH‹rHÁå¶D( Àèƒà[]A\øÿÿÿÿëôH‹‹@I‰ÙE1ÀL‰ïH‹$è²6érTH‹shI‹}H…ö„èGnÿÿH…À„I‹}H‰ÆH‰D$èÍWÿÿH‹|$H‰ƒPèduÿÿ1ÀH‰ChH‹ƒPH…À„âǃH‹pL‰ïè0jÿÿH‹‹P…À„ŒH‹SH‰ÞL‰ïèÒCéUPM‹}H‹<$I‹·°èYmÿÿ…À„¦SA‹„$`L‰ÿ�pA‰´$`Ç@Lé†ÞH‰t$è¯wÿÿH‹t$H…ÀI‰À…pÞH‹}1ɉOLè�wÿÿI‰ÀH‹EÇ@LéJÞÃèG�ÿÿéýÞèÍ}ÿÿéÄÞH�ìØL‰D$@L‰L$H„Àt7)D$P)L$`)T$p)œ$€)¤$�)¬$ )´$°)¼$ÀdH‹%(H‰D$1ÀH�„$àI‰àÇ$ H‰D$H�D$ H‰D$ÇD$0è¾yÿÿH‹D$dH+%(tè)ƒÿÿH�ÄØÃ褎ÿÿé—-H‹¿é{ƒÿÿ1ÀH‰Åé|.L‰çèiuÿÿ€}….H‹$H‹l$L‰ïL‹d$L‹l$HƒÄ(éŠÿÿÆH‹ $éžßL‹-…ŠH…ÛtI‹uH‰ßè~ÿÿI‹u¿ èNwÿÿI‹Mº¾H�=�Mèd‰ÿÿH�½sI‹uJ‹<ðè�}ÿÿI‹Mº¾H�=¨Qè6‰ÿÿI‹}L‰âH‰îèGvÿÿI‹u¿ èévÿÿH‹\$H‹l$L‹d$ L‹l$(é%ßè‹�ÿÿé©.è™�ÿÿ1ÀH‰EHH‰EPé@.è­‡ÿÿ1ÒH‰UXé#.èýwÿÿ1ÉH‰M`é.HƒÃL9ã„Ø-é±-H‹‘‰L�²k¹H�MH�5WH‹81Àèu‰ÿÿ¸ÿÿÿÿZÃH‹_‰L�€k¹H�ÖLH�5mH‹81ÀèC‰ÿÿëÌÃH‰Çèoÿÿé߸éÁßè´vÿÿH‹s8I‹|$@L‰òH‰Áè†ÿÿ…À„º6L‰òH�5¥LH‰ß1ÀèÔ‚ÿÿALJ½éw3H‹C8H‰D$ée2H¸I‰‡éS3H‹²¨L‰ïL‰D$è·„ÿÿL‹D$…Àt¸½é¿6A€<$_uƒ{xu¸½é£6é3H‹5OˆD‰t$M‰îM‰ÅL‰|$0A‰ï‰ÅH‰t$@H‰\$8H‰óH‹;H…ÿ„"L‰æè1Œÿÿ…À…Û‰èH‹t$@M‰èD‰ýHÁàM‰õL‹|$0D‹t$H‹\$8öD …sÿÿÿL‰âH�5ñH‰ß1ÀèÇ�ÿÿALJéîþÿÿL‰âH�5H‰ß1Àè£�ÿÿALJéÊþÿÿƒ»ˆt4H�5ÜKL‰çèËnÿÿ…Àu!H¸ ALJ I‰‡é2ƒ»°„f>L‰âH�5'H‰ß1ÀèEpÿÿéM>L‰âH�5FH‰ß1Àè�ÿÿL‹l$pL‹t$xALJ ALJév1H‹\$8L‰â1ÀL‰l$@H�5)M‰õD‰ýD‹t$H‰ßL‹|$0èÙoÿÿL‹D$@éWþÿÿƒ»�„uIƒX…8Iƒ`…-1ÒH‹t$H‹;H‰L$I‰WPL‰êèáqÿÿI‰ÄH…À„YH‹;H‰Æèj‡ÿÿL‰çI‰‡0苊ÿÿIƒ¿0„«L‰îH‰ßèÿÿ…Àt^L‰îH‰ßèÓm…Àu#L‰ïèÿ‰ÿÿH�5?JH‰ß1Àè&oÿÿH‹L$é:0H‰ßL‰êH�5G1ÀèøÿÿL‰ïALJ>H‰Çè‹ÌÿÿH‰Þ¿>è>¼ÿÿH‰ïèÞÏÿÿé~O¸évOH�=…¡éÿAVAUATUSHƒìdH‹,%(H‰l$H‰õH¯êƒy …´‹�<I‰ÖI‰üI‰õH‰Ë�P‰‘<…ÀuMHƒ¹ÀuCH‹y0H‰â¾èf¯ÿÿ…Àu.H‹4$H‹;èÆÀÿÿH‰ƒÀH‰ÂH‹ƒÐH…Àt H‹³ÈH‰ßÿÐH‹ƒ`H…Àt6H�[H‹»XH9Ðu¹H‰êL‰æè5¯ÿÿëH‰þM‰ðL‰éL‰âH‰ßÿÐHkë1íH‹D$dH+%(tèEÃÿÿHƒÄH‰è[]A\A]A^ÀK0éH‹»è ½ÿÿ1ÒH‰“¸é‰D$èäÎÿÿ‹D$éÄÿL‰æH‰ßè Çÿÿé¦ÿH‹»èÏÆÿÿébÿH‹»1Òè<¹ÿÿ…Àu±é'ÿH‹5\ÉH‰ÚèTÊÿÿéÂþH‹“àèCÊÿÿé±þ虼ÿÿéþH…ÿtH‰L$è…¼ÿÿH‹L$H‹;H‰ÎèU±ÿÿH‰ƒH…À„NÿÿÿH‰Çé<þºé H‰T$H‰4$è%ÎÿÿH‹4$H‹T$é¬ÿÃH‰÷H‰ÖH‰Ê¹I¯Ðéß­ÿÿSH�5'¡H‰û蟳ÿÿ…ÀuH‰ßès´ÿÿH‰ßH�™›1ö[éá¹ÿÿ1À[ÃH‰ïèe*¸é-1ɉ�ÐéòAWAVI‰öH�5  AUI‰ýATUH‰ÕSQè>³ÿÿ…ÀuLH…íu2H‹fÉL�w 1Û¹vH�X…H�5r@H‹81ÀèHÉÿÿé¤L‰ïèÛ³ÿÿD‹}A�Gÿƒøv1ÛéˆH‹E0Aƒÿu1Hƒ}t#E1ä¾(H…À¿A•Äè�ÄÿÿH‰ÃH…ÀuëTHƒ} uÖH…Àt¹ëÏL‰(H‰hL‰pAƒÿuHƒ}uHƒ} tAƒÌH‹ED‰c H…ÀtL‰÷ÿÐ…Àt H‰ßè\ÌÿÿéqÿÿÿZH‰Ø[]A\A]A^A_ÃH‰ê¾H�=¡„èÂÿÿé¼MAöÅ„¹€ù„ÿH�T$H‰ÞL‰ÿèÆÿÿ‰D$ …ÀˆZ‰ÆH9ó‚,AöÅ…hH‹D$H‰ê¾‰D$H=ÿÿ‡ãH�=#„èªÁÿÿ‹|$H‰ê¾èYÇÿÿ‹D$ �PÿI�H)Óé8LH‰ê¾D‰D$H�=æƒèmÁÿÿ‹|$H‰ê¾èÇÿÿL‰øéLAöÅ…FÿÿÿéàK€ù\tN-Triples serializer - default (name ntriples)
RDF/XML serializer (name rdfxml)
RDF/XML (Abbreviated) serializer (name rdfxml-abbrev)
RDF/XML (XMP Profile) serializer (name rdfxml-xmp)
Turtle serializer (name turtle)
RSS 1.0 serializer (name rss-1.0)
GraphViz dot serializer (name dot)

Introduction

This section describes the serializers that can be compiled into Raptor and their options. The exact serializers supported may vary by different builds of raptor and can be queried at run-time by use of the Next

Raptor Overview

Raptor is a free software / Open Source C library that provides a set of parsers and serializers that generate Resource Description Framework (RDF) triples by parsing syntaxes or serialize the triples into a syntax. It also includes supporting functionality for managing Unicode, UTF-8, URIs, retrieving from URIs and reading and writing XML.

Serializers in Raptor (triples to syntax): Raptor RDF Syntax Library Manual

If true (default false), the RDF/XML parser will look for embedded rdf:RDF elements inside the XML content, and not require that the XML start with an rdf:RDF root element.

 

RAPTOR_OPTION_ALLOW_NON_NS_ATTRIBUTES

If true (default true) then the RDF/XML parser will allow non-XML namespaced attributes to be accepted as well as rdf: namespaced ones. For example, 'about' and 'ID' will be interpreted as if they were rdf:about and rdf:ID respectively.

 

RAPTOR_OPTION_ALLOW_OTHER_PARSETYPES

If true (default true) then the RDF/XML parser will allow unknown parsetypes to be present and will pass them on to the user. Unimplemented at present.

 

RAPTOR_OPTION_ALLOW_BAGID

If true (default true) then the RDF/XML parser will support the rdf:bagID attribute that was removed from the RDF/XML language when it was revised. This support may be removed in futur-trig with q 1.0

Turtle Terse RDF Triple Language (turtle)

  • text/turtle with q 1.0

  • application/x-turtle with q 1.0

  • application/turtle with q 1.0

  • text/n3 with q 0.3

  • text/rdf+n3 with q 0.3

  • application/rdf+n3 with q 0.3

MIME Types by Serializer: Raptor RDF Syntax Library Manual char *label;

long descriptive label for syntax

 

const raptor_type_q *mime_types;

Array of (MIME type, Q) values associated with the syntax (or NULL). If present the array is NULL terminated.

 

unsigned int mime_types_count;

size of mime_types array

 

const char *uri_strings;

array of URIs identifying the syntax (or NULL). The first one if present is the main URI, the rest are aliases. The arrascription-validate.returns">

Returns

non-0 on failure

Types and Values

RAPTOR_VERSION

#define RAPTOR_VERSION 20016

Raptor library version number

Format: major * 10000 + minor * 100 + release


RAPTOR_VERSION_MAJOR

#define RAPTOR_VERSION_MAJOR 2

Raptor library major version


RAPTOR_VERSION_MINOR

#define RAPTOR_VERSION_MINOR 0

Raptor library minor version


RAPTOR_VERSION_RELEASE

#define RAPTOR_VERSION_RELEASE 16

Raptor library release


RAPTOR_VERSION_STRING

#define RAPTOR_VERSION_STRING "2.0.16"

Raptor library version string


raptor_version_major

extern const unsigned int raptor_version_major;

Library major version number as a decimal integer.

on-general.html#raptor-rdf-schema-namespace-uri" title="raptor_rdf_schema_namespace_uri">raptor_rdf_schema_namespace_uri extern const unsigned char * const raptor_xml_literal_datatype_uri_string extern const unsigned char * const raptor_xml_namespace_uri extern const unsigned char * const raptor_xmlschema_datatypes_namespace_uri   raptor_log_message enum raptor_log_level enum raptor_qname *qname, size_t *length_p);

Format a qname in an XML style into a newly allocated string.

Generates a string of the form a:b="value" or a="value" depending on the qname's prefix. Double quotes are always used.

If length_p is not NULL, the length of the string is stored in the address it points to.

Parameters

qname

qname object

 

length_p

pointer to length (or NULL)

 

Returns

qname formatted as newly allocated string or NULL on failure


raptor_qname_get_counted_value ()

name2

second raptor_name

 

Returns

non-0 if the qnames are equal.


raptor_qname_string_to_uri ()

raptor_uri *
raptor_qname_string_to_uri (raptor_namespace_stack *nstack,
                            const char *name,
                            size_t name_len);

Get the URI for a qname.

Utility function to turn a string representing a QName in the N3 style, into a new URI representing it. A NULL name or name ":" returns the default namespace URI. A name "p:" returns namespace name (URI) for the namespace with prefix "p".

Partially equivalent to qname = raptor_new_qname(nstack, name, NULL); uri = raptor_uri_copy(qname->uri); raptor_free_qname(qname) but without making the qnogramlisting">void * raptor_calloc_memory (size_t nmemb, size_t size);

Allocate zeroed array of items inside raptor.

Some systems require memory allocated in a library to be deallocated in that library. This function allows memory to be allocated inside the raptor shared library that can be freed inside raptor either internally or via raptor_free_memory.

Examples include using this in the raptor_world_generate_bnodeid() handler code to create new strings that will be used internally as short identifiers and freed later on by the parsers.

Parameters

d_guess_parser_name

nmemb

number of members

 

size

size of item raptor_sequence_next_permutation (raptor_sequence *seq, raptor_data_compare_handler compare);

Get the next permutation of a sequence in lexicographic order

Assumes the initial order of the items is lexicographically increasing. This function alters the order of the items until the last permuatation is done at which point the contents is reset to the intial order.

Algorithm used is described in http://en.wikipedia.org/wiki/Permutation

The comparison function compare is compatible with that used for qsort() and provides the addresses of pointers to the data that must be dereferenced to get to the stored sequence data.

Parameters

seq

JSON parser (name json)

A parser for both the resource-centric RDF/JSON syntax as defined by Talis at RDF/JSON Specification and the triples-centric formeter_description">

SAX2 object

 

handler

entity reference handler

 

raptor_sax2_set_namespace_handler ()

void
raptor_sax2_set_namespace_handler (raptor_sax2 *sax2,
                                   raptor_namespace_handler handler);

Set the XML namespace handler function.

When a prefix/namespace is seen in an XML parser, call the given handler with the prefix string and the raptor_uri namespace URI. Either can be NULL for the default prefix or default namespace.

The handler function does not deal with duplicates so any namespace may be declared multiple times when a namespace is seen in different parts of a document.void

raptor_sax2_set_unparsed_entity_decl_handler ()
void raptor_sax2_set_external_entity_ref_handler ()
void raptor_sax2_set_namespace_handler ()
void raptor_sax2_set_uri_filter ()
void raptor_sax2_parse_start tle="raptor_free_sax2 ()">raptor_free_sax2 ()
void (*raptor_sax2_start_element_handler) ()
void (*raptor_sax2_end_element_handler) ()
void (*raptor_sax2_characters_handler) ()
void ( int raptor_syntaxes_enumerate_v2(raptor_world* world, const unsigned int counter, const char* *name, const char* *label, const char* *mime_type, const unsigned char* *uri_string) raptor_syntax_description* raptor_world_get_parser_description(raptor_world* world, const unsigned int counter)  
int raptor_unicode_char_to_utf8(raptor_unichar c, unsigned char* output) int raptor_unicode_utf8_string_put_char(raptor_unichar c, unsigned char* output, size_t length)  
unsigned char* raptor_uri_as_counted_string_v2(raptor_world* world, raptor_uri *uri, size_t* len_p) unsigned char* raptor_uri_as_counted_string(raptor_uri *uri, size_t* len_p)  
unsigned char* raptor_uri_as_string_v2(raptor_world* world, raptor_uri *uri) unsigned char* raptor_xml_element_write(raptor_xml_element *element, raptor_namespace_stack *nstack, int is_empty, int is_end, int depth, raptor_iostream *iostr)  
int raptor_iostream_write_xml_escaped_string(raptor_iostream* iostr, const unsigned char* string, size_t len, char quote, raptor_simple_message_handler error_handler, void *error_data) int raptor_xml_escape_string_write(const unsigned char* string, size_t len, char quote, raptor_iostream* iostr)  
const char* raptor_locator_uri_v2(raptor_world* world, raptor_locator *locator) const char* raptor_locator_uri(raptor_locator *locator)  
int raptor_namespaces_init(raptor_namespace_stack *nstack, const raptor_uri_handler *uri_handler, void *uri_context, raptor_simple_message_handler error_handler, void *error_data, int defaults) int raptor_namespaces_initRAPTOR_DOMAIN_PARSER
int raptor_features_enumerate_v2(raptor_world* world, const raptor_feature feature, const char* *name, raptor_uri **uri, const char* *label) raptor_option_description* raptor_world_get_option_description(raptor_world* world, const raptor_domain domain, const raptor_option option) Call with domain = RAPTOR_DOMAIN_PARSER
int raptor_format_locator_v2(raptor_world* world, char* buffer, size_t length, raptor_locator* locator) int raptor_locator_format(char* buffer, size_t length, raptor_locator* locator)  
void raptor_free_uri_v2(raptor_world* world, raptor_uri *uri) void raptor_free_uri(raptor_uri *uri)  
int raptor_get_feature(raptor_parser *parser, raptor_feature feature)  
raptor_namespace_copy raptor_namespace_stack_start_namespace  
raptor_namespaces_format raptor_namespace_format_as_xml  
raptor_namespaces_qname_from_uri raptor_new_qname_from_namespace_uri  
raptor_new_namespace_parts_from_string raptor_xml_namespace_string_parse  
raptor_new_parser_for_content_v2 raptor_new_parser_for_contentRAPTOR_OPTION_VALUE_TYPE_STRING

  • RAPTOR_OPTION_VALUE_TYPE_URI

  • RAPTOR_WORLD_FLAG_URI_INTERNING

  • RAPTOR_WORLD_FLAG_WWW_SKIP_INIT_FINISH

  • Deleted functions, types, enums and constants

    Functions

     

    hex

    integer to format

     

    Returns

    non-0 on failure


    raptor_stringbuffer_append_string ()

    int
    raptor_stringbuffer_append_string (raptor_stringbuffer *stringbuffer,
                                       const char *string,
                                       int do_copy);

    Add a string to the stringbuffer.

    If string is NULL, no work is performed.

    If do_copy is non-0, the passed-in string is copied into new memory otherwise the stringbuffer becomes the owner of the string pointer and will free it when the stringbuffer is destroyed.

    ion-stringbuffer.html#raptor-stringbuffer-append-hexadecimal" title="raptor_stringbuffer_append_hexadecimal ()">raptor_stringbuffer_append_hexadecimal () int raptor_stringbuffer_append_string () int raptor_stringbuffer_append_stringbuffer () int raptor_stringbuffer_append_uri_escaped_counted_string () int

    The file: URI to convert

     

    Returns

    A newly allocated string with the filename or NULL on failure


    raptor_uri_uri_string_to_filename_fragment ()

    char *
    raptor_uri_uri_string_to_filename_fragment
                                   (const char *uri_string,
                                    unsigned char **fragment_p);

    Convert a file: URI to a filename and fragment.

    Handles the OS-specific file: URIs to filename mappings. Returns a new buffer containing the filename that the caller must free.

    If fragment_p is given, a new string containing the URI fragment is returned, or NULL if none is present

    See also raptor_uri_uri_string_to_counted_filename_fragment()

    Returns

    shared string representation of URI


    raptor_uri_to_relative_counted_uri_string ()

    unsigned char *
    raptor_uri_to_relative_counted_uri_string
                                   (raptor_uri *base_uri,
                                    raptor_uri *reference_uri,
                                    size_t *length_p);

    Get the counted relative URI string of a URI against a base URI.< * raptor_uri_to_string () size_t raptor_uri_resolve_uri_reference () unsigned char * raptor_uri_counted_filename_to_uri_string () unsigned char * raptor_uri_filename_to_uri_string () int raptor_uri_uri_string_is_absoluteÂss="link" href="raptor2-section-uri.html#raptor-uri" title="raptor_uri">raptor_uri * raptor_new_uri_relative_to_base_counted () raptor_uri * raptor_new_uri_from_id () raptor_uri * raptor_new_uri_for_rdf_concept () raptor_uri * raptor_new_uri_for_xmlbase >

    AVL Tree object

     

    visit_handler

    visit function to call at each item

     

    user_data

    user data pointer fo visit function

     

    Returns

    non-0 if traversal was terminated early by visit_handler


    raptor_new_avltree_iterator ()

    raptor_avltree_iterator *
    raptor_new_avltree_iterator (raptor_avltree *tree,
                                 void *range,
                                 raptor_avltree_add ()
    
    
    
    
    int
    
    
    raptor_avltree_delete ()
    
    
    
    
    int
    
    
    raptor_avltree_print ()
    
    
    
    
    void *
    
    
    raptor_avltree_remove ()
    
    
    
    
    void *
    
    
    raptor_avltree_search ()
    
    
    
    
    void
    
    
    raptor_avltree_set_print_handler ode>,
                                    FILE *fh);

    Start serializing to a FILE*.

    NOTE: This does not fclose the handle when it is finished.

    Parameters

    rdf_serializer

    the raptor_serializer

     

    uri

    base URI or NULL if no base URI is required

     

    fh

    FILE* to serialize to

     

    Returns

    non-0 on failure.


    raptor_serializer_set_namesption_name"> raptor_serializer_get_locator () int raptor_serializer_set_option () int raptor_serializer_get_option () raptor_world * raptor_serializer_get_world ()

    Types and Values

    Members

    RAPTOR_TERM_TYPE_UNKNOWN

    Internal

     

    RAPTOR_TERM_TYPE_URI

    RDF URI

     

    RAPTOR_TERM_TYPE_LITERAL

    RDF literal

     

    RAPTOR_TERM_TYPE_BLANK

    RDF blank node

     

    raptor_term

    typedef struct {
      raptor_world* world;
    
      int usage;
    
      raptor_term_type type;
    
      raptor_term_value value;
    } raptor_term;
    

    An RDF statement term

    base_uri

    base URI

     

    len_p

    Pointer to location to store length of new string (if not NULL)

     

    Returns

    the new string or NULL on failure. The length of the new string is returned in *len_p if len_p is not NULL.


    raptor_term_to_turtle_string ()

    unsigned char *
    raptor_term_to_turtle_string (raptor_term *term,
                                  raptor_namespace_stack *nstack,
                                  raptor_uri *base_uri);

    Convert

    uri_string

    UTF-8 encoded URI string.

     

    Returns

    new term or NULL on failure


    raptor_new_term_from_counted_string ()

    raptor_term *
    raptor_new_term_from_counted_string (raptor_world *world,
                                         unsigned char *string,
                                         size_t length);

    Constructor - create a new term from a Turtle / N-Triples format string in UTF-8

    See also raptor_term_to_counted_string() and blank

    If blank is NULL or an empty string, creates a new internal identifier and uses it. This will use the handler set with raptor_world_set_generate_bnodeid_parameters()

    Parameters

    world

    raptor world

     

    blank

    UTF-8 encoded blank node identifier (or NULL)

     

    Returns

    new term or NULL on failure


    raptor_new_term_from_counted_blank ()

    Serializing RDF triples to a syntax

    Introduction
    Create the Serializer object
    Serializer options
    Declare namespaces
    Set error and warning handlers
    Provide a destination for the serialized syntax
    Serialize to a filename (raptor_serializer_start_to_filename())
    Serialize to a string (raptor_serializer_start_to_string())
    Serialize to a FILE* file handle (Prev Next

    Changes between raptor2 2.0.14 and 2.0.15

    New functions, types, enums and constants

    Functions

    • void raptor_sequence_sort_r(raptor_sequence* seq, raptor_data_compare_arg_handler compare, void* user_data) - Uses raptor_sort_r() internally.

    • void raptor_sort_r(void *base, size_t nel, size_t width, raptor_data_compare_arg_handler compar, void *user_data)

      raptor_iostream_read_eof_func read_eof;

      read EOF handler - required (for reading) (V2)

       

    enum raptor_escaped_write_bitflags

    Bit flags for raptor_string_escaped_write() and friends.

    Members

    RAPTOR_ESCAPED_WRITE_BITFLAG_BS_ESCAPES_BF

    Allow \b \f,

     

    RAPTOR_ESCAPED_WRITE_BITFLAG_BS_ESCAPES_TNRU

    raptor_string_python_write is deprecated and should not be used in newly-written code.

    Write a UTF-8 string using Python-style escapes (N-Triples, Turtle, JSON, mKR) to a raptor_iostream

    Deprecated : use raptor_string_escaped_write() where the features requested are bits that can be individually chosen.

    Parameters

    string

    UTF-8 string to write

     

    len

    length of UTF-8 string

     

    delim

    Terminating delimiter character for string (such as " or >l.html#raptor-data-malloc-handler" title="raptor_data_malloc_handler ()">raptor_data_malloc_handler const malloc_handler);

    Constructor - create a new iostream writing to a string.

    If malloc_handler is null, raptor will allocate it using it's own memory allocator. *string_p is set to NULL on failure (and *length_p to 0 if length_p is not NULL).

    Parameters

    world

    raptor world

     

    string_p

    pointer to location to hold string

     

    length_p

    pointer to location to hold length of string (or NULL)

     

    malloc_handler

    context

    stream context data

     

    byte

    byte to write

     

    Returns

    non-0 on failure.


    raptor_iostream_write_bytes_func ()

    int
    (*raptor_iostream_write_bytes_func) (void *context,
                                         const void *ptr,
                                         size_t size,
                                         size_t nmemb);

    Handler function for implementing raptor_iostream_write_bytes().

    Destroy the serializer

    To tidy up, delete the serializer object as follows:

      raptor_free_serializer(rdf_serializer);
    

    section-iostream: Raptor RDF Syntax Library Manual

    Returns

    option value or < 0 for an illegal option


    raptor_parser_get_accept_header ()

    const char *
    raptor_parser_get_accept_header (raptor_parser *rdf_parser);

    Get an HTTP Accept value for the parser.

    The returned string must be freed by the caller such as with raptor_free_memory()raptor_parser *rdf_parser);

    Abort an ongoing parsing.

    Causes any ongoing generation of statements by a parser to be terminated and the parser to return controlto the application as soon as draining any existing buffers.

    Most useful inside raptor_parser_parse_file() or raptor_parser_parse_uri() when the Raptor library is directing the parsing and when one of the callback handlers such as as set by raptor_parser_set_statement_handler() requires to return to the main application code.

    Parameters

    rdf_parser

    raptor_parser object

     

    raptor_graph_mark_handler ()

    void
    (*raptor_graph_mark_handler) (void *user_data,
                                  raptor_uri *graph,
                                  int flags);

    Graph start/end mark handler function.

    Records start and end of graphs happening in a stream of generated raptor_statement via the statement handler. The callback starts a graph when flags has RAPTOR_GRAPH_MARK_START bit set.

    The start and ends may be either declared in the syntax via some keyword or mechanism such as TRiG {} syntax when < string, a Unicode string and a language or a Unicode string and a datatype URI.

    The statement terms are all instances of raptor_term objects constructed with the appropriate constructor for the URI, blank node or rdf literal types. The graph term of the statement is typically a URI or blank node.

    Example 3. rdfserialize.c: Serialize 1 triple to RDF/XML (Abbreviated)

    #include <stdio.h>
    #include <raptor2.h>
    #include <stdlib.h>
    
    /* rdfserialize.c: serialize 1 triple to RDF/XML-Abbrev */
    
    int
    main(int argc, char *argv[])
    {
      raptor_world *world = NULL;
      raptor_serializer* rdf_serializer = NULL;
      unsigned char *uri_string;
      raptor_uri *base_uri;
      raptor_statement* triple;
    
      world = raptor_new_world();
      
      uri_string = raptor_uri_filename_to_uri_string(argv[1]);
      base_uri = raptor_new_uri(world, uri_string);
    
      rdf_serializer = raptor_new_serializer(world, "rdfxml-abbrev");
      raptor_serializer_start_to_file_handle(rdf_serializer, base_uri, stdout);
      
      /* Make a triple with URI subject, URI predicate, literal object */
      triple = raptor_new_statement(world);
      triple->subject = raptor_new_term_from_uri_string(world, (const unsigned char*)"http://example.org/torial-serializer-create">Create the Serializer object

    The serializer can be created directly from a known name using raptor_new_serializer() such as rdfxml for the W3C Recommendation RDF/XML syntax:

      raptor_serializer* rdf_serializer;
    
      rdf_serializer = raptor_new_serializer(world, "rdfxml");
    

    or the name can be discovered from an description as discussed in Querying Functionality

    RDF/XML (XMP Profile) serializer (name rdfxml-xmp): Raptor RDF Syntax Library Manual raptor_syntax_description_validate ()
    raptor_term, raptor_term
    raptor_term_blank_value, raptor_term_blank_value
    raptor_term_compare, raptor_term_compare ()
    raptor_term_copy, raptor_term_copy ()
    raptor_term_equals, raptor_term_equals ()
    raptor_term_escaped_write, raptor_term_escaped_write ()
    raptor_term_literal_value, raptor_term_literal_value
    raptor_term_ntriples_write, raptor_term_ntriples_write ()
    raptor_term_to_counted_string, raptor_serializer_start_to_string ()
    raptor_short_copyright_string, raptor_short_copyright_string
    raptor_snprintf, raptor_snprintf ()
    raptor_sort_r, raptor_sort_r ()
    raptor_statement, raptor_statement
    raptor_statement_clear, raptor_statement_clear ()
    raptor_statement_compare, raptor_statement_compare ()
    raptor_statement_copy, raptor_statement_copy ()
    raptor_statement_equals, raptor_statement_equals ()
    raptor_statement_handler, raptor_namespace_write ()
    raptor_new_avltree, raptor_new_avltree ()
    raptor_new_avltree_iterator, raptor_new_avltree_iterator ()
    raptor_new_iostream_from_filename, raptor_new_iostream_from_filename ()
    raptor_new_iostream_from_file_handle, raptor_new_iostream_from_file_handle ()
    raptor_new_iostream_from_handler, raptor_new_iostream_from_handler ()
    raptor_new_iostream_from_sink, raptor_new_iostream_from_sink ()
    raptor_new_iostream_from_string, raptor_new_iostream_from_string ()
    raptor_new_iostream_to_filenamespace">raptor_free_namespace ()
    raptor_free_namespaces, raptor_free_namespaces ()
    raptor_free_option_description, raptor_free_option_description ()
    raptor_free_parser, raptor_free_parser ()
    raptor_free_qname, raptor_free_qname ()
    raptor_free_sax2, raptor_free_sax2 ()
    raptor_free_sequence, raptor_free_sequence ()
    raptor_free_serializer, raptor_free_serializer ()
    raptor_free_statement, raptor_free_statement ()
    raptor_free_stringbuffer, raptor_free_stringbuffer (raptor2-section-option.html#raptor-option" title="enum raptor_option">raptor_option option, char *string, int integer);

    Set xml_writer option.

    If string is not NULL and the option type is numeric, the string value is converted to an integer and used in preference to integer .

    If string is NULL and the option type is not numeric, an error is returned.

    The string values used are copied.

    The allowed options are available via raptor_world_get_option_description().

    Parameters

    xml_writer

    raptor_iostream *iostr);

    Constructor - Create a new XML Writer writing XML to a raptor_iostream

    Parameters

    world

    raptor_world object

     

    nstack

    Namespace stack for the writer to start with (or NULL)

     

    iostr

    I/O stream to write to

     

    Returns

    a new raptor_xml_writer object or NULL on failure


    raptor_free_xml_writer ()<-xml-element" title="raptor_xml_element">raptor_xml_element

    typedef raptor_xml_writer

    Description

    Functions

    raptor_new_xml_element ()

    raptor_xml_element *
    raptor_new_xml_element (raptor_qname *name,
                            const unsigned char *xml_language,
                            raptor_uri *xml_base);

    Constructor - create a new XML element from a QName

    The xml_language and xml_base become owned by the new object.

    section-xml

    section-xml

    Returns

    non 0 if name is a known syntax name


    raptor_world_guess_parser_name ()

    const char *
    raptor_world_guess_parser_name (raptor_world *world,
                                    raptor_uri *uri,
                                    const char *mime_type,
                                    const char *buffer,
                                    size_t len,
                                    const unsigned char *identifier);

    Guess a parser name for content.

    Find a parser by scoring recognition of the syntax by a block of characters, the content identifier or a mime type. The content identifier is typically a filename or URI or some other identifier.

    Returns

    0 on success, non-0 on failure: <0 on errors and >0 if world is already opened


    raptor_world_set_log_handler ()

    int
    raptor_world_set_log_handler (raptor_world *world,
                                  void *user_data,
                                  raptor_log_handler handler);

    Set the message (error, warning, info) handling function.

    The function will receive callbacks when messages are generated

    Parameters

    k rel="next" href="tutorial-parser-abort.html" title="Aborting parsing">

    world

    world object

     

    Querying parser run-time information

    raptor_parser_