OboGraphDocumentAdaptor { public static Builder builder() { return new Builder(); } private  OboGraphDocumentAdaptor(Builder builder); Map<String, String> getMetaInfo(); List<Term> getTerms(); List<Relationship> getRelationships(); Ontology buildOntology(); static Builder builder();  }
@Test void testNullGraphDocument() { assertThrows(NullPointerException.class, () -> OboGraphDocumentAdaptor.builder().build(null)); }
@Test void testEmptyGraphDocument() { GraphDocument graphDocument = new GraphDocument.Builder().build(); assertThrows(PhenolRuntimeException.class, () -> OboGraphDocumentAdaptor.builder().build(graphDocument), "GraphDocument is empty"); }
@Test void testEmptyGraph() { Graph graph = new Graph.Builder().build(); GraphDocument graphDocument = new GraphDocument.Builder().graphs(ImmutableList.of(graph)).build(); assertThrows(PhenolRuntimeException.class, () -> OboGraphDocumentAdaptor.builder().build(graphDocument), "No nodes found in loaded ontology."); }
@Test void testGraphNoEdges() { Node root = new Node.Builder().id("owl:Thing").label("root").type(Node.RDFTYPES.CLASS).build(); List<Node> nodes = ImmutableList.of(root); Graph graph = new Graph.Builder().nodes(nodes).build(); GraphDocument graphDocument = new GraphDocument.Builder().graphs(ImmutableList.of(graph)).build(); assertThrows(PhenolRuntimeException.class, () -> OboGraphDocumentAdaptor.builder().build(graphDocument), "No edges found in loaded ontology."); }
@Test void throwsExceptionWhenUnknownFilterIdSupplied() { Node root = new Node.Builder() .id("http: .label("root") .type(Node.RDFTYPES.CLASS) .build(); Node unknown = new Node.Builder() .id("http: .label("They have no word for 'fluffy'") .type(Node.RDFTYPES.CLASS) .build(); List<Node> nodes = ImmutableList.of(root, unknown); Edge edge = new Edge.Builder().sub(unknown.getId()).pred("is_a").obj(root.getId()).build(); List<Edge> edges = ImmutableList.of(edge); Graph graph = new Graph.Builder().nodes(nodes).edges(edges).build(); GraphDocument graphDocument = new GraphDocument.Builder().graphs(ImmutableList.of(graph)).build(); CurieUtil curieUtil = CurieUtilBuilder.withDefaultsAnd(ImmutableMap.of("WIBBLE", "http: assertThrows(PhenolRuntimeException.class, () -> OboGraphDocumentAdaptor.builder() .curieUtil(curieUtil) .wantedTermIdPrefixes(ImmutableSet.of("FROOD")) .build(graphDocument), "Unable to filter terms for prefix(s) [FROOD] as these not mapped. Add the mapping to CurieUtil."); }