Skip to content

Commit

Permalink
enable rdfa schema format (common-workflow-language#22)
Browse files Browse the repository at this point in the history
enable rdfa schema format
  • Loading branch information
mr-c committed May 5, 2016
1 parent ff192e8 commit c51c723
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
11 changes: 7 additions & 4 deletions schema_salad/ref_resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,13 @@ def add_namespaces(self, ns):

def add_schemas(self, ns, base_url):
for sch in aslist(ns):
try:
self.graph.parse(urlparse.urljoin(base_url, sch), format="xml")
except xml.sax.SAXParseException:
self.graph.parse(urlparse.urljoin(base_url, sch), format="turtle")
for fmt in ['xml', 'turtle', 'rdfa']:
try:
self.graph.parse(urlparse.urljoin(base_url, sch),
format=fmt)
break
except xml.sax.SAXParseException:
pass

for s, _, _ in self.graph.triples( (None, RDF.type, RDF.Property) ):
self._add_properties(s)
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
# extras_require={ # TODO: uncomment me, same conditions as above
# ':python_version<"3"': ['avro'],
# ':python_version>="3"': ['avro-python3']}
extras_requires = {} # TODO: to be removed when the above is added
extras_require = {} # TODO: to be removed when the above is added

setup(name='schema-salad',
version='1.9',
Expand All @@ -52,7 +52,7 @@
packages=["schema_salad"],
package_data={'schema_salad': ['metaschema/*']},
install_requires=install_requires,
extras_requires=extras_requires,
extras_require=extras_require,
test_suite='tests',
tests_require=[],
entry_points={
Expand Down
5 changes: 2 additions & 3 deletions tests/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,8 @@ def test_idmap(self):
self.assertEqual(ra,
{
"id": "http://example2.com/#stuff",
'inputs': [{'a': 1, 'id': 'http://example2.com/#stuff/zip'},
{'a': 2, 'id': 'http://example2.com/#stuff/zing'},
],
'inputs': [{'a': 2, 'id': 'http://example2.com/#stuff/zing'},
{'a': 1, 'id': 'http://example2.com/#stuff/zip'}],
'outputs': ['http://example2.com/#stuff/out'],
'other': {
'n': 9
Expand Down

0 comments on commit c51c723

Please sign in to comment.