Skip to content

Commit

Permalink
Added rest, removed unexpected queries
Browse files Browse the repository at this point in the history
  • Loading branch information
ananya2711 committed May 12, 2022
1 parent 1fcd3a1 commit b38f20e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
9 changes: 9 additions & 0 deletions 6.1.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Collecting rdflib
Downloading rdflib-6.1.1-py3-none-any.whl (482 kB)
Requirement already satisfied: pyparsing in c:\users\anany\anaconda3\lib\site-packages (from rdflib) (3.0.4)
Collecting isodate
Downloading isodate-0.6.1-py2.py3-none-any.whl (41 kB)
Requirement already satisfied: setuptools in c:\users\anany\anaconda3\lib\site-packages (from rdflib) (58.0.4)
Requirement already satisfied: six in c:\users\anany\anaconda3\lib\site-packages (from isodate->rdflib) (1.16.0)
Installing collected packages: isodate, rdflib
Successfully installed isodate-0.6.1 rdflib-6.1.1
7 changes: 0 additions & 7 deletions SPARQLWrapper/Wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -1187,7 +1187,6 @@ def _validate_format(
# the unexpected N3 requested for a SELECT would return XML
if "content-type" in self.info():
ct = self.info()["content-type"] # returned Content-Type value

if _content_type_in_list(ct, _SPARQL_XML):
_validate_format("XML", [XML], ct, self.requestedFormat)
return self._convertXML()
Expand All @@ -1197,12 +1196,6 @@ def _validate_format(
elif _content_type_in_list(ct, _SPARQL_JSON):
_validate_format("JSON", [JSON], ct, self.requestedFormat)
return self._convertJSON()
elif _content_type_in_list(ct, _RDF_XML):
#Ananya: This has to be altered
_validate_format(
"RDF/XML", [RDF, XML, RDFXML], ct, self.requestedFormat
)
return self._convertRDF()
elif _content_type_in_list(ct, _RDF_N3):
_validate_format("N3", [N3, TURTLE], ct, self.requestedFormat)
return self._convertN3()
Expand Down
9 changes: 5 additions & 4 deletions test/test_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -874,10 +874,6 @@ def _mime_vs_type(mime, requested_type):
self.assertEqual(0, _mime_vs_type("application/json", JSON))

self.assertEqual(0, _mime_vs_type("application/ld+json", JSONLD))
self.assertEqual(0, _mime_vs_type("application/rdf+xml", XML))
self.assertEqual(0, _mime_vs_type("application/rdf+xml", RDF))
self.assertEqual(0, _mime_vs_type("application/rdf+xml", RDFXML))

self.assertEqual(0, _mime_vs_type("text/csv", CSV))
self.assertEqual(0, _mime_vs_type("text/tab-separated-values", TSV))
self.assertEqual(0, _mime_vs_type("application/xml", XML))
Expand All @@ -896,6 +892,11 @@ def _mime_vs_type(mime, requested_type):
self.assertEqual(1, _mime_vs_type("application/ld+json", N3)) # Warning
self.assertEqual(1, _mime_vs_type("application/rdf+xml", JSON)) # Warning
self.assertEqual(1, _mime_vs_type("application/rdf+xml", N3)) # Warning
self.assertEqual(1, _mime_vs_type("application/rdf+xml", XML)) # Warning
self.assertEqual(1, _mime_vs_type("application/rdf+xml", RDFXML)) # Warning

#Invalid return format, RDF (issue 190)
self.assertEqual(1, _mime_vs_type("application/rdf+xml", RDF))

def testPrint_results(self):
"""
Expand Down

0 comments on commit b38f20e

Please sign in to comment.