Class Redland::Parser
In: lib/rdf/redland/parser.rb
Parent: Object

The Parser class for rdf. There are currently three types of parsers *’rdfxml’- a rdf parser *’ntriples’ a An triples parser *’turtle’ - a parser for the turtle syntax as defined in

 http://www.dajobe.org/2004/01/turtle/

*’rss-tag-soup’ - a parser for all RSS flavours and some atom *’grddl’ - GRDDL

The last two may or may not be available depending on systems.

  model = Model.new()
  parser = Parser.ntriples()
  parser.parse_into_model(model,'file:./ical.rdf')

Methods

Attributes

context  [RW] 

Public Class methods

create a new Parser. if no name is given, it defaults to parsing RDF/XML syntax

create a parser for the ntriples syntax

create a parser for rdf syntax

create a parser for the turtle syntax

Public Instance methods

Get a parser feature. The feature is a Uri

Set a parser feature. The feature is named Uri uri and the value is a Node.

Parse the given uri with optional base_uri and return a Stream. If block_given, yield the Statement instead Returns nil on failure.

Parse the syntax at the uri Uri with optional base Uri base_uri into Model model. If the base_uri is given then the content is parsed as if it was at the base_uri rather than the uri. If the optional context is given, the statement is added to the context

Parse the syntax in string with required base Uri base_uri

Returns a Stream or yields Statement if block given. Returns nil on failure.

Parse the syntax in String string with required Uri base_uri into Model model. if context is given then the context information is stored as well

[Validate]