raptor.h | raptor.h | |||
---|---|---|---|---|
/* -*- Mode: c; c-basic-offset: 2 -*- | /* -*- Mode: c; c-basic-offset: 2 -*- | |||
* | * | |||
* raptor.h - Redland Parser Toolkit for RDF (Raptor) interfaces and defini tion | * raptor.h - Redland Parser Toolkit for RDF (Raptor) interfaces and defini tion | |||
* | * | |||
* $Id: raptor.h,v 1.48 2002/11/02 16:26:30 cmdjb Exp $ | * $Id: raptor.h,v 1.53 2002/12/19 22:08:28 cmdjb Exp $ | |||
* | * | |||
* Copyright (C) 2000-2001 David Beckett - http://purl.org/net/dajobe/ | * Copyright (C) 2000-2001 David Beckett - http://purl.org/net/dajobe/ | |||
* Institute for Learning and Research Technology - http://www.ilrt.org/ | * Institute for Learning and Research Technology - http://www.ilrt.org/ | |||
* University of Bristol - http://www.bristol.ac.uk/ | * University of Bristol - http://www.bristol.ac.uk/ | |||
* | * | |||
* This package is Free Software or Open Source available under the | * This package is Free Software or Open Source available under the | |||
* following licenses (these are alternatives): | * following licenses (these are alternatives): | |||
* 1. GNU Lesser General Public License (LGPL) | * 1. GNU Lesser General Public License (LGPL) | |||
* 2. GNU General Public License (GPL) | * 2. GNU General Public License (GPL) | |||
* 3. Mozilla Public License (MPL) | * 3. Mozilla Public License (MPL) | |||
skipping to change at line 30 | skipping to change at line 30 | |||
*/ | */ | |||
#ifndef RAPTOR_H | #ifndef RAPTOR_H | |||
#define RAPTOR_H | #define RAPTOR_H | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
#ifdef WIN32 | #ifdef WIN32 | |||
#ifdef RAPTOR_INTERNAL | # ifdef RAPTOR_INTERNAL | |||
#define RAPTOR_API _declspec(dllexport) | # define RAPTOR_API _declspec(dllexport) | |||
#else | # else | |||
#define RAPTOR_API _declspec(dllimport) | # define RAPTOR_API _declspec(dllimport) | |||
#endif | # endif | |||
#else | #else | |||
#define RAPTOR_API | # define RAPTOR_API | |||
#endif | #endif | |||
typedef void* raptor_uri; | typedef void* raptor_uri; | |||
/* Public structure */ | /* Public structure */ | |||
typedef struct raptor_parser_s raptor_parser; | typedef struct raptor_parser_s raptor_parser; | |||
typedef enum { | typedef enum { | |||
RAPTOR_IDENTIFIER_TYPE_UNKNOWN, /* Unknown type - illegal */ | RAPTOR_IDENTIFIER_TYPE_UNKNOWN, /* Unknown type - illegal */ | |||
RAPTOR_IDENTIFIER_TYPE_RESOURCE, /* Resource URI (e.g. rdf:abo ut) */ | RAPTOR_IDENTIFIER_TYPE_RESOURCE, /* Resource URI (e.g. rdf:abo ut) */ | |||
RAPTOR_IDENTIFIER_TYPE_ANONYMOUS, /* _:foo N-Triples, or genera ted */ | RAPTOR_IDENTIFIER_TYPE_ANONYMOUS, /* _:foo N-Triples, or genera ted */ | |||
RAPTOR_IDENTIFIER_TYPE_PREDICATE, /* Predicate URI */ | RAPTOR_IDENTIFIER_TYPE_PREDICATE, /* Predicate URI */ | |||
RAPTOR_IDENTIFIER_TYPE_ORDINAL, /* rdf:li, rdf:_<n> etc. */ | RAPTOR_IDENTIFIER_TYPE_ORDINAL, /* rdf:li, rdf:_<n> etc. */ | |||
RAPTOR_IDENTIFIER_TYPE_LITERAL, /* regular literal */ | RAPTOR_IDENTIFIER_TYPE_LITERAL, /* regular literal */ | |||
RAPTOR_IDENTIFIER_TYPE_XML_LITERAL, /* rdf:parseType="Literal" */ | RAPTOR_IDENTIFIER_TYPE_XML_LITERAL /* rdf:parseType="Literal" */ | |||
} raptor_identifier_type; | } raptor_identifier_type; | |||
typedef enum { RAPTOR_URI_SOURCE_UNKNOWN, RAPTOR_URI_SOURCE_NOT_URI, RAPTOR _URI_SOURCE_ELEMENT, RAPTOR_URI_SOURCE_ATTRIBUTE, RAPTOR_URI_SOURCE_ID, RAP TOR_URI_SOURCE_URI, RAPTOR_URI_SOURCE_GENERATED, RAPTOR_URI_SOURCE_BLANK_ID } raptor_uri_source; | typedef enum { RAPTOR_URI_SOURCE_UNKNOWN, RAPTOR_URI_SOURCE_NOT_URI, RAPTOR _URI_SOURCE_ELEMENT, RAPTOR_URI_SOURCE_ATTRIBUTE, RAPTOR_URI_SOURCE_ID, RAP TOR_URI_SOURCE_URI, RAPTOR_URI_SOURCE_GENERATED, RAPTOR_URI_SOURCE_BLANK_ID } raptor_uri_source; | |||
typedef struct { | typedef struct { | |||
raptor_uri *uri; | raptor_uri *uri; | |||
const char *file; | const char *file; | |||
int line; | int line; | |||
int column; | int column; | |||
int byte; | int byte; | |||
skipping to change at line 75 | skipping to change at line 75 | |||
RAPTOR_FEATURE_SCANNING, | RAPTOR_FEATURE_SCANNING, | |||
RAPTOR_FEATURE_ASSUME_IS_RDF, | RAPTOR_FEATURE_ASSUME_IS_RDF, | |||
RAPTOR_FEATURE_ALLOW_NON_NS_ATTRIBUTES, | RAPTOR_FEATURE_ALLOW_NON_NS_ATTRIBUTES, | |||
RAPTOR_FEATURE_ALLOW_OTHER_PARSETYPES | RAPTOR_FEATURE_ALLOW_OTHER_PARSETYPES | |||
} raptor_feature; | } raptor_feature; | |||
typedef struct { | typedef struct { | |||
raptor_identifier_type type; | raptor_identifier_type type; | |||
raptor_uri *uri; | raptor_uri *uri; | |||
raptor_uri_source uri_source; | raptor_uri_source uri_source; | |||
const char *id; | const unsigned char *id; | |||
int ordinal; | int ordinal; | |||
int is_malloced; | int is_malloced; | |||
} raptor_identifier; | } raptor_identifier; | |||
/* Returned by statement_handler */ | /* Returned by statement_handler */ | |||
typedef struct { | typedef struct { | |||
const void *subject; | const void *subject; | |||
raptor_identifier_type subject_type; | raptor_identifier_type subject_type; | |||
const void *predicate; | const void *predicate; | |||
raptor_identifier_type predicate_type; | raptor_identifier_type predicate_type; | |||
const void *object; | const void *object; | |||
raptor_identifier_type object_type; | raptor_identifier_type object_type; | |||
raptor_uri *object_literal_datatype; | raptor_uri *object_literal_datatype; | |||
const char *object_literal_language; | const unsigned char *object_literal_language; | |||
} raptor_statement; | } raptor_statement; | |||
typedef void (*raptor_message_handler)(void *user_data, raptor_locator* loc ator, const char *message); | typedef void (*raptor_message_handler)(void *user_data, raptor_locator* loc ator, const char *message); | |||
typedef void (*raptor_statement_handler)(void *user_data, const raptor_stat ement *statement); | typedef void (*raptor_statement_handler)(void *user_data, const raptor_stat ement *statement); | |||
typedef raptor_uri* (*raptor_container_test_handler)(raptor_uri *element_ur i); | typedef raptor_uri* (*raptor_container_test_handler)(raptor_uri *element_ur i); | |||
/* Public functions */ | /* Public functions */ | |||
RAPTOR_API void raptor_init(void); | RAPTOR_API void raptor_init(void); | |||
RAPTOR_API void raptor_finish(void); | RAPTOR_API void raptor_finish(void); | |||
skipping to change at line 129 | skipping to change at line 129 | |||
RAPTOR_API void raptor_set_warning_handler(raptor_parser* parser, void *use r_data, raptor_message_handler handler); | RAPTOR_API void raptor_set_warning_handler(raptor_parser* parser, void *use r_data, raptor_message_handler handler); | |||
RAPTOR_API void raptor_set_statement_handler(raptor_parser* parser, void *u ser_data, raptor_statement_handler handler); | RAPTOR_API void raptor_set_statement_handler(raptor_parser* parser, void *u ser_data, raptor_statement_handler handler); | |||
RAPTOR_API void raptor_print_statement(const raptor_statement * const state ment, FILE *stream); | RAPTOR_API void raptor_print_statement(const raptor_statement * const state ment, FILE *stream); | |||
RAPTOR_API void raptor_print_statement_as_ntriples(const raptor_statement * statement, FILE *stream); | RAPTOR_API void raptor_print_statement_as_ntriples(const raptor_statement * statement, FILE *stream); | |||
RAPTOR_API void raptor_print_statement_detailed(const raptor_statement * st atement, int detailed, FILE *stream); | RAPTOR_API void raptor_print_statement_detailed(const raptor_statement * st atement, int detailed, FILE *stream); | |||
RAPTOR_API raptor_locator* raptor_get_locator(raptor_parser* rdf_parser); | RAPTOR_API raptor_locator* raptor_get_locator(raptor_parser* rdf_parser); | |||
/* Parsing functions */ | /* Parsing functions */ | |||
int raptor_parse_chunk(raptor_parser* rdf_parser, const char *buffer, size_ t len, int is_end); | int raptor_parse_chunk(raptor_parser* rdf_parser, const unsigned char *buff er, size_t len, int is_end); | |||
RAPTOR_API int raptor_parse_file(raptor_parser* rdf_parser, raptor_uri *ur i, raptor_uri *base_uri); | RAPTOR_API int raptor_parse_file(raptor_parser* rdf_parser, raptor_uri *ur i, raptor_uri *base_uri); | |||
/* Utility functions */ | /* Utility functions */ | |||
RAPTOR_API void raptor_print_locator(FILE *stream, raptor_locator* locator) ; | RAPTOR_API void raptor_print_locator(FILE *stream, raptor_locator* locator) ; | |||
RAPTOR_API int raptor_format_locator(char *buffer, size_t length, raptor_lo cator* locator); | RAPTOR_API int raptor_format_locator(char *buffer, size_t length, raptor_lo cator* locator); | |||
RAPTOR_API void raptor_set_feature(raptor_parser *parser, raptor_feature fe ature, int value); | RAPTOR_API void raptor_set_feature(raptor_parser *parser, raptor_feature fe ature, int value); | |||
/* URI functions */ | /* URI functions */ | |||
RAPTOR_API raptor_uri* raptor_new_uri(const char *uri_string); | RAPTOR_API raptor_uri* raptor_new_uri(const char *uri_string); | |||
RAPTOR_API raptor_uri* raptor_new_uri_from_uri_local_name(raptor_uri *uri, const char *local_name); | RAPTOR_API raptor_uri* raptor_new_uri_from_uri_local_name(raptor_uri *uri, const char *local_name); | |||
RAPTOR_API raptor_uri* raptor_new_uri_relative_to_base(raptor_uri *base_uri , const char *uri_string); | RAPTOR_API raptor_uri* raptor_new_uri_relative_to_base(raptor_uri *base_uri , const char *uri_string); | |||
RAPTOR_API raptor_uri* raptor_new_uri_from_id(raptor_uri *base_uri, const c har *id); | RAPTOR_API raptor_uri* raptor_new_uri_from_id(raptor_uri *base_uri, const u nsigned char *id); | |||
RAPTOR_API raptor_uri* raptor_new_uri_for_rdf_concept(const char *name); | RAPTOR_API raptor_uri* raptor_new_uri_for_rdf_concept(const char *name); | |||
RAPTOR_API void raptor_free_uri(raptor_uri *uri); | RAPTOR_API void raptor_free_uri(raptor_uri *uri); | |||
RAPTOR_API int raptor_uri_equals(raptor_uri* uri1, raptor_uri* uri2); | RAPTOR_API int raptor_uri_equals(raptor_uri* uri1, raptor_uri* uri2); | |||
RAPTOR_API raptor_uri* raptor_uri_copy(raptor_uri *uri); | RAPTOR_API raptor_uri* raptor_uri_copy(raptor_uri *uri); | |||
RAPTOR_API char* raptor_uri_as_string(raptor_uri *uri); | RAPTOR_API char* raptor_uri_as_string(raptor_uri *uri); | |||
/* Make an xml:base-compatible URI from an existing one */ | ||||
RAPTOR_API raptor_uri* raptor_new_uri_for_xmlbase(raptor_uri* old_uri); | ||||
/* Identifier functions */ | /* Identifier functions */ | |||
RAPTOR_API raptor_identifier* raptor_new_identifier(raptor_identifier_type | RAPTOR_API raptor_identifier* raptor_new_identifier(raptor_identifier_type | |||
type, raptor_uri *uri, raptor_uri_source uri_source, char *id); | type, raptor_uri *uri, raptor_uri_source uri_source, unsigned char *id); | |||
RAPTOR_API void raptor_init_identifier(raptor_identifier *identifier, rapto | RAPTOR_API void raptor_init_identifier(raptor_identifier *identifier, rapto | |||
r_identifier_type type, raptor_uri *uri, raptor_uri_source uri_source, char | r_identifier_type type, raptor_uri *uri, raptor_uri_source uri_source, unsi | |||
*id); | gned char *id); | |||
RAPTOR_API int raptor_copy_identifier(raptor_identifier *dest, raptor_ident ifier *src); | RAPTOR_API int raptor_copy_identifier(raptor_identifier *dest, raptor_ident ifier *src); | |||
RAPTOR_API void raptor_free_identifier(raptor_identifier *identifier); | RAPTOR_API void raptor_free_identifier(raptor_identifier *identifier); | |||
RAPTOR_API int raptor_print_ntriples_string(FILE *stream, const char *strin g, const char delim); | RAPTOR_API int raptor_print_ntriples_string(FILE *stream, const char *strin g, const char delim); | |||
/* raptor_uri.c */ | /* raptor_uri.c */ | |||
RAPTOR_API void raptor_uri_resolve_uri_reference (const char *base_uri, con st char *reference_uri, char *buffer, size_t length); | RAPTOR_API void raptor_uri_resolve_uri_reference (const char *base_uri, con st char *reference_uri, char *buffer, size_t length); | |||
RAPTOR_API char *raptor_uri_filename_to_uri_string(const char *filename); | RAPTOR_API char *raptor_uri_filename_to_uri_string(const char *filename); | |||
RAPTOR_API char *raptor_uri_uri_string_to_filename(const char *uri_string); | RAPTOR_API char *raptor_uri_uri_string_to_filename(const char *uri_string); | |||
RAPTOR_API int raptor_uri_is_file_uri(const char* uri_string); | RAPTOR_API int raptor_uri_is_file_uri(const char* uri_string); | |||
End of changes. 10 change blocks. | ||||
17 lines changed or deleted | 20 lines changed or added | |||