aboutsummaryrefslogtreecommitdiffstats
path: root/bsfs/triple_store/sparql/sparql.py
diff options
context:
space:
mode:
authorMatthias Baumgartner <dev@igsor.net>2023-03-02 16:40:00 +0100
committerMatthias Baumgartner <dev@igsor.net>2023-03-02 16:40:00 +0100
commit28a021483c13e974e00b6159f0653b0727df9d10 (patch)
treee5aa55337a5b2e5c5e34b7892a0cbe0997eb0da8 /bsfs/triple_store/sparql/sparql.py
parentb66ed641d5cbb4cb83f4a571223e4d65d80ed05c (diff)
downloadbsfs-28a021483c13e974e00b6159f0653b0727df9d10.tar.gz
bsfs-28a021483c13e974e00b6159f0653b0727df9d10.tar.bz2
bsfs-28a021483c13e974e00b6159f0653b0727df9d10.zip
prohibit certain characters in URI and ensure URIs in bsfs.graph
Diffstat (limited to 'bsfs/triple_store/sparql/sparql.py')
-rw-r--r--bsfs/triple_store/sparql/sparql.py10
1 files changed, 2 insertions, 8 deletions
diff --git a/bsfs/triple_store/sparql/sparql.py b/bsfs/triple_store/sparql/sparql.py
index bd98f46..68c0027 100644
--- a/bsfs/triple_store/sparql/sparql.py
+++ b/bsfs/triple_store/sparql/sparql.py
@@ -284,10 +284,7 @@ class SparqlStore(base.TripleStoreBase):
raise errors.ConsistencyError(f'{node_type} is not defined in the schema')
# check and create guids
for guid in guids:
- # check convert to rdflib.URIRef
- if not rdflib.term._is_valid_uri(guid): # pylint: disable=protected-access
- raise ValueError(guids)
- subject = rdflib.URIRef(guid)
+ subject = rdflib.URIRef(URI(guid))
# check node existence
if (subject, rdflib.RDF.type, None) in self._graph:
# FIXME: node exists and may have a different type! ignore? raise? report?
@@ -326,10 +323,7 @@ class SparqlStore(base.TripleStoreBase):
raise errors.InstanceError(inconsistent)
# check guids
# FIXME: Fail or skip inexistent nodes?
- guids = set(guids)
- invalid = {guid for guid in guids if not rdflib.term._is_valid_uri(guid)} # pylint: disable=protected-access
- if len(invalid) > 0:
- raise ValueError(invalid)
+ guids = {URI(guid) for guid in guids}
inconsistent = {guid for guid in guids if not self._has_type(guid, node_type)}
if len(inconsistent) > 0:
raise errors.InstanceError(inconsistent)