// parse a network resource
func (p *Parser) ParseUri(uri string, base_uri string) chan *Statement {
	p.out = make(chan *Statement)
	go func() {
		p.mutex.Lock()
		defer p.mutex.Unlock()

		curi := C.CString(uri)
		ruri := C.raptor_new_uri(p.world, (*C.uchar)(unsafe.Pointer(curi)))
		C.free(unsafe.Pointer(curi))

		var buri *C.raptor_uri
		if len(base_uri) == 0 {
			buri = C.raptor_uri_copy(ruri)
		} else {
			cbase_uri := C.CString(base_uri)
			buri = C.raptor_new_uri(p.world, (*C.uchar)(unsafe.Pointer(cbase_uri)))
			C.free(unsafe.Pointer(cbase_uri))
		}

		C.raptor_parser_parse_uri(p.parser, ruri, buri)

		C.raptor_free_uri(ruri)
		C.raptor_free_uri(buri)

		close(p.out)
	}()
	return p.out
}
// parse a local file
func (p *Parser) ParseFile(filename string, base_uri string) chan *Statement {
	p.out = make(chan *Statement)
	go func() {
		p.mutex.Lock()
		defer p.mutex.Unlock()

		cfilename := C.CString(filename)
		uri_string := C.raptor_uri_filename_to_uri_string(cfilename)
		C.free(unsafe.Pointer(cfilename))

		uri := C.raptor_new_uri(p.world, uri_string)
		C.raptor_free_memory(unsafe.Pointer(uri_string))

		var buri *C.raptor_uri
		if len(base_uri) == 0 {
			buri = C.raptor_uri_copy(uri)
		} else {
			cbase_uri := C.CString(base_uri)
			buri = C.raptor_new_uri(p.world, (*C.uchar)(unsafe.Pointer(cbase_uri)))
			C.free(unsafe.Pointer(cbase_uri))
		}

		C.raptor_parser_parse_file(p.parser, uri, buri)

		C.raptor_free_uri(uri)
		C.raptor_free_uri(buri)

		close(p.out)
	}()
	return p.out
}