Examples of LumifyApi


Examples of io.lumify.web.clientapi.LumifyApi

        lumifyApi.logout();
    }

    private void testGeoSearch() throws ApiException, JsonProcessingException {
        LumifyApi lumifyApi = login(USERNAME_TEST_USER_1);

        String geoPoint = ObjectMapperFactory.getInstance().writeValueAsString(new GeoPoint(38.8951, -77.0367));
        lumifyApi.getVertexApi().setProperty(artifactVertexId, "", TestOntology.GEO_LOCATION.getPropertyName(), geoPoint, "", "justification", null, null);

        ClientApiVertexSearchResponse geoSearchResults = lumifyApi.getVertexApi().vertexGeoSearch(38.8951, -77.0367, 1000.0);
        assertEquals(1, geoSearchResults.getVertices().size());

        lumifyApi.logout();
    }
View Full Code Here

Examples of io.lumify.web.clientapi.LumifyApi

        lumifyApi.logout();
    }

    private void testSetTitleAndCheckConfidence() throws ApiException {
        LumifyApi lumifyApi = login(USERNAME_TEST_USER_1);

        ClientApiWorkspace newWorkspace = lumifyApi.getWorkspaceApi().create();
        lumifyApi.setWorkspaceId(newWorkspace.getWorkspaceId());

        lumifyApi.getVertexApi().setProperty(artifactVertexId, "", LumifyProperties.TITLE.getPropertyName(), "New Title", "", "new title", null, null);

        ClientApiElement artifactVertex = lumifyApi.getVertexApi().getByVertexId(artifactVertexId);
        boolean foundNewTitle = false;
        for (ClientApiProperty prop : artifactVertex.getProperties()) {
            if (prop.getKey().equals("") && prop.getName().equals(LumifyProperties.TITLE.getPropertyName())) {
                foundNewTitle = true;
                LOGGER.info("new title prop: %s", prop.toString());
                assertNotNull("could not find confidence", LumifyProperties.CONFIDENCE.getMetadataValue(prop.getMetadata()));
                assertEquals(GraphUtil.SET_PROPERTY_CONFIDENCE, LumifyProperties.CONFIDENCE.getMetadataValue(prop.getMetadata()), 0.01);
            }
        }
        assertTrue("Could not find new title", foundNewTitle);

        lumifyApi.logout();
        lumifyApi.setWorkspaceId(workspaceId);
    }
View Full Code Here

Examples of io.lumify.web.clientapi.LumifyApi

        addPropertyWithPrivateSandboxStatus();
        assertAllPropertiesArePublic();
    }

    private void setupTest() throws ApiException, IOException {
        LumifyApi lumifyApi = login(USERNAME_TEST_USER_1);
        addUserAuth(lumifyApi, USERNAME_TEST_USER_1, "A");
        addUserAuth(lumifyApi, USERNAME_TEST_USER_1, "B");
        addUserAuth(lumifyApi, USERNAME_TEST_USER_1, "C");

        ClientApiArtifactImportResponse artifact = lumifyApi.getVertexApi().importFile("", "test.txt", new ByteArrayInputStream("Susan Feng knows Joe Ferner.".getBytes()));
        assertEquals(1, artifact.getVertexIds().size());
        assertNotNull(artifact.getVertexIds().get(0));

        lumifyTestCluster.processGraphPropertyQueue();

        ClientApiElement susanFengVertex = lumifyApi.getVertexApi().create(CONCEPT_TEST_PERSON, "");
        susanFengVertexId = susanFengVertex.getId();
        lumifyApi.getVertexApi().setProperty(susanFengVertexId, TEST_MULTI_VALUE_KEY, LumifyProperties.TITLE.getPropertyName(), "Susan Feng", "", "test", null, null);

        lumifyTestCluster.processGraphPropertyQueue();
        lumifyApi.getVertexApi().setProperty(susanFengVertexId, "key1", NAME_PROPERTY_IRI, "Joe", "A", "test", null, null);
        lumifyApi.getVertexApi().setProperty(susanFengVertexId, "key2", NAME_PROPERTY_IRI, "Bob", "A", "test", null, null);
        lumifyApi.getVertexApi().setProperty(susanFengVertexId, "key2", NAME_PROPERTY_IRI, "Sam", "B", "test", null, null);

        assertPublishAll(lumifyApi, 17);

        susanFengVertex = lumifyApi.getVertexApi().getByVertexId(susanFengVertexId);
        assertEquals(SandboxStatus.PUBLIC, susanFengVertex.getSandboxStatus());
        List<ClientApiProperty> properties = susanFengVertex.getProperties();

        assertHasProperty(properties, "key1", NAME_PROPERTY_IRI, "Joe");
        List<ClientApiProperty> key2Properties = getProperties(properties, "key2", NAME_PROPERTY_IRI);
        assertEquals(2, key2Properties.size());
        assertEquals("Bob", key2Properties.get(0).getValue());
        assertEquals("Sam", key2Properties.get(1).getValue());
        assertEquals(SandboxStatus.PUBLIC, key2Properties.get(0).getSandboxStatus());
        assertEquals(SandboxStatus.PUBLIC, key2Properties.get(1).getSandboxStatus());

        for (ClientApiProperty property : properties) {
            assertEquals(SandboxStatus.PUBLIC, property.getSandboxStatus());
        }

        lumifyApi.logout();
    }
