def test_query_answer_false(self, mock_log):
     query_params = {
         "graph_uri": self.graph_uri,
         "class_uri": "http://example.onto/City",
         "instance_uri": "http://example.onto/York",
         "predicate_uri": "http://example.onto/nickname",
         "object_value": '"Unexistent value"'
     }
     query = QUERY_VALUE_EXISTS % query_params
     query_result = self.query(query)
     self.assertFalse(is_result_true(query_result))
Exemplo n.º 2
0
 def test_query(self):
     query_params = {
         "graph_uri": self.graph_uri,
         "class_uri": "http://example.onto/City",
         "instance_uri": "http://example.onto/York",
         "predicate_uri": "http://example.onto/nickname",
         "object_value": '"City of York"'
     }
     query = QUERY_VALUE_EXISTS % query_params
     query_result = self.query(query)
     self.assertTrue(is_result_true(query_result))
Exemplo n.º 3
0
 def test_query_answer_false(self):
     query_params = {
         "graph_uri": self.graph_uri,
         "class_uri": "http://example.onto/City",
         "instance_uri": "http://example.onto/York",
         "predicate_uri": "http://example.onto/nickname",
         "object_value": '"Unexistent value"'
     }
     query = QUERY_VALUE_EXISTS % query_params
     query_result = self.query(query)
     self.assertFalse(is_result_true(query_result))
Exemplo n.º 4
0
def graph_exists(query_params):
    query = QUERY_GRAPH_EXISTS % query_params
    query_result = triplestore.query_sparql(query, query_params.triplestore_config)
    return is_result_true(query_result)
Exemplo n.º 5
0
def class_exists(query_params):
    query = QUERY_CLASS_EXISTS % query_params
    query_result = triplestore.query_sparql(query, query_params.triplestore_config)
    return is_result_true(query_result)
Exemplo n.º 6
0
def instance_exists(query_params):
    query = QUERY_INSTANCE_EXISTS_TEMPLATE % query_params
    result_dict = triplestore.query_sparql(query,
                                           query_params.triplestore_config)
    return is_result_true(result_dict)