Skip to content

Commit d382c03

Browse files
author
Peter Amstutz
committed
Support RDF schemas defined in turtle.
1 parent a5877dd commit d382c03

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

schema_salad/ref_resolver.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from aslist import aslist
1313
import rdflib
1414
from rdflib.namespace import RDF, RDFS, OWL
15+
import xml.sax
1516

1617
_logger = logging.getLogger("salad")
1718

@@ -129,7 +130,10 @@ def add_namespaces(self, ns):
129130

130131
def add_schemas(self, ns, base_url):
131132
for sch in aslist(ns):
132-
self.graph.parse(urlparse.urljoin(base_url, sch))
133+
try:
134+
self.graph.parse(urlparse.urljoin(base_url, sch), format="xml")
135+
except xml.sax.SAXParseException:
136+
self.graph.parse(urlparse.urljoin(base_url, sch), format="turtle")
133137

134138
for s, _, _ in self.graph.triples( (None, RDF.type, RDF.Property) ):
135139
self._add_properties(s)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
tagger = egg_info_cmd.egg_info
1818

1919
setup(name='schema-salad',
20-
version='1.5',
20+
version='1.6',
2121
description='Schema Annotations for Linked Avro Data (SALAD)',
2222
long_description=open(README).read(),
2323
author='Common workflow language working group',

0 commit comments

Comments
 (0)