View Full Code Here

Examples of io.lumify.web.clientapi.LumifyApi

        lumifyApi.logout();
    }

    private void addPropertyWithPublicChangeSandboxStatus() throws ApiException, IOException {
        LumifyApi lumifyApi = login(USERNAME_TEST_USER_1);
        ClientApiElement susanFengVertex = lumifyApi.getVertexApi().setProperty(susanFengVertexId, "key1", NAME_PROPERTY_IRI, "Tom", "A", "test", null, null);
        List<ClientApiProperty> key1Properties = getProperties(susanFengVertex.getProperties(), "key1", NAME_PROPERTY_IRI);
        assertEquals(2, key1Properties.size());
        assertEquals("Tom", key1Properties.get(0).getValue());
        assertEquals(SandboxStatus.PUBLIC_CHANGED, key1Properties.get(0).getSandboxStatus());
        assertEquals("Joe", key1Properties.get(1).getValue());
        assertEquals(SandboxStatus.PUBLIC, key1Properties.get(1).getSandboxStatus());

        List<ClientApiProperty> key2Properties = getProperties(susanFengVertex.getProperties(), "key2", NAME_PROPERTY_IRI);
        assertEquals("Bob", key2Properties.get(0).getValue());
        assertEquals(SandboxStatus.PUBLIC, key2Properties.get(0).getSandboxStatus());
        assertEquals("Sam", key2Properties.get(1).getValue());
        assertEquals(SandboxStatus.PUBLIC, key2Properties.get(1).getSandboxStatus());
        lumifyApi.logout();
    }
View Full Code Here

Examples of io.lumify.web.clientapi.LumifyApi

        assertEquals(SandboxStatus.PUBLIC, key2Properties.get(1).getSandboxStatus());
        lumifyApi.logout();
    }

    private void addPropertyWithPrivateSandboxStatus() throws ApiException, IOException {
        LumifyApi lumifyApi = login(USERNAME_TEST_USER_1);
        lumifyApi.getVertexApi().setProperty(susanFengVertexId, "key2", NAME_PROPERTY_IRI, "Dave", "C", "test", null, null);
        ClientApiElement susanFengVertex = lumifyApi.getVertexApi().setProperty(susanFengVertexId, "key3", NAME_PROPERTY_IRI, "Susan", "", "test", null, null);

        List<ClientApiProperty> key1Properties = getProperties(susanFengVertex.getProperties(), "key1", NAME_PROPERTY_IRI);
        assertEquals(2, key1Properties.size());
        assertEquals("Tom", key1Properties.get(0).getValue());
        assertEquals(SandboxStatus.PUBLIC_CHANGED, key1Properties.get(0).getSandboxStatus());
        assertEquals(SandboxStatus.PUBLIC, key1Properties.get(1).getSandboxStatus());

        List<ClientApiProperty> key2Properties = getProperties(susanFengVertex.getProperties(), "key2", NAME_PROPERTY_IRI);
        assertEquals(3, key2Properties.size());
        assertEquals("Bob", key2Properties.get(0).getValue());
        assertEquals(SandboxStatus.PUBLIC, key2Properties.get(0).getSandboxStatus());
        assertEquals("Sam", key2Properties.get(1).getValue());
        assertEquals(SandboxStatus.PUBLIC, key2Properties.get(1).getSandboxStatus());
        assertEquals("Dave", key2Properties.get(2).getValue());
        assertEquals(SandboxStatus.PRIVATE, key2Properties.get(2).getSandboxStatus());

        List<ClientApiProperty> key3Properties = getProperties(susanFengVertex.getProperties(), "key3", NAME_PROPERTY_IRI);
        assertEquals(1, key3Properties.size());
        assertEquals("Susan", key3Properties.get(0).getValue());
        assertEquals(SandboxStatus.PRIVATE, key3Properties.get(0).getSandboxStatus());
        lumifyApi.logout();
    }
