push namespaces to sesame

9 views
Skip to first unread message

zuotian

unread,
Feb 24, 2012, 5:34:07 AM2/24/12
to surfrdf
Hi,

I am using surf to write to a remote sesame store. Everything works as
expected (almost, at least), but none of the namespaces registered in
surf.ns is pushed to the remote store. As a result, when exporting
triples from the sesame store, no prefixes are defined. Is there an
API to write namespaces registered locally to the store?

Thanks,
Zuotian

Cosmin Basca

unread,
Feb 24, 2012, 7:07:25 AM2/24/12
to surfrdf
Hi Zuotian

There is an api to manage the namespaces for Sesame2 http compliant
connections. The caveat is the following: since it's not a standard
api (that other plugins support) it's not exposed in the normal store
api. However using "duck typing" you can safely get access to it like
this: (haven't tested the code myself, but should work)

# assume store is your remote sesame store
if hasattr(store.writer, "get_allegro"):
sesame_connection = store.write.get_allegro()
sesame_connection.add_namespace(...)
sesame_connection.remove_namespace(...)

# the sesame_connection object exposes the low-level sesame2 protocol
nicely wrapped up, see more here:
http://code.google.com/p/surfrdf/source/browse/trunk/plugins/surf.sesame2/sesame2/sesame2.py

Hope this helps,

Cheers,
Cosmin

zuotian

unread,
Feb 24, 2012, 8:22:40 AM2/24/12
to surfrdf
Thanks for the quick reply. Yes it works. Except one minor typo.

store.write.get_allegro() => should be store.writer.get_allegro()

Cheers,
Zuotian

On Feb 24, 1:07 pm, Cosmin Basca <cosmin.ba...@gmail.com> wrote:
> Hi Zuotian
>
> There is an api to manage the namespaces for Sesame2 http compliant
> connections. The caveat is the following: since it's not a standard
> api (that other plugins support) it's not exposed in the normal store
> api. However using "duck typing" you can safely get access to it like
> this: (haven't tested the code myself, but should work)
>
> # assume store is your remote sesame store
> if hasattr(store.writer, "get_allegro"):
>     sesame_connection = store.write.get_allegro()
>     sesame_connection.add_namespace(...)
>     sesame_connection.remove_namespace(...)
>
> # the sesame_connection object exposes the low-level sesame2 protocol
> nicely wrapped up, see more here:http://code.google.com/p/surfrdf/source/browse/trunk/plugins/surf.ses...
Reply all
Reply to author
Forward
0 new messages