Skip to content

Commit

Permalink
Merge pull request #84 from hsolbrig/WIndows_bug
Browse files Browse the repository at this point in the history
Windows bug
  • Loading branch information
hsolbrig committed Apr 14, 2022
2 parents bebd05f + 494ae92 commit 947593e
Show file tree
Hide file tree
Showing 20 changed files with 2,201 additions and 2,172 deletions.
1 change: 0 additions & 1 deletion .github/workflows/main.yaml
Expand Up @@ -2,7 +2,6 @@ name: Build

on:
push:
branches: [ master ]

jobs:
update-requirements:
Expand Down
29 changes: 0 additions & 29 deletions .github/workflows/pr-test.yaml

This file was deleted.

1 change: 1 addition & 0 deletions AUTHORS
@@ -1,4 +1,5 @@
Alejandro González Hevia <alejandrgh11@gmail.com>
Ben McAlister <benmcalister@users.noreply.github.com>
Egon Willighagen <egon.willighagen@gmail.com>
Harold Solbrig <hsolbri1@MacBook-Pro.local>
Harold Solbrig <solbrig@earthlink.net>
Expand Down
9 changes: 9 additions & 0 deletions ChangeLog
@@ -1,6 +1,15 @@
CHANGES
=======

* Replace '/' with '\'

v0.8.0
------

* Point at the correct slurper version
* Add extra test files (may not be necessary)
* Fix call to deprecated \`add\_bindings\` method
* Update to remove dependency on protected method in v 6.0
* Import the shim into the manifest tester
* Add miscellaneous testing updates
* Requirements match Pipenv
Expand Down
5 changes: 2 additions & 3 deletions Pipfile
Expand Up @@ -8,12 +8,11 @@ pbr = "*"

[packages]
chardet = "*"
rdflib = ">=5.0.0"
rdflib-shim = "*"
requests = ">=2.22.0"
urllib3 = "*"
ShExJSG = ">=0.8.1"
ShExJSG = ">=0.8.2"
CFGraph = ">=0.2.1"
PyShExC = "==0.9.0"
PyShExC = "==0.9.1"
sparqlslurper = ">=0.5.1"
sparqlwrapper = ">=1.8.5"
4 changes: 2 additions & 2 deletions pyshex/utils/url_utils.py
Expand Up @@ -9,10 +9,10 @@ def generate_base(path: str) -> str:
:param path: file location or url
:return: file location or url sans actual name
"""
if ':' in path:
if '://' in path:
parts = urlparse(path)
parts_dict = parts._asdict()
parts_dict['path'] = os.path.split(parts.path)[0] if '/' in parts.path else ''
return urlunparse(ParseResult(**parts_dict)) + '/'
else:
return (os.path.split(path)[0] if '/' in path else '') + '/'
return os.path.split(path)[0].replace('\\', '/') + '/'
5 changes: 2 additions & 3 deletions requirements.txt
Expand Up @@ -12,11 +12,10 @@

cfgraph>=0.2.1
chardet
pyshexc==0.9.0
pyshexc==0.9.1
rdflib-shim
rdflib>=5.0.0
requests>=2.22.0
shexjsg>=0.8.1
shexjsg>=0.8.2
sparqlslurper>=0.5.1
sparqlwrapper>=1.8.5
urllib3
4,078 changes: 2,039 additions & 2,039 deletions tests/data/earl_report.ttl

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions tests/test_cli/test_evaluate.py
Expand Up @@ -10,6 +10,7 @@
from pyshex.user_agent import UserAgent
from tests import datadir, SKIP_EXTERNAL_URLS, SKIP_EXTERNAL_URLS_MSG
from tests.test_cli.clitests import CLITestCase, ArgParseExitException
from tests.utils.web_server_utils import DRUGBANK_SPARQL_URL, is_up, is_down_reason

update_test_files: bool = False

Expand Down Expand Up @@ -71,13 +72,12 @@ def test_start_predicate(self):
failexpected=True)
self.assertFalse(update_test_files, "Updating test files")

@unittest.skipIf(SKIP_EXTERNAL_URLS, SKIP_EXTERNAL_URLS_MSG)
@unittest.skipIf(not is_up(DRUGBANK_SPARQL_URL), is_down_reason(DRUGBANK_SPARQL_URL))
def test_sparql_query(self):
""" Test a sample DrugBank sparql query """
shex = os.path.join(datadir, 't1.shex')
sparql = os.path.join(datadir, 't1.sparql')
rdf = 'http://wifo5-04.informatik.uni-mannheim.de/drugbank/sparql'
self.do_test([rdf, shex, '-sq', sparql], 't1', update_test_file=update_test_files)
self.do_test([DRUGBANK_SPARQL_URL, shex, '-sq', sparql], 't1', update_test_file=update_test_files)


if __name__ == '__main__':
Expand Down
29 changes: 16 additions & 13 deletions tests/test_cli/test_sparql_options.py
Expand Up @@ -6,6 +6,8 @@
from pyshex.shex_evaluator import evaluate_cli
from tests import datadir, SKIP_EXTERNAL_URLS, SKIP_EXTERNAL_URLS_MSG
from tests.test_cli.clitests import CLITestCase
from tests.utils.web_server_utils import FHIRCAT_GRAPHDB_URL, is_up, is_down_reason, DRUGBANK_SPARQL_URL, \
DUMONTIER_GRAPHDB_URL


def elapsed_filter(txt: str) -> str:
Expand All @@ -21,50 +23,51 @@ class SparqlQueryTestCase(CLITestCase):
def prog_ep(self, argv: List[str]) -> bool:
return bool(evaluate_cli(argv, prog=self.testprog))

@unittest.skipIf(not is_up(DRUGBANK_SPARQL_URL), is_down_reason(DRUGBANK_SPARQL_URL))
def test_sparql_query(self):
""" Test a sample DrugBank sparql query """
shex = os.path.join(datadir, 't1.shex')
sparql = os.path.join(datadir, 't1.sparql')
rdf = 'http://wifo5-04.informatik.uni-mannheim.de/drugbank/sparql'
self.do_test([rdf, shex, '-sq', sparql], 'dbsparql1')
self.do_test([DRUGBANK_SPARQL_URL, shex, '-sq', sparql], 'dbsparql1')

@unittest.skipIf(not is_up(DRUGBANK_SPARQL_URL), is_down_reason(DRUGBANK_SPARQL_URL))
def test_print_queries(self):
""" Test a sample DrugBank sparql query printing queries"""
shex = os.path.join(datadir, 't1.shex')
sparql = os.path.join(datadir, 't1.sparql')
rdf = 'http://wifo5-04.informatik.uni-mannheim.de/drugbank/sparql'
self.do_test([rdf, shex, '-sq', sparql, '-ps'], 'dbsparql2', text_filter=elapsed_filter)
self.do_test([DRUGBANK_SPARQL_URL, shex, '-sq', sparql, '-ps'], 'dbsparql2', text_filter=elapsed_filter)

@unittest.skipIf(not is_up(DRUGBANK_SPARQL_URL), is_down_reason(DRUGBANK_SPARQL_URL))
def test_print_results(self):
""" Test a sample DrugBank sparql query printing results"""
shex = os.path.join(datadir, 't1.shex')
sparql = os.path.join(datadir, 't1.sparql')
rdf = 'http://wifo5-04.informatik.uni-mannheim.de/drugbank/sparql'
self.do_test([rdf, shex, '-sq', sparql, '-pr', "--stopafter", "1"], 'dbsparql3', text_filter=elapsed_filter)
self.do_test([DRUGBANK_SPARQL_URL, shex, '-sq', sparql, '-pr', "--stopafter", "1"], 'dbsparql3', text_filter=elapsed_filter)

@unittest.skipIf(not is_up(DRUGBANK_SPARQL_URL), is_down_reason(DRUGBANK_SPARQL_URL))
def test_named_graph(self):
""" Test a sample DrugBank using any named graph """

shex = os.path.join(datadir, 't1.shex')
sparql = os.path.join(datadir, 't1.sparql')
rdf = 'http://wifo5-04.informatik.uni-mannheim.de/drugbank/sparql'
self.maxDiff = None
self.do_test([rdf, shex, '-sq', sparql, '-ps', '-gn', "", "-pr"], 'dbsparql4', failexpected=True,
text_filter=elapsed_filter)
self.do_test([DRUGBANK_SPARQL_URL, shex, '-sq', sparql, '-ps', '-gn', "", "-pr"], 'dbsparql4',
failexpected=True, text_filter=elapsed_filter)

graphid = "<http://identifiers.org/drugbank:>"
self.do_test([rdf, shex, '-sq', sparql, '-ps', '-gn', graphid, "-pr"], 'dbsparql5', failexpected=True,
text_filter=elapsed_filter)
self.do_test([DRUGBANK_SPARQL_URL, shex, '-sq', sparql, '-ps', '-gn', graphid, "-pr"], 'dbsparql5',
failexpected=True, text_filter=elapsed_filter)

@unittest.skipIf(not is_up(DUMONTIER_GRAPHDB_URL), is_down_reason(DUMONTIER_GRAPHDB_URL))
def test_named_graph_types(self):
""" Test a Drugbank query with named graph in the query """
shex = os.path.join(datadir, 'schemas', 'biolink-modelnc.shex')
rdf = 'http://graphdb.dumontierlab.com/repositories/ncats-red-kg'
self.maxDiff = None
self.do_test([rdf, shex, '-ss', '-gn', '', '-ps', '-pr', '-ut', '-sq',
self.do_test([DUMONTIER_GRAPHDB_URL, shex, '-ss', '-gn', '', '-ps', '-pr', '-ut', '-sq',
'select ?item where{?item a <http://w3id.org/biolink/vocab/Protein>} LIMIT 20'],
'dbsparql6', failexpected=True, text_filter=elapsed_filter)

@unittest.skipIf(not is_up(FHIRCAT_GRAPHDB_URL), is_down_reason(FHIRCAT_GRAPHDB_URL))
def test_infer_setting(self):
""" Test setting infer to False """

Expand Down
59 changes: 33 additions & 26 deletions tests/test_issues/data/wikidata/disease/Q12135.ttl
@@ -1,7 +1,7 @@
@prefix do: <http://purl.obolibrary.org/obo/DOID_> .
@prefix doio: <http://identifiers.org/doid/> .
@prefix ns1: <http://www.wikidata.org/prop/direct-normalized/> .
@prefix ns2: <http://wikiba.se/ontology#> .
@prefix ns1: <http://wikiba.se/ontology#> .
@prefix ns2: <http://www.wikidata.org/prop/direct-normalized/> .
@prefix p: <http://www.wikidata.org/prop/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix schema: <http://schema.org/> .
Expand Down Expand Up @@ -52,7 +52,7 @@ wd:Q12135 rdfs:label "Afiechyd meddwl",
"mentális zavar",
"penyakit mental",
"perturbação mental",
"psihiski traucējumi",
"psihiskie traucējumi",
"psika malsano",
"psychische Störung",
"psychische aandoening",
Expand Down Expand Up @@ -109,7 +109,7 @@ wd:Q12135 rdfs:label "Afiechyd meddwl",
"精神障害",
"精神障礙",
"정신 질환" ;
schema:dateModified "2021-12-15T09:38:30+00:00"^^xsd:dateTime ;
schema:dateModified "2022-01-12T13:37:45+00:00"^^xsd:dateTime ;
schema:description "Loại bệnh về tinh thần con người",
"affezione che colpisce il pensiero, i sentimenti o il comportamento di una persona",
"alteración de los procesos cognitivos y afectivos del desarrollo",
Expand Down Expand Up @@ -141,10 +141,10 @@ wd:Q12135 rdfs:label "Afiechyd meddwl",
"同心理、神經有關嘅疾病",
"疾病",
"精神疾患の総称" ;
schema:version 1544198221 ;
ns2:identifiers 45 ;
ns2:sitelinks 108 ;
ns2:statements 89 ;
schema:version 1561097645 ;
ns1:identifiers 47 ;
ns1:sitelinks 109 ;
ns1:statements 91 ;
skos:altLabel "Gemütskrankheit",
"Rối loạn tinh thần",
"Rối loạn tâm thần",
Expand All @@ -169,7 +169,7 @@ wd:Q12135 rdfs:label "Afiechyd meddwl",
"gangguan jiwa",
"gangguan mental",
"gangguan minda",
"garīga slimība",
"garīgā slimības",
"maladie mentale",
"maladie psychiatrique",
"malaltia mental",
Expand All @@ -186,23 +186,26 @@ wd:Q12135 rdfs:label "Afiechyd meddwl",
"mental hastalık",
"mental health morbidity",
"mental illness",
"mental illnesses",
"mental liding",
"mental morbidity",
"mental or behavioural disorder",
"mental ya da davranış bozukluğu",
"mentāla slimība",
"mentālā slimības",
"mielenterveyden häiriö",
"mielenterveyden häiriöt",
"obsolete mental disorder",
"penyakit minda",
"psihiskie traucējumi",
"psihiskā slimības",
"psihička bolest",
"psika perturbo",
"psikiyatrik bozukluk",
"psikiyatrik hastalık",
"psychiatric condition",
"psychiatric disease",
"psychiatric disorder",
"psychiatric disorders",
"psychiatric illness",
"psychiatric morbidity",
"psychická choroba",
"psychická nemoc",
Expand Down Expand Up @@ -271,12 +274,14 @@ wd:Q12135 rdfs:label "Afiechyd meddwl",
"精神錯亂",
"精神障礙症" ;
p:P1014 <http://www.wikidata.org/entity/statement/Q12135-820B9A9C-13D9-44A5-A802-1A6A372F4F42> ;
p:P10192 <http://www.wikidata.org/entity/statement/Q12135-aa842932-49be-41c5-c977-7f4900d65751> ;
p:P1036 <http://www.wikidata.org/entity/statement/Q12135-12129e3d-43ea-4bf9-6345-0577e61808f6> ;
p:P1051 <http://www.wikidata.org/entity/statement/Q12135-90EF8470-2B5A-47D4-B9C5-C14D32F005A8> ;
p:P1296 <http://www.wikidata.org/entity/statement/Q12135-193D4239-E18C-481C-A1C1-9D12FDC61055> ;
p:P1343 <http://www.wikidata.org/entity/statement/Q12135-83f28510-3b3e-4f47-925b-60be5f7b522c>,
<http://www.wikidata.org/entity/statement/Q12135-84EDF737-087C-49ED-93E9-A927A63F2FEF>,
<http://www.wikidata.org/entity/statement/Q12135-e169a132-f9b8-400b-9e63-f013bd1502f6> ;
p:P1368 <http://www.wikidata.org/entity/statement/Q12135-270c4ab4-46fe-5e37-906a-89665ac85cd6> ;
p:P1417 <http://www.wikidata.org/entity/statement/Q12135-B8F67DCC-83BD-4DFD-876B-31AA65EF06C6> ;
p:P1542 <http://www.wikidata.org/entity/statement/Q12135-cbe8d6b4-487a-340f-b52e-620be0722b7e> ;
p:P1692 <http://www.wikidata.org/entity/statement/Q12135-5EA6E026-77BB-4557-A311-D9E9282BE866>,
Expand Down Expand Up @@ -359,27 +364,29 @@ wd:Q12135 rdfs:label "Afiechyd meddwl",
p:P950 <http://www.wikidata.org/entity/statement/Q12135-dfe86976-9fab-4163-90cc-390e0ffdcfd9> ;
p:P973 <http://www.wikidata.org/entity/statement/Q12135-0f1d7aab-41b4-fc6a-7b08-f4dd35fcb946> ;
p:P989 <http://www.wikidata.org/entity/statement/Q12135-71990294-F9D9-4BE8-B123-65C1372DA9CD> ;
ns1:P1014 <http://vocab.getty.edu/aat/300055131> ;
ns1:P227 <https://d-nb.info/gnd/4047686-8> ;
ns1:P2347 <http://www.yso.fi/onto/yso/p990> ;
ns1:P244 <https://id.loc.gov/authorities/names/sh85083643> ;
ns1:P2581 <http://babelnet.org/rdf/s00027818n> ;
ns1:P268 <http://data.bnf.fr/ark:/12148/cb11942041r#about> ;
ns1:P3916 <http://vocabularies.unesco.org/thesaurus/concept5463> ;
ns1:P486 <http://id.nlm.nih.gov/mesh/D001523> ;
ns1:P508 <http://purl.org/bncf/tid/6114> ;
ns1:P6366 <http://ma-graph.org/entity/2780875785> ;
ns1:P646 <http://g.co/kg/m/04x4r> ;
ns1:P672 <http://id.nlm.nih.gov/mesh/F03> ;
ns1:P7033 <http://vocabulary.curriculum.edu.au/scot/4979.rdf> ;
ns1:P8408 <http://kbpedia.org/kko/rc/PsychologicalAilment> ;
ns1:P950 <http://datos.bne.es/resource/XX525721> ;
ns2:P1014 <http://vocab.getty.edu/aat/300055131> ;
ns2:P227 <https://d-nb.info/gnd/4047686-8> ;
ns2:P2347 <http://www.yso.fi/onto/yso/p990> ;
ns2:P244 <https://id.loc.gov/authorities/names/sh85083643> ;
ns2:P2581 <http://babelnet.org/rdf/s00027818n> ;
ns2:P268 <http://data.bnf.fr/ark:/12148/cb11942041r#about> ;
ns2:P3916 <http://vocabularies.unesco.org/thesaurus/concept5463> ;
ns2:P486 <http://id.nlm.nih.gov/mesh/D001523> ;
ns2:P508 <http://purl.org/bncf/tid/6114> ;
ns2:P6366 <http://ma-graph.org/entity/2780875785> ;
ns2:P646 <http://g.co/kg/m/04x4r> ;
ns2:P672 <http://id.nlm.nih.gov/mesh/F03> ;
ns2:P7033 <http://vocabulary.curriculum.edu.au/scot/4979.rdf> ;
ns2:P8408 <http://kbpedia.org/kko/rc/PsychologicalAilment> ;
ns2:P950 <http://datos.bne.es/resource/XX525721> ;
wdt:P1014 "300055131" ;
wdt:P10192 "homoit0001011" ;
wdt:P1036 "616.89" ;
wdt:P1051 "12879" ;
wdt:P1296 "0193785" ;
wdt:P1343 wd:Q2657718,
wd:Q602358 ;
wdt:P1368 "000075073" ;
wdt:P1417 "science/mental-disorder" ;
wdt:P1542 wd:Q944142 ;
wdt:P1692 "290-299.99",
Expand Down
15 changes: 8 additions & 7 deletions tests/test_issues/data/wikidata/disease/Q36956.ttl
Expand Up @@ -113,13 +113,13 @@ wd:Q36956 rdfs:label "Abïl",
"麻瘋",
"麻风",
"한센병" ;
schema:dateModified "2021-12-15T09:19:56+00:00"^^xsd:dateTime ;
schema:dateModified "2022-01-13T12:44:54+00:00"^^xsd:dateTime ;
schema:description "Aansteeklike siekte",
"Chronic infection caused by bacteria Mycobacteria lepræ and lepromatosis",
"Enfermidade causadora de feridas e erosões na pele.",
"Một loại bệnh do vi khuẩn Mycobacterium leprae gây ra.",
"Zarazna bolest",
"bakterielle, schwach infektiöse Hautkrankheit mit Nerven- und Knochendegeneration",
"chronic infection caused by bacteria Mycobacteria lepræ and lepromatosis",
"enfermedad bacteriana crónica de la piel y de los nervios de las manos y pies y a veces, del revestimiento de la nariz.",
"fertőző betegség",
"infeksjonssykdom forårsaket av lepra-basillen",
Expand All @@ -145,10 +145,10 @@ wd:Q36956 rdfs:label "Abïl",
"ᅟinfekta malsano kaŭzata de bakterio",
"らい菌の感染によって生じる慢性の疾患",
"一种慢性传染病" ;
schema:version 1544188941 ;
ns2:identifiers 54 ;
ns2:sitelinks 133 ;
ns2:statements 141 ;
schema:version 1561621579 ;
ns2:identifiers 55 ;
ns2:sitelinks 134 ;
ns2:statements 142 ;
skos:altLabel "Aussatz",
"Aussätzige",
"Bélpoklosság",
Expand All @@ -163,7 +163,6 @@ wd:Q36956 rdfs:label "Abïl",
"HANSEN DISEASE",
"Hansen Pēⁿ",
"Hansen's disease",
"Hansen's disease, Leprosy",
"Hansen-Krankheit",
"Hansen-kór",
"Hansenin tauti",
Expand Down Expand Up @@ -437,6 +436,7 @@ wd:Q36956 rdfs:label "Abïl",
p:P8189 <http://www.wikidata.org/entity/statement/Q36956-8AFBCCFF-5A14-4E75-995E-7A029E22E43A> ;
p:P828 <http://www.wikidata.org/entity/statement/Q36956-c39c29c6-4e60-fbe5-7034-aebf7f53de0d>,
<http://www.wikidata.org/entity/statement/Q36956-f6d0adcc-4bf5-82ae-45c7-1381069796b8> ;
p:P8401 <http://www.wikidata.org/entity/statement/Q36956-f054ca8d-4a8c-4463-deb9-3f0acc514383> ;
p:P8408 <http://www.wikidata.org/entity/statement/Q36956-80DF6758-66D5-4039-8B01-6FF77A35BBB9> ;
p:P902 <http://www.wikidata.org/entity/statement/Q36956-D6C93CDA-983A-46B4-AC54-1E69CC8DE99D> ;
p:P910 <http://www.wikidata.org/entity/statement/Q36956-3CA8A7C7-D284-43C0-BF0F-FE7F4C5D4D1D> ;
Expand Down Expand Up @@ -567,6 +567,7 @@ wd:Q36956 rdfs:label "Abïl",
wdt:P8189 "987007563027805171" ;
wdt:P828 wd:Q10748967,
wd:Q155891 ;
wdt:P8401 "leprosy" ;
wdt:P8408 "Leprosy" ;
wdt:P902 "007983" ;
wdt:P910 wd:Q7214744 ;
Expand Down

0 comments on commit 947593e

Please sign in to comment.