Using Sqlite3 as Redland RDF storage on iOS with Redland-ObjC
문제
I'm trying to use https://github.com/p2/Redland-ObjC, that compiles and runs fine on iOS to store RDF triples in the iOS sqlite3 database. However, documentation is very light, and Redland-ObjC seems to only use Redland storage with an in-memory hash table.
However, it's mentioned in the Readme of https://github.com/p2/Redland-ObjC that we might want to include libsqlite3 to use persistent storage.
Is it possible ? If yes, how to tell Redland to use ios's sqlite3 API ? (I don't see any code in https://github.com/p2/Redland-ObjC that does that).
Thanks a lot.
해결책
I haven't used the wrapper myself and my Objective-C is rusty, but reading the source suggests that you can do the following:
Use something like
[RedlandStorage initWithFactoryName:@"sqlite" identifier:@"databasename.sqlite" options:@""]
to create a new sqlite storage object.Use something like
[RedlandModel initWithStorage:storage]
to create a new model using thatstorage
as the backing store. (The default[RedlandModel init]
creates the model with the default in-memoryhashes
backing store.)
Then do whatever you would otherwise do with the model.