/*
 * rdfcommon.h
 * Common includes/structures/enums etc.
 *
 * Copyright (C) Leni Mayo 2002
 *
 *	This program is free software; you can redistribute it and/or modify
 *	it under the terms of the GNU General Public License, version 2, as
 *	published by the Free Software Foundation.
 *	
 *	This program is distributed in the hope that it will be useful,
 *	but WITHOUT ANY WARRANTY; without even the implied warranty of
 *	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *	GNU General Public License for more details.
 *	
 *	You should have received a copy of the GNU General Public License
 *	along with this program; if not, write to the Free Software
 *	Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#ifndef _RDFCOMMON_H_
#define _RDFCOMMON_H_

#include <stdio.h>
#include <glib.h>
#include <redland.h>
#include "common.h"

/*
 * pWorld
 *	the initialisation context for librdf, there will only ever
 *	be one of these.
 * pszFileScheme
 *	The file: scheme, used in a few places.
 */
extern librdf_world *pWorld;
extern const char * pszFileScheme;

GSList * remove_and_free_list_head(GSList *pList);
void free_list_and_items(GSList *pList);

const char * node_as_uri_string(librdf_node *pNode);
const char * local_part_of_uri(const char *p);
const char * namespaceless_part_of_uri(const char *p);
      char * new_string_from_base_and_fragment(const char *pszBase, const char *pszFragment);

void print_nodes_in_list(FILE *fp, GSList *pList);
librdf_node *nodeAtContainerItem(librdf_model *pModel, librdf_node *pContainer, int item);

      char * newUriStringEnsuringScheme(const char *pszPathname);
      char * newUriStringFromFilename(const char *pszFilename);
const char * filenameFromUri(const char *pszUri);
const char * stringFromUriRemovingFileScheme(const char *pszUri);

GSList * listFromNodeIterator(librdf_iterator *iterator);

char * newStringFromNodesInList(GSList *pList);
char * newAbsoluteFromRelativePath(const char *pszPath);

int removeStatement(librdf_model *pModel, librdf_node *pSubject, librdf_node *pPredicate, librdf_node *pObject);

#endif /* _RDFCOMMON_H_ */
