[redland-dev] Obj-C bindings

Knud Möller knud.moeller at deri.org
Tue Aug 2 11:58:37 BST 2005


Hi there,

is there anyone out there who could provide me with a short code 
snippet that illustrates how to use the Redland objc bindings? I tried 
to write some lines just to play around and enumerate all staments in a 
model. However, it doesn't to work (the enumerator doesn't contain any 
statements). Here's my code:

	NSString *uriString = @"http://sw.deri.org/~knud/knudfoaf.rdf";
	NSURL *url = [NSURL URLWithString: uriString];
	NSData *data = [url resourceDataUsingCache: NO];

	RedlandModel *model = [RedlandModel model];
	RedlandParser *parser = [RedlandParser parserWithName: @"test"
												 mimeType: @"application/rdf+xml"
												syntaxURI: nil];	[parser parseData: data
			intoModel: &model
		  withBaseURI: nil];

	NSEnumerator *enumerator = [model statementEnumerator];
	id element;
	while (element = [enumerator nextObject])
		NSLog(@"statement: %@", [element description]);

Anything wrong with that?

Cheers,
Knud
-------------------------------------------------
Knud Möller, MA
+353 - 91 - 512624
Digital Enterprise Research Institute
   National University of Ireland, Galway
Institiúid Taighde na Fiontraíochta Digití
   Ollscoil na hÉireann, Gaillimh


More information about the redland-dev mailing list