def convert(self): node_strings = [] edge_strings = [] for class_ in self.classes: node_strings.append(self._dot_class_node(class_)) for instance, class_ in self.instances.items(): node_strings.append(self._dot_instance_node(instance, class_)) for uri, literal in self.literals: node = Node(uri, node_color(self.config.colors.lit)) node.update({ "label": text_justify(literal, self.config.max_label_length), "shape": "rect" }) node_strings.append(node.to_draw()) for s, p, o in self.edges: edge_strings.append(' "{}" -> "{}" [label="{}"]'.format(s, o, self._pred_label(p))) return node_strings, edge_strings
def _dot_node(self, uri, attrs): node = Node(uri, attrs) if self.tooltips[uri]: node.update({"tooltip": " ".join(self.tooltips[uri])}) if isinstance(uri, BNode) or self.config.bnode_regex_match(uri): node.update({"label": "", "shape": "circle"}) return node.to_draw() node.update( {"label": self.compute_label(uri, self.config.max_label_length)}) return node.to_draw()