diff --git a/README.md b/README.md index f5415c9..051b828 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ First, clone the git repo ```bash # clone -git clone https://github.com/xgaia/abstractor.git +git clone https://github.com/askomics/abstractor.git # cd cd abstractor ``` @@ -70,4 +70,4 @@ abstractor -e -p -o abstractor -e "https://sparql.nextprot.org" -p "http://nextprot.org/rdf#" -o "abstraction.ttl" ``` -Obtained TTL file can be used with [AskOmics](https://github.com/xgaia/flaskomics) \ No newline at end of file +Obtained TTL file can be used with [AskOmics](https://github.com/askomics/flaskomics) \ No newline at end of file diff --git a/abstractor b/abstractor index a066bff..6ffdea4 100644 --- a/abstractor +++ b/abstractor @@ -16,7 +16,8 @@ class Abstractor(object): parser = argparse.ArgumentParser(description="Generate AskOmics abstraction from a SPARQL endpoint") parser.add_argument("-e", "--endpoint", type=str, help="SPARQL enpoint url", required=True) - parser.add_argument("-p", "--prefix", type=str, help="SPARQL prefix uri for :", required=True) + parser.add_argument("-p", "--endpoint-prefix", type=str, help="Endpoint prefix", required=True) + parser.add_argument("--askomics-prefix", type=str, help="AskOmics prefix", default="http://www.semanticweb.org/user/ontologies/2018/1#") parser.add_argument("-o", "--output", type=str, help="Output ttl file", default="abstraction.ttl") self.args = parser.parse_args() @@ -29,7 +30,7 @@ class Abstractor(object): list, list header and results """ - sparql = SparqlQuery(self.args.endpoint, self.args.prefix) + sparql = SparqlQuery(self.args.endpoint, self.args.askomics_prefix) query = textwrap.dedent(''' SELECT DISTINCT ?entity ?rel ?valueType @@ -55,7 +56,7 @@ class Abstractor(object): list, list header and results """ - sparql = SparqlQuery(self.args.endpoint, self.args.prefix) + sparql = SparqlQuery(self.args.endpoint, self.args.askomics_prefix) query = textwrap.dedent(''' SELECT DISTINCT ?entity ?attr @@ -79,7 +80,7 @@ class Abstractor(object): list, list header and results """ - sparql = SparqlQuery(self.args.endpoint, self.args.prefix) + sparql = SparqlQuery(self.args.endpoint, self.args.askomics_prefix) query = textwrap.dedent(''' SELECT DISTINCT ?entity ?attr @@ -98,7 +99,7 @@ class Abstractor(object): def main(self): """main""" - sparql = SparqlQuery(self.args.endpoint, self.args.prefix) + sparql = SparqlQuery(self.args.endpoint, self.args.askomics_prefix) with open(self.args.output, "w") as file: @@ -119,7 +120,7 @@ class Abstractor(object): relation = result["rel"] if "rel" in result else None relation_range = result["valueType"] if "valueType" in result else None - if not entity.startswith(self.args.prefix): + if not entity.startswith(self.args.endpoint_prefix): continue # Write ttl for entities @@ -137,7 +138,7 @@ class Abstractor(object): file.write(ttl) - if not relation.startswith(self.args.prefix): + if not relation.startswith(self.args.endpoint_prefix): continue # write ttl for relations @@ -168,7 +169,7 @@ class Abstractor(object): entity = result["entity"] attribute = result["attr"] if "attr" in result else None - if not entity.startswith(self.args.prefix) and attribute.startswith(self.args.prefix): + if not entity.startswith(self.args.endpoint_prefix) and attribute.startswith(self.args.endpoint_prefix): continue if attribute: @@ -195,7 +196,7 @@ class Abstractor(object): entity = result["entity"] attribute = result["attr"] if "attr" in result else None - if not entity.startswith(self.args.prefix) and attribute.startswith(self.args.prefix): + if not entity.startswith(self.args.endpoint_prefix) and attribute.startswith(self.args.endpoint_prefix): continue if attribute: diff --git a/setup.py b/setup.py index e556b6c..70b9c4b 100644 --- a/setup.py +++ b/setup.py @@ -2,12 +2,12 @@ setup( name='abstractor', - version='1.0.5', + version='1.1.0', description='Abstraction generator for AskOmics, from a distant SPARQL endpoint', author='Xavier Garnier', author_email='xavier.garnier@irisa.fr', - url='https://github.com/xgaia/abstractor', - download_url='https://github.com/xgaia/abstractor/archive/1.0.5.tar.gz', + url='https://github.com/askomics/abstractor', + download_url='https://github.com/askomics/abstractor/archive/1.1.0.tar.gz', install_requires=['SPARQLWrapper'], packages=find_packages(), license='AGPL',