When testing the stylesheet gets attached to the pages url. All
the meaningful information about the sample or experiment still
gets added to the right <host>/<category>/<id> pages,
unfortunately that means the page url doesn't have a type which
caused _validate_types to toss an error.
I'd previously fixed it by testing for the error message and
filtering it out from the test code, but that didn't work on
ubuntu 10.04 as the error message changes slightly with the
older version of redland rdf.
This version changes the sparql query to ignore the case
where the predicate is a stylesheet and there's no type.
load_string_into_model(model, 'rdfa', response.content)
errmsgs = list(inference.run_validation())
load_string_into_model(model, 'rdfa', response.content)
errmsgs = list(inference.run_validation())
- self.assertEqual(len(errmsgs), 2)
- for errmsg in errmsgs:
- self.assertEqual(errmsg, 'Missing type for: http://localhost/')
+ self.assertEqual(len(errmsgs), 0)
def test_lane_with_rdf_validation(self):
from htsworkflow.util.rdfhelp import add_default_schemas, \
def test_lane_with_rdf_validation(self):
from htsworkflow.util.rdfhelp import add_default_schemas, \
load_string_into_model(model, 'rdfa', response.content)
errmsgs = list(inference.run_validation())
load_string_into_model(model, 'rdfa', response.content)
errmsgs = list(inference.run_validation())
- self.assertEqual(len(errmsgs), 2)
- for errmsg in errmsgs:
- self.assertEqual(errmsg, 'Missing type for: http://localhost/')
+ self.assertEqual(len(errmsgs), 0)
from htsworkflow.util.rdfinfer import Infer
add_default_schemas(model)
inference = Infer(model)
from htsworkflow.util.rdfinfer import Infer
add_default_schemas(model)
inference = Infer(model)
- ignored = {'Missing type for: http://localhost/'}
- errmsgs = [msg for msg in inference.run_validation()
- if msg not in ignored ]
+ errmsgs = list(inference.run_validation())
self.assertEqual(len(errmsgs), 0)
def test_library_index_rdfa(self):
self.assertEqual(len(errmsgs), 0)
def test_library_index_rdfa(self):
self.assertEqual(response.status_code, 200)
load_string_into_model(model, 'rdfa', response.content)
self.assertEqual(response.status_code, 200)
load_string_into_model(model, 'rdfa', response.content)
- ignored = {'Missing type for: http://localhost/'}
- errmsgs = [msg for msg in inference.run_validation()
- if msg not in ignored ]
+ errmsgs = list(inference.run_validation())
self.assertEqual(len(errmsgs), 0)
body = """prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
self.assertEqual(len(errmsgs), 0)
body = """prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
?species libns:species_name ?species_name . }
OPTIONAL { ?library libns:name ?name . }
}"""
?species libns:species_name ?species_name . }
OPTIONAL { ?library libns:name ?name . }
}"""
- bindings = {'library', 'library_id', 'name', 'species', 'species_name'}
+ bindings = set(['library', 'library_id', 'name', 'species', 'species_name'])
query = RDF.SPARQLQuery(body)
count = 0
for r in query.execute(model):
query = RDF.SPARQLQuery(body)
count = 0
for r in query.execute(model):
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix owl: <http://www.w3.org/2002/07/owl#>
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix owl: <http://www.w3.org/2002/07/owl#>
+ prefix xhtmlv: <http://www.w3.org/1999/xhtml/vocab#>
select ?subject ?predicate ?object
where {
?subject ?predicate ?object
OPTIONAL { ?subject a ?class }
FILTER(!bound(?class))
select ?subject ?predicate ?object
where {
?subject ?predicate ?object
OPTIONAL { ?subject a ?class }
FILTER(!bound(?class))
+ FILTER(?predicate != xhtmlv:stylesheet)
}
"""
query = RDF.SPARQLQuery(body)
}
"""
query = RDF.SPARQLQuery(body)