#!/usr/bin/python2.4

#
# A trivial tool for feeding a Strap graph with the content of an RDF file.
#

#
# (c)2005 LIRIS - University Claude Bernard Lyon 1
# http://liris.cnrs.fr/
#
# Author: Pierre-Antoine CHAMPIN
# http://champin.net/
#
# This software is distributed under the terms of the GNU LGPL v2.1.
# See LICENSE.txt for more details.
#

from strap.client             import StrapSocketClient
from strap.rdflib_impl.client import StrapBackend
from sys                      import argv, exit

def fail():
    print """
usage: strapmeta.py <url or socket_path>

Print the metadata URL of an RDF graph available via STRAP.
The argument is either a strap:// URL, or a file:/// URL or path to a unix
socket on which a strap server is listening.

example:
    strapmeta.py strap://localhost:1234/path/to/graph
    strapmeta.py /tmp/strap.sock
"""
    exit (-1)

if len (argv) != 2 or argv[1] in ("-?", "-h", "--help"):
    fail()

g = StrapSocketClient (argv[1], None, None, None)
print g.meta ()

