libraptor2(3)

πŸ‘‘ libraptor2 β€” Raptor RDF syntax library 2.0 πŸ’–

okay bestie, so this is a page from the Library Functions Manual, and it's literally the glow-up era of Raptor β€” the RDF syntax library, version 2.0. sit down, hydrate, let's go πŸ¦‹


✨ SYNOPSIS ✨

no cap, here's the whole vibe in one little block:

#include <raptor2.h>

world=raptor_new_world();
raptor_parser *p=raptor_new_parser(world,rdfxml);
raptor_set_statement_handler(p,NULL,print_triples);
raptor_uri *file_uri=raptor_new_uri(world,http://example.org/);
raptor_parser_parse_file(p,file_uri,base_uri);
raptor_parser_parse_uri(p,uri,NULL);
raptor_free_parser(p);
raptor_free_uri(file_uri);
raptor_free_world(world);

cc prog.c -o prog `pkg-config raptor2 --cflags` `pkg-config raptor2 --libs`

and yes, that last line is how you actually build your little program, pkg-config carrying you the whole way 🫢


🌸 DESCRIPTION 🌸

The Raptor library hands you a high-level interface to a whole squad of parsers and serializers. what do they do? they generate Resource Description Framework (RDF) triples by parsing syntaxes, or they take those triples and serialize them back out into syntaxes. it's giving both directions, iconic honestly πŸ’…

okay so the parsing syntaxes it supports are:

  • RDF/XML
  • N-Triples
  • Turtle
  • TRiG
  • RSS tag soup (including all RSS and Atoms)
  • GRDDL
  • RDF/JSON
  • RDFa

and the serializing syntaxes are:

  • RDF/XML (3 varieties)
  • N-Quads
  • N-Triples
  • Turtle
  • RSS 1.0
  • Atom 1.0
  • GraphViz DOT
  • RDF/JSON

The RDF/XML parser can use either expat or libxml XML parsers to provide the SAX event stream β€” pick your fighter, both valid ✨

The library functions are arranged in an object-oriented style, with constructors, destructors and method calls. The statements and error messages get delivered via callback functions β€” so it's not me yelling at you, it's a function you registered earlier πŸŽ€

Raptor also contains classes to support the RDF graph triples: a statement object containing term objects, plus support for RDF URI-References for both parsing them and resolving / retrieval of URIs. the way that it handles URIs... obsessed πŸ¦‹

It some utility classes too β€” an I/O Stream abstraction for supporting reading and writing to and from a variety of locations, AVL Trees, String buffers and Sequences. very "built different" of it 🫢

Raptor uses Unicode strings for RDF literals and URIs and preserves them throughout the library. It uses the UTF-8 encoding of Unicode at the API for passing in or returning Unicode strings. And it's intended that the preservation of Unicode for URIs supports Internationalized Resource Identifiers (IRIs). global queen behaviour πŸ’–


πŸ“š API REFERENCE πŸ“š

See the HTML API docs, which may be installed system wide at /usr/share/gtk-doc/html/raptor2/ or on the web at http://librdf.org/raptor/api/ 🌈


πŸ’« API CHANGES πŸ’«

See the Raptor API docs changes section at http://librdf.org/raptor/api/raptor-changes.html β€” and the upgrading information for when you're converting from libraptor(1) code, at http://librdf.org/raptor/UPGRADING.html 🧚


πŸŽ€ CONFORMING TO πŸŽ€

the receipts, bestie β€” every spec this thing plays nice with:


πŸ‘€ SEE ALSO πŸ‘€


πŸ–ŠοΈ AUTHOR πŸ–ŠοΈ

Dave Beckett - http://www.dajobe.org/


and that's the whole page, no notes πŸ’… this was libraptor2(3), dated 2010-08-16, from the Library Functions Manual β€” slay, go parse something πŸ”₯

πŸ“¦ where this page comes from