#!/usr/bin/env python
# -*- coding: utf-8 -*-

#cwmCommand = 'cwm.py /dev/stdin --rdf'

from swap import toXML
from swap import notation3
import StringIO

def notation3ToRDF(inText):
    s = StringIO.StringIO()
    store = toXML.ToRDF(s)
    #parser = notation3.SinkParser(store)
    #baseURIどうしたら良いのか…
    parser = notation3.SinkParser(store,baseURI='http://localhost/')
    parser.startDoc()
    parser.feed(inText)
    parser.endDoc()
    return s.getvalue()

def notation3ToRDF_BAK(inText):
    input, output = os.popen2(cwmCommand)
    input.write(inText)
    input.close()
    return output.read()