View Full Code Here

Examples of io.lumify.web.clientapi.LumifyApi

        assertEquals(SandboxStatus.PRIVATE, key3Properties.get(0).getSandboxStatus());
        lumifyApi.logout();
    }

    private void assertAllPropertiesArePublic() throws ApiException, IOException {
        LumifyApi lumifyApi = login(USERNAME_TEST_USER_1);
        assertPublishAll(lumifyApi, 3);
        ClientApiElement susanFengVertex = lumifyApi.getVertexApi().getByVertexId(susanFengVertexId);
        List<ClientApiProperty> properties = susanFengVertex.getProperties();
        assertEquals(8, properties.size());

        VisibilityJson visibilityJsonA = new VisibilityJson();
        visibilityJsonA.setSource("A");

        VisibilityJson visibilityJsonB = new VisibilityJson();
        visibilityJsonB.setSource("B");

        VisibilityJson visibilityJsonC = new VisibilityJson();
        visibilityJsonC.setSource("C");

        VisibilityJson visibilityJsonNoSource = new VisibilityJson();

        List<ClientApiProperty> key1Properties = getProperties(susanFengVertex.getProperties(), "key1", NAME_PROPERTY_IRI);
        assertEquals(1, key1Properties.size());
        assertHasProperty(key1Properties, "key1", NAME_PROPERTY_IRI, "Tom");
        ClientApiProperty key1Property = key1Properties.get(0);
        checkVisibility(key1Property, visibilityJsonA);

        List<ClientApiProperty> key2Properties = getProperties(susanFengVertex.getProperties(), "key2", NAME_PROPERTY_IRI);
        assertEquals(3, key2Properties.size());
        assertEquals("Bob", key2Properties.get(0).getValue());
        assertEquals("Sam", key2Properties.get(1).getValue());
        assertEquals("Dave", key2Properties.get(2).getValue());
        checkVisibility(key2Properties.get(0), visibilityJsonA);
        checkVisibility(key2Properties.get(1), visibilityJsonB);
        checkVisibility(key2Properties.get(2), visibilityJsonC);

        List<ClientApiProperty> key3Properties = getProperties(susanFengVertex.getProperties(), "key3", NAME_PROPERTY_IRI);
        assertEquals(1, key3Properties.size());
        assertHasProperty(key3Properties, "key3", NAME_PROPERTY_IRI, "Susan");
        ClientApiProperty key3Property = key3Properties.get(0);
        checkVisibility(key3Property, visibilityJsonNoSource);
        lumifyApi.logout();
    }
View Full Code Here

Examples of io.lumify.web.clientapi.LumifyApi

        uploadAndProcessCsv();
        assertUser2CanSeeCsvVertices();
    }

    public void uploadAndProcessCsv() throws ApiException, IOException {
        LumifyApi lumifyApi = login(USERNAME_TEST_USER_1);
        addUserAuth(lumifyApi, USERNAME_TEST_USER_1, "auth1");

        ClientApiArtifactImportResponse artifact = lumifyApi.getVertexApi().importFile("auth1", "sample.csv", new ByteArrayInputStream(FILE_CONTENTS.getBytes()));
        artifactVertexId = artifact.getVertexIds().get(0);

        lumifyApi.getVertexApi().setProperty(artifactVertexId, "", CsvOntology.MAPPING_JSON.getPropertyName(), MAPPING_JSON, "", "", null, null);

        lumifyTestCluster.processGraphPropertyQueue();

        assertPublishAll(lumifyApi, 46);

        ClientApiVertexSearchResponse searchResults = lumifyApi.getVertexApi().vertexSearch("*");
        LOGGER.info("searchResults (user1): %s", searchResults);
        assertEquals(8, searchResults.getVertices().size());
        for (ClientApiVertex v : searchResults.getVertices()) {
            assertEquals("auth1", v.getVisibilitySource());
        }

        lumifyApi.logout();
    }
View Full Code Here

Examples of io.lumify.web.clientapi.LumifyApi

        lumifyApi.logout();
    }

    private void assertUser2CanSeeCsvVertices() throws ApiException {
        LumifyApi lumifyApi = login(USERNAME_TEST_USER_2);
        addUserAuth(lumifyApi, USERNAME_TEST_USER_2, "auth1");

        ClientApiVertexSearchResponse searchResults = lumifyApi.getVertexApi().vertexSearch("*");
        LOGGER.info("searchResults (user2): %s", searchResults);
        assertEquals(8, searchResults.getVertices().size());

        lumifyApi.logout();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.