private Concept getOntologyConcept(String conceptType, Ontology ontology, String workspaceId) { if (conceptType == null) { return null; } return ontology == null ? ontologyRepository.getConceptByIRI(conceptType, workspaceId) : ontology.getConceptByIri(conceptType); } }
@Override public String getPropertyIRIByIntent(String intent, String workspaceId) { OntologyProperty prop = getPropertyByIntent(intent, workspaceId); if (prop != null) { return prop.getTitle(); } return null; }
private byte[] getGlyphIcon(Concept concept, String workspaceId) { byte[] glyphIcon = null; for (Concept con = concept; glyphIcon == null && con != null; con = ontologyRepository.getParentConcept(con, workspaceId)) { glyphIcon = con.hasGlyphIconResource() ? con.getGlyphIcon() : null; } return glyphIcon; } }
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 OntologyProperty createProperty(String iri, String displayName, List<Concept> concepts, List<Relationship> relationships, String workspaceId) { OntologyPropertyDefinition publicPropertyDefinition = new OntologyPropertyDefinition(concepts, relationships, iri, displayName, PropertyType.STRING); publicPropertyDefinition.setTextIndexHints(Collections.singleton(TextIndexHint.EXACT_MATCH)); publicPropertyDefinition.setUserVisible(true); return getOntologyRepository().getOrCreateProperty(publicPropertyDefinition, systemUser, workspaceId); }
private Concept createConcept(String iri, String displayName, String workspaceId) { Concept thing = getOntologyRepository().getEntityConcept(workspaceId); return getOntologyRepository().getOrCreateConcept(thing, iri, displayName, null, systemUser, workspaceId); }
@Override public String getConceptIRIByIntent(String intent, String workspaceId) { Concept concept = getConceptByIntent(intent, workspaceId); if (concept != null) { return concept.getIRI(); } return null; }
@Override public String getRequiredConceptIRIByIntent(String intent, String workspaceId) { return getRequiredConceptByIntent(intent, workspaceId).getIRI(); }
@Override protected String convert(Concept o) { return o.getIRI(); } });
@Override public String getRelationshipIRIByIntent(String intent, String workspaceId) { Relationship relationship = getRelationshipByIntent(intent, workspaceId); if (relationship != null) { return relationship.getIRI(); } return null; }
@Override public String getRequiredRelationshipIRIByIntent(String intent, String workspaceId) { return getRequiredRelationshipByIntent(intent, workspaceId).getIRI(); }
private byte[] getMapGlyphIcon(Concept concept, String workspaceId) { byte[] mapGlyphIcon = null; for (Concept con = concept; mapGlyphIcon == null && con != null; con = ontologyRepository.getParentConcept(con, workspaceId)) { mapGlyphIcon = con.getMapGlyphIcon(); } return mapGlyphIcon; }
@Override public String toString() { return "Relationship{" + "iri='" + getIRI() + '\'' + '}'; } }
@Override public OntologyProperty getDependentPropertyParent(String iri, String workspaceId) { for (OntologyProperty property : getProperties(workspaceId)) { if (property.getDependentPropertyIris().contains(iri)) { return property; } } return null; }
@Override public String getRequiredPropertyIRIByIntent(String intent, String workspaceId) { return getRequiredPropertyByIntent(intent, workspaceId).getTitle(); }
@Override protected String convert(OntologyProperty o) { return o.getTitle(); } });
@Override public void publishProperty(OntologyProperty property, User user, String workspaceId) { checkPrivileges(user, null); internalPublishProperty(property, user, workspaceId); }
@Test(expected = VisalloAccessDeniedException.class) public void testCreatingConceptsWithNoUserOrWorkspace() { Concept thing = getOntologyRepository().getEntityConcept(workspaceId); getOntologyRepository().getOrCreateConcept(thing, PUBLIC_CONCEPT_IRI, PUBLIC_DISPLAY_NAME, null, null, PUBLIC); }
@Test(expected = VisalloAccessDeniedException.class) public void testCreatingSandboxedConceptsWithoutAddPermissionPrivilege() { Concept thing = getOntologyRepository().getEntityConcept(workspaceId); getOntologyRepository().getOrCreateConcept(thing, SANDBOX_CONCEPT_IRI, SANDBOX_DISPLAY_NAME, null, user, workspaceId); }
@Test(expected = VisalloAccessDeniedException.class) public void testCreatingPublicConceptsWithoutPublishPrivilege() { Concept thing = getOntologyRepository().getEntityConcept(workspaceId); getOntologyRepository().getOrCreateConcept(thing, PUBLIC_CONCEPT_IRI, PUBLIC_DISPLAY_NAME, null, user, PUBLIC); }