p2 / Redland-ObjC

Objective-C wrapper for the Redland RDF libraries
Other
20 stars 11 forks source link

Question re use of RedlandNamespace #6

Closed ghost closed 11 years ago

ghost commented 11 years ago

Great framework, I am using it in an iOS project.

I have a question regarding the correct use of RedlandNamespace, this is probably a lack of understanding on my behalf of redland itself.

I can execute SPARQL queries directly without registering RedlandNamespace instances, like:

PREFIX foaf: http://xmlns.com/foaf/0.1/ SELECT ?x ?name WHERE { ?x foaf:name ?name }

So when would I need to create and register RedlandNamespace instances?

Andy

p2 commented 11 years ago

Good to hear that people can use the framework!

RedlandNamespace objects are simply convenience objects. Say you create some triples for an address book entry. You can define the vcard namespace object and then just ask this object for e.g. the bday or email nodes:

RedlandNamespace *vcard = [[RedlandNamespace alloc]
    initWithPrefix:@"http://www.w3.org/2006/vcard/ns#" shortName:@"vcard"];
RedlandNode *bday = [vcard node:@"bday"];
RedlandNode *email = [vcard node:@"email"];
...

I hope this helps!