Skip to content

Commit c51c723

Browse files
committed
enable rdfa schema format (#22)
enable rdfa schema format
1 parent ff192e8 commit c51c723

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

schema_salad/ref_resolver.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,13 @@ def add_namespaces(self, ns):
146146

147147
def add_schemas(self, ns, base_url):
148148
for sch in aslist(ns):
149-
try:
150-
self.graph.parse(urlparse.urljoin(base_url, sch), format="xml")
151-
except xml.sax.SAXParseException:
152-
self.graph.parse(urlparse.urljoin(base_url, sch), format="turtle")
149+
for fmt in ['xml', 'turtle', 'rdfa']:
150+
try:
151+
self.graph.parse(urlparse.urljoin(base_url, sch),
152+
format=fmt)
153+
break
154+
except xml.sax.SAXParseException:
155+
pass
153156

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

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
# extras_require={ # TODO: uncomment me, same conditions as above
3939
# ':python_version<"3"': ['avro'],
4040
# ':python_version>="3"': ['avro-python3']}
41-
extras_requires = {} # TODO: to be removed when the above is added
41+
extras_require = {} # TODO: to be removed when the above is added
4242

4343
setup(name='schema-salad',
4444
version='1.9',
@@ -52,7 +52,7 @@
5252
packages=["schema_salad"],
5353
package_data={'schema_salad': ['metaschema/*']},
5454
install_requires=install_requires,
55-
extras_requires=extras_requires,
55+
extras_require=extras_require,
5656
test_suite='tests',
5757
tests_require=[],
5858
entry_points={

tests/test_examples.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,8 @@ def test_idmap(self):
100100
self.assertEqual(ra,
101101
{
102102
"id": "http://example2.com/#stuff",
103-
'inputs': [{'a': 1, 'id': 'http://example2.com/#stuff/zip'},
104-
{'a': 2, 'id': 'http://example2.com/#stuff/zing'},
105-
],
103+
'inputs': [{'a': 2, 'id': 'http://example2.com/#stuff/zing'},
104+
{'a': 1, 'id': 'http://example2.com/#stuff/zip'}],
106105
'outputs': ['http://example2.com/#stuff/out'],
107106
'other': {
108107
'n': 9

0 commit comments

Comments
 (0)