示例#1
0
 def getComponentUri(self, path):
     """
     Return URI for component where relative reference is treated as a file path
     """
     if urlparse.urlsplit(path).scheme == "":
         path = resolveUri("", str(self.getRoUri()), path)
     return rdflib.URIRef(path)
示例#2
0
 def getComponentUri(self, path):
     """
     Return URI for component where relative reference is treated as a file path
     """
     if urlparse.urlsplit(path).scheme == "":
         path = resolveUri("", str(self.getRoUri()), path)
     return rdflib.URIRef(path)
示例#3
0
def getResourceNameString(ro_config, rname, base=None):
    """
    Returns a string value corresoponding to a URI indicated by the supplied parameter.
    Relative references are assumed to be paths relative to the supplied base URI or,
    if no rbase is supplied, relative to the current directory.
    """
    rsplit = rname.split(":")
    if len(rsplit) == 2:
        # Try to interpret name as CURIE
        for rpref in ro_config["annotationPrefixes"]:
            if rsplit[0] == rpref:
                rname = ro_config["annotationPrefixes"][rpref]+rsplit[1]
    if urlparse.urlsplit(rname).scheme == "":
        if base:
            rname = resolveUri(rname, base)
        else:
            rname = resolveFileAsUri(rname)
    return rname