Skip to content

Commit 84738f1

Browse files
committed
better RDF schema error handling (#26)
1 parent 3b8dc09 commit 84738f1

File tree

4 files changed

+25
-0
lines changed

4 files changed

+25
-0
lines changed

schema_salad/ref_resolver.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from .aslist import aslist
1818
import rdflib
1919
from rdflib.namespace import RDF, RDFS, OWL
20+
from rdflib.plugins.parsers.notation3 import BadSyntax
2021
import xml.sax
2122
from typing import cast, Union, Tuple, Dict, Any, Callable, Iterable
2223

@@ -160,6 +161,10 @@ def add_schemas(self, ns, base_url):
160161
break
161162
except xml.sax.SAXParseException: # type: ignore
162163
pass
164+
except TypeError:
165+
pass
166+
except BadSyntax:
167+
pass
163168

164169
for s, _, _ in self.graph.triples((None, RDF.type, RDF.Property)):
165170
self._add_properties(s)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Stubs for rdflib.plugins (Python 3.5)
2+
#
3+
# NOTE: This dynamically typed stub was automatically generated by stubgen.
4+
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Stubs for rdflib.plugins.parsers (Python 3.5)
2+
#
3+
# NOTE: This dynamically typed stub was automatically generated by stubgen.
4+
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Stubs for rdflib.plugins.parsers.notation3 (Python 3.5)
2+
#
3+
# NOTE: This dynamically typed stub was automatically generated by stubgen.
4+
5+
from typing import Any
6+
from rdflib.parser import Parser
7+
8+
class BadSyntax(SyntaxError):
9+
lines = ... # type: Any
10+
def __init__(self, uri, lines, argstr, i, why): ...
11+
@property
12+
def message(self): ...

0 commit comments

Comments
 (0)