def test_bindings_get_graph_from_sparql_results(self): from .resources import sparqlwrapper_result as result sparql_json = result.sparql_result graph, nr_level = RDFModel.get_graph_from_sparql_results( sparql_json, named_graph="http://localhost:8000/resource/aggregation/ton-smits-huis/454/graph" ) assert graph is not None assert graph.identifier == URIRef("http://localhost:8000/resource/aggregation/ton-smits-huis/454/graph") assert len(graph) == 118 predicates = set(graph.predicates()) assert len(predicates) != 0 assert len(predicates) == 67 assert URIRef("http://purl.org/dc/elements/1.1/subject") in list(predicates) rdf_types = sorted(set(graph.objects(predicate=RDF.type))) assert rdf_types == sorted({URIRef('http://www.europeana.eu/schemas/edm/ProvidedCHO'), URIRef('http://www.europeana.eu/schemas/edm/WebResource'), URIRef('http://schemas.delving.eu/nave/terms/DelvingResource'), URIRef('http://www.openarchives.org/ore/terms/Aggregation'), URIRef('http://schemas.delving.eu/narthex/terms/Record'), URIRef('http://schemas.delving.eu/nave/terms/BrabantCloudResource'), URIRef('http://schemas.delving.eu/narthex/terms/Dataset'), URIRef('http://www.w3.org/2004/02/skos/core#Concept')}) assert Literal("bomen", lang="nl") in graph.preferredLabel( subject=URIRef('http://data.cultureelerfgoed.nl/semnet/7403e26d-cf33-4372-ad72-a2f9fcf8f63b') )[0] bnodes_materialized = list(graph.objects(predicate=URIRef("http://www.openarchives.org/ore/terms/aggregates"))) assert len(bnodes_materialized) == 1
def test_bindings_get_graph_from_sparql_results_without_named_graph(self): from .resources import sparqlwrapper_result_graph_name as result sparql_json = result.sparql_result graph, nr_level = RDFModel.get_graph_from_sparql_results( sparql_json ) assert graph is not None assert graph.identifier == URIRef("http://localhost:8000/resource/aggregation/ton-smits-huis/454/graph") assert len(graph) == 118 predicates = set(graph.predicates()) assert len(predicates) != 0 assert len(predicates) == 67
def setUp(self): from .resources import sparqlwrapper_result as result sparql_json = result.sparql_result self.graph, self.nr_levels = RDFModel.get_graph_from_sparql_results(sparql_json)