redland-0.1.0.0: Redland RDF library bindings

Maintainerdefanor <defanor@uberspace.net>
Stabilityunstable
Portabilitynon-portable (GHC extensions are used)
Safe HaskellSafe
LanguageHaskell2010

Redland.MidLevel

Contents

Description

Mid-level Redland RDF library bindings: using Haskell naming conventions, common Haskell types, ForeignPtr with finalizers, exceptions, copied structures (as opposed to the shared ones, as nodes in statement-related functions in the C API). Closely follows the original API otherwise.

Synopsis

Exceptions

FFI utility functions

initialize :: IO (Ptr a) -> FinalizerPtr a -> Initializer a Source #

Initializes a Redland object, throws InitializationException on failure (i.e., if NULL is returned).

perform :: IO CInt -> IO () Source #

Performs an operation, throws OperationException on failure (i.e., on non-zero return value).

withNew :: Initializer a -> (ForeignPtr a -> IO b) -> IO b Source #

Initializes a Redland object, performs an action over it, makes sure to call finalizeForeignPtr afterwards.

withNullablePtr :: (a -> (Ptr b -> c) -> c) -> Maybe a -> (Ptr b -> c) -> c Source #

An abstraction to use with withCString and withForeignPtr.

maybeCString :: CString -> IO (Maybe String) Source #

Checks whether a CString is NULL, frees if it not, returns a Haskell String.

justCString :: CString -> IO String Source #

Like maybeCString, but requires a string to be there, and throws StringOperationException if it isn't.

justSharedCString :: CString -> IO String Source #

Like justCString, but doesn't free the C string.

World

Hashes

redlandHash Source #

Arguments

:: ForeignPtr RedlandWorld

world

-> String

hash factory name (e.g., "memory")

-> Initializer RedlandHash 

hashPutStrings Source #

Arguments

:: ForeignPtr RedlandHash

hash

-> String

key

-> String

value

-> IO () 

RDF Graph (librdf_model)

modelLoad Source #

Arguments

:: ForeignPtr RedlandModel 
-> ForeignPtr RedlandURI

source URI

-> Maybe String

parser name

-> Maybe String

MIME type

-> Maybe (ForeignPtr RedlandURI)

type URI

-> IO () 

RDF term (librdf_node)

Parsers

redlandParser Source #

Arguments

:: ForeignPtr RedlandWorld

world

-> Maybe String

parser name (e.g., "rdfxml", "turtle")

-> Maybe String

MIME type

-> Maybe (ForeignPtr RedlandURI)

type URI

-> Initializer RedlandParser 

parseStringIntoModel Source #

Arguments

:: ForeignPtr RedlandParser

parser

-> String

string to parse

-> ForeignPtr RedlandURI

base URI

-> ForeignPtr RedlandModel

model

-> IO () 

parserGuessName2 Source #

Arguments

:: ForeignPtr RedlandWorld 
-> Maybe String

MIME type

-> Maybe String

content

-> Maybe String

content identifier

-> IO (Maybe String) 

Querying

redlandQuery Source #

Arguments

:: ForeignPtr RedlandWorld 
-> String

language name

-> Maybe (ForeignPtr RedlandURI)

language URI

-> String

query string

-> Maybe (ForeignPtr RedlandURI)

base URI

-> Initializer RedlandQuery 

Query results

queryResultsNext Source #

Arguments

:: ForeignPtr RedlandQueryResults 
-> IO Bool

True if it's not finished.

RDF Triple (librdf_statement)

statementGet :: (Ptr RedlandStatement -> IO (Ptr RedlandNode)) -> ForeignPtr RedlandStatement -> IO (Maybe (ForeignPtr RedlandNode)) Source #

An abstraction used for getting statement components.

statementSet :: (Ptr RedlandStatement -> Ptr RedlandNode -> IO ()) -> ForeignPtr RedlandStatement -> Maybe (ForeignPtr RedlandNode) -> IO () Source #

An abstraction used for setting statement components.

Triple stores

redlandStorage Source #

Arguments

:: ForeignPtr RedlandWorld

world

-> String

storage type name ("hashes", "memory", "file", etc)

-> String

storage identifier

-> String

options

-> Initializer RedlandStorage 

redlandStorageWithOptions Source #

Arguments

:: ForeignPtr RedlandWorld

world

-> String

storage type name ("hashes", "memory", "file", etc)

-> String

storage identifier

-> ForeignPtr RedlandHash

options

-> Initializer RedlandStorage 

Stream of triples (librdf_statement)

streamNext Source #

Arguments

:: ForeignPtr RedlandStream 
-> IO Bool

True if it's not finished.

URI