How to use the uritemplate.uritemplate function in uritemplate

To help you get started, we’ve selected a few uritemplate examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wf4ever / ro-manager / src / iaeval / ro_eval_completeness.py View on Github external
###print "key: "+repr(k) 
                if not isinstance(k,rdflib.BNode):
                    simplebinding[str(k)] = str(binding[k])
                    if str(k) in ['if', 'of'] and str(binding[k])[:5] != "file:":
                        # Houston, we have a problem...
                        agraph = rometa.roannotations
                        print "--------------------"
                        print "Graph: "+agraph.serialize(format="xml")
                        print "Query: "+query
                        print "Response bindings: "+repr(resp)
                        print "--------------------"
                        assert False, "Aborted"
            # Construct URI for file from template
            # Uses code copied from http://code.google.com/p/uri-templates
            template = rule['template']
            fileref = uritemplate.expand(rule['template'], simplebinding)
            fileuri = rometa.getComponentUri(fileref)
            ###print "forall test: binding %s"%(repr(simplebinding))
            ###print "...........: template %s, fileref %s"%(template, fileref)
            ###print "...........: fileuri %s"%(repr(fileuri))
            ###print "...........: RO uri  %s"%(repr(rometa.getRoUri()))
            # Test if URI is aggregated
            satisfied = rometa.roManifestContains( (rometa.getRoUri(), ORE.aggregates, fileuri) )
            ###print "...........: satisfied %s"%(satisfied)
            if not satisfied: break
    else:
        raise ValueError("Unrecognized content match rule: %s"%repr(rule))
    return satisfied
github wf4ever / ro-manager / src / roweb / rowebservices.py View on Github external
def expand_uri_template(request):
    tp = request.json_body
    uri = uritemplate.expand(tp['template'], tp['params'])
    return Response(uri+"\n", content_type="text/plain")