@Test public void testGetConceptsWithProperties() throws Exception { loadHierarchyOwlFile(); getOntologyRepository().clearCache(); Iterable<Concept> conceptsWithProperties = getOntologyRepository().getConceptsWithProperties(workspaceId); Map<String, Concept> conceptsByIri = StreamSupport.stream(conceptsWithProperties.spliterator(), false) .collect(Collectors.toMap(Concept::getIRI, Function.identity())); Concept personConcept = conceptsByIri.get("http://visallo.org/testhierarchy#person"); // Check parent iris assertNull(conceptsByIri.get("http://visallo.org#root").getParentConceptIRI()); assertEquals("http://visallo.org#root", conceptsByIri.get("http://www.w3.org/2002/07/owl#Thing").getParentConceptIRI()); assertEquals("http://www.w3.org/2002/07/owl#Thing", conceptsByIri.get("http://visallo.org/testhierarchy#contact").getParentConceptIRI()); assertEquals("http://visallo.org/testhierarchy#contact", personConcept.getParentConceptIRI()); // Check properties List<OntologyProperty> personProperties = new ArrayList<>(personConcept.getProperties()); assertEquals(1, personProperties.size()); assertEquals("http://visallo.org/testhierarchy#name", personProperties.get(0).getIri()); // Check intents List<String> intents = Arrays.asList(personConcept.getIntents()); assertEquals(2, intents.size()); assertTrue(intents.contains("face")); assertTrue(intents.contains("person")); // Spot check other concept values assertEquals("Person", personConcept.getDisplayName()); assertEquals("prop('http://visallo.org/testhierarchy#name') || ''", personConcept.getTitleFormula()); }
private void validateChangedOwlConcepts() throws IOException { Concept contact = getOntologyRepository().getConceptByIRI(TEST_IRI + "#contact", PUBLIC); Concept person = getOntologyRepository().getConceptByIRI(TEST_IRI + "#person", PUBLIC); assertEquals("Person", person.getDisplayName()); List<String> intents = Arrays.asList(person.getIntents()); assertEquals(1, intents.size()); assertFalse(intents.contains("person")); assertFalse(intents.contains("face")); assertTrue(intents.contains("test")); assertNull(person.getTimeFormula()); assertEquals("prop('http://visallo.org/test#name') || ''", person.getTitleFormula()); assertNull(person.getGlyphIcon()); assertEquals("rgb(28, 137, 28)", person.getColor()); Set<Concept> conceptAndAllChildren = getOntologyRepository().getConceptAndAllChildren(contact, PUBLIC); List<String> iris = Lists.newArrayList(); conceptAndAllChildren.forEach(c -> iris.add(c.getIRI())); assertEquals(2, iris.size()); assertTrue(iris.contains(contact.getIRI())); assertTrue(iris.contains(person.getIRI())); }
private void validateChangedOwlRelationships() throws IOException { Relationship relationship = getOntologyRepository().getRelationshipByIRI(TEST_IRI + "#personKnowsPerson", PUBLIC); assertEquals("Person Knows Person", relationship.getDisplayName()); assertNull(relationship.getTimeFormula()); assertTrue(relationship.getRangeConceptIRIs().contains("http://visallo.org/test#person2")); assertTrue(relationship.getRangeConceptIRIs().contains("http://visallo.org/test#person")); assertTrue(relationship.getDomainConceptIRIs().contains("http://visallo.org/test#person")); Concept thing = getOntologyRepository().getEntityConcept(workspaceId); assertNotNull(thing.getTitleFormula()); assertNotNull(thing.getSubtitleFormula()); assertNotNull(thing.getTimeFormula()); }
private void validateTestOwlConcepts(int expectedIriSize) throws IOException { Concept contact = getOntologyRepository().getConceptByIRI(TEST_IRI + "#contact", PUBLIC); assertEquals("Contact", contact.getDisplayName()); assertEquals("rgb(149, 138, 218)", contact.getColor()); assertEquals("test", contact.getDisplayType()); List<String> intents = Arrays.asList(contact.getIntents()); assertEquals(1, intents.size()); assertTrue(intents.contains("face")); Concept person = getOntologyRepository().getConceptByIRI(TEST_IRI + "#person", PUBLIC); assertEquals("Person", person.getDisplayName()); intents = Arrays.asList(person.getIntents()); assertEquals(1, intents.size()); assertTrue(intents.contains("person")); assertEquals("prop('http://visallo.org/test#birthDate') || ''", person.getTimeFormula()); assertEquals("prop('http://visallo.org/test#name') || ''", person.getTitleFormula()); byte[] bytes = IOUtils.toByteArray(OntologyRepositoryTestBase.class.getResourceAsStream("glyphicons_003_user@2x.png")); assertArrayEquals(bytes, person.getGlyphIcon()); assertEquals("rgb(28, 137, 28)", person.getColor()); Set<Concept> conceptAndAllChildren = getOntologyRepository().getConceptAndAllChildren(contact, PUBLIC); List<String> iris = Lists.newArrayList(); conceptAndAllChildren.forEach(c -> iris.add(c.getIRI())); assertEquals(expectedIriSize, iris.size()); assertTrue(iris.contains(contact.getIRI())); assertTrue(iris.contains(person.getIRI())); }
@Test public void testProperlyConfiguredThingConcept() throws Exception { createSampleOntology(); Concept thing = getOntologyRepository().getEntityConcept(workspaceId); assertNotNull(thing.getTitleFormula()); assertNotNull(thing.getSubtitleFormula()); assertNotNull(thing.getTimeFormula()); }
concept.setDisplayType(getDisplayType()); if (getTitleFormula() != null) { concept.setTitleFormula(getTitleFormula());