def _parse_uri_focus_expression(self, token): if token == "a": return add_corners(RDF_TYPE) elif token.endswith(">"): if token.startswith("<"): return token else: for a_prefix in self._prefix_namespace_dict: if token.startswith(a_prefix + ":"): return add_corners(self._unprefix_uri(prefix=a_prefix, uri=token)) raise ValueError("URI not well formed or with an unknown prefix: " + token)
def _yield_relevant_sgraph_triples(self, target_nodes, sgraph): for s, p, o in sgraph.yield_p_o_triples_of_target_nodes( target_nodes=target_nodes, depth=self._depth, classes_at_last_level=self._classes_at_last_level, instantiation_property=self._instantiation_property, already_visited=None, strict_syntax_with_uri_corners=self._strict_syntax_with_corners ): yield (tune_subj(a_token=add_corners_if_it_is_an_uri(s)), tune_prop(a_token=add_corners(p)), tune_token( a_token=add_corners_if_it_is_an_uri(o), allow_untyped_numbers=self._allow_untyped_numbers))