示例#1
0
    def __init__(self, relation_type, identifier, label, identifier_prefix,rdfs_domain, prefixDomain, rdfs_range, prefixRange):

        type_range =  identifier
        idx = identifier.find("@")
        if idx > 0:
            uridi = identifier[0:idx]
        else:
            uridi = identifier

        if label == "":
            if idx > 0:
                self.label = identifier[0:idx]
            else:
                self.label = identifier
        else:
            self.label = label

        self.uri = ParamManager.encode_to_rdf_uri(uridi,prefix="askomics:")

        self.rdfs_range = rdfs_range

        if relation_type.startswith("entity"):
            self.relation_type = "owl:ObjectProperty"

        elif relation_type == "goterm":
            self.relation_type = "owl:ObjectProperty"
            self.rdfs_range = "owl:Class"
        else:
            self.relation_type = "owl:DatatypeProperty"

        self.rdfs_domain = ParamManager.encode_to_rdf_uri(rdfs_domain,prefixDomain)
        self.log = logging.getLogger(__name__)
示例#2
0
    def test_encode_to_rdf_uri(self):
        r = ParamManager.encode_to_rdf_uri("A",prefix="http://helloworld/test/")
        assert r == "<http://helloworld/test/A>"
        r = ParamManager.encode_to_rdf_uri("A",prefix="<http://helloworld/test/>")
        assert r == "<http://helloworld/test/A>"

        r = ParamManager.encode_to_rdf_uri("A<A>A",prefix="<http://helloworld/test/>")
        assert r == "<http://helloworld/test/A_s3_3CA_s3_3EA>"
示例#3
0
    def test_encode_to_rdf_uri(self):
        r = ParamManager.encode_to_rdf_uri("A",prefix="http://helloworld/test/")
        assert r == "<http://helloworld/test/A>"
        r = ParamManager.encode_to_rdf_uri("A",prefix="<http://helloworld/test/>")
        assert r == "<http://helloworld/test/A>"

        r = ParamManager.encode_to_rdf_uri("A<A>A",prefix="<http://helloworld/test/>")
        assert r == "<http://helloworld/test/A_s3_3CA_s3_3EA>"
示例#4
0
    def __init__(self, relation_type, identifier, rdfs_domain, rdfs_range):
        idx = identifier.find("@")
        type_range = identifier

        #Keep compatibility with old version
        if idx != -1:
            type_range = identifier[idx + 1:len(identifier)]
            self.label = identifier[0:idx]

        else:
            self.label = identifier

        if self.label.find(":") < 0:
            self.uri = ":" + ParamManager.encode_to_rdf_uri(self.label)
        else:
            self.uri = self.label

        self.col_type = relation_type

        if relation_type.startswith("entity"):
            self.relation_type = "owl:ObjectProperty"
            if type_range.find(":") < 0:
                self.rdfs_range = ":" + ParamManager.encode_to_rdf_uri(
                    type_range)
            else:
                self.rdfs_range = type_range

        elif relation_type == "goterm":
            self.relation_type = "owl:ObjectProperty"
            self.rdfs_range = "owl:Class"

        elif relation_type.lower() in ('category', 'taxon', 'ref', 'strand'):
            self.relation_type = "owl:ObjectProperty"
            self.rdfs_range = ":" + ParamManager.encode_to_rdf_uri(type_range +
                                                                   "Category")
        else:
            self.relation_type = "owl:DatatypeProperty"
            self.rdfs_range = rdfs_range

        self.rdfs_domain = ":" + ParamManager.encode_to_rdf_uri(rdfs_domain)
        self.log = logging.getLogger(__name__)
示例#5
0
 def test_decode_to_rdf_uri(self):
     r = ParamManager.encode_to_rdf_uri("@&###:::123%%%%!!!")
     assert ParamManager.decode_to_rdf_uri(r) == "@&###:::123%%%%!!!"
示例#6
0
 def test_encode_to_rdf_uri(self):
     r = ParamManager.encode_to_rdf_uri("@&###:::123%%%%!!!")
     assert r != "@&###123%%%%!!!"
示例#7
0
    def __init__(self, identifier):
        self.uri = ":" + ParamManager.encode_to_rdf_uri(identifier)
        self.label = identifier

        self.log = logging.getLogger(__name__)
示例#8
0
 def test_decode_to_rdf_uri(self):
     r = ParamManager.encode_to_rdf_uri("A",prefix="<http://helloworld/test/>")
     assert ParamManager.decode_to_rdf_uri(r,prefix="http://helloworld/test/") == "A"
示例#9
0
 def test_decode_to_rdf_uri(self):
     r = ParamManager.encode_to_rdf_uri("A",prefix="<http://helloworld/test/>")
     assert ParamManager.decode_to_rdf_uri(r,prefix="http://helloworld/test/") == "A"
示例#10
0
    def __init__(self, identifier):
        self.uri = ":" + ParamManager.encode_to_rdf_uri(identifier)
        self.label = identifier

        self.log = logging.getLogger(__name__)
示例#11
0
 def test_decode_to_rdf_uri(self):
     r = ParamManager.encode_to_rdf_uri("@&###:::123%%%%!!!")
     assert ParamManager.decode_to_rdf_uri(r) == "@&###:::123%%%%!!!"
示例#12
0
 def test_encode_to_rdf_uri(self):
     r = ParamManager.encode_to_rdf_uri("@&###:::123%%%%!!!")
     assert r != "@&###123%%%%!!!"