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 void definePrivilegesProperty(OntologyRepository ontologyRepository) { List<Concept> concepts = new ArrayList<>(); concepts.add(ontologyRepository.getConceptByIRI(UserRepository.USER_CONCEPT_IRI, PUBLIC)); OntologyPropertyDefinition propertyDefinition = new OntologyPropertyDefinition( concepts, PRIVILEGES_PROPERTY_IRI, "Privileges", PropertyType.STRING ); propertyDefinition.setUserVisible(false); propertyDefinition.setTextIndexHints(TextIndexHint.NONE); ontologyRepository.getOrCreateProperty(propertyDefinition, new SystemUser(), PUBLIC); }
protected void defineAuthorizationsProperty(OntologyRepository ontologyRepository) { List<Concept> concepts = new ArrayList<>(); concepts.add(ontologyRepository.getConceptByIRI(UserRepository.USER_CONCEPT_IRI, PUBLIC)); OntologyPropertyDefinition propertyDefinition = new OntologyPropertyDefinition( concepts, AUTHORIZATIONS_PROPERTY_IRI, "Authorizations", PropertyType.STRING ); propertyDefinition.setUserVisible(false); propertyDefinition.setTextIndexHints(TextIndexHint.NONE); ontologyRepository.getOrCreateProperty(propertyDefinition, new SystemUser(), PUBLIC); }
@Test public void testPublishingNewPropertyValueAndPropertyTypeWithoutOntologyPublishPrivilege() { UserPropertyPrivilegeRepository privilegeRepository = (UserPropertyPrivilegeRepository) getPrivilegeRepository(); privilegeRepository.setPrivileges(user, Sets.newHashSet(Privilege.ONTOLOGY_ADD), getUserRepository().getSystemUser()); String newPropertyIri = "new-property"; OntologyPropertyDefinition propertyDefinition = new OntologyPropertyDefinition(Collections.singletonList(thingConcept), newPropertyIri, "New Property", PropertyType.STRING); propertyDefinition.setTextIndexHints(Collections.singleton(TextIndexHint.EXACT_MATCH)); propertyDefinition.setUserVisible(true); getOntologyRepository().getOrCreateProperty(propertyDefinition, user, workspace.getWorkspaceId()); getOntologyRepository().clearCache(); doTestPublishPropertyAdd(newPropertyIri, "Unable to publish relationship New Property", SandboxStatus.PRIVATE); }
@Test public void testPublishingNewPropertyValueAndPropertyType() { UserPropertyPrivilegeRepository privilegeRepository = (UserPropertyPrivilegeRepository) getPrivilegeRepository(); privilegeRepository.setPrivileges(user, Sets.newHashSet(Privilege.ONTOLOGY_ADD, Privilege.ONTOLOGY_PUBLISH), getUserRepository().getSystemUser()); String newPropertyIri = "new-property"; OntologyPropertyDefinition propertyDefinition = new OntologyPropertyDefinition(Collections.singletonList(thingConcept), newPropertyIri, "New Property", PropertyType.STRING); propertyDefinition.setTextIndexHints(Collections.singleton(TextIndexHint.EXACT_MATCH)); propertyDefinition.setUserVisible(true); getOntologyRepository().getOrCreateProperty(propertyDefinition, user, workspace.getWorkspaceId()); getOntologyRepository().clearCache(); doTestPublishPropertyAdd(newPropertyIri, null, SandboxStatus.PUBLIC); }
def.setSearchable(true); def.setSortable(true); def.setUserVisible(true); def.setUpdateable(true); if (displayType != null) {
@Override public void before() throws Exception { super.before(); user = getUserRepository().findOrAddUser("base-junit", "Base Junit", "base-junit@visallo.com", "password"); User systemUser = getUserRepository().getSystemUser(); Authorizations authorizations = getAuthorizationRepository().getGraphAuthorizations(systemUser); thingConcept = getOntologyRepository().getEntityConcept(PUBLIC); List<Concept> things = Collections.singletonList(thingConcept); Relationship hasEntityRel = getOntologyRepository().getOrCreateRelationshipType(null, things, things, "has-entity-iri", true, systemUser, PUBLIC); hasEntityRel.addIntent("entityHasImage", user, authorizations); getOntologyRepository().getOrCreateConcept(thingConcept, JUNIT_CONCEPT_TYPE, "Junit Concept", null, systemUser, PUBLIC); getOntologyRepository().getOrCreateRelationshipType(null, things, things, JUNIT_EDGE_LABEL, true, systemUser, PUBLIC); OntologyPropertyDefinition propertyDefinition = new OntologyPropertyDefinition(things, JUNIT_PROPERTY_NAME, "Junit Property", PropertyType.STRING); propertyDefinition.setTextIndexHints(Collections.singleton(TextIndexHint.EXACT_MATCH)); propertyDefinition.setUserVisible(true); getOntologyRepository().getOrCreateProperty(propertyDefinition, systemUser, PUBLIC); getOntologyRepository().clearCache(); workspace = getWorkspaceRepository().add("ws1", "workspace 1", user); workspaceAuthorizations = getAuthorizationRepository().getGraphAuthorizations(user, workspace.getWorkspaceId()); }