@Override protected String convert(Vertex o) { return o.getId(); } });
@Override protected String convert(Vertex vertex) { return vertex.getId(); } };
@Nullable @Override public String apply(Vertex v) { return v.getId(); } });
public static Map<String, Vertex> verticesToMapById(Iterable<Vertex> vertices) { Map<String, Vertex> results = new HashMap<>(); for (Vertex vertex : vertices) { results.put(vertex.getId(), vertex); } return results; }
@Override public Vertex getVertex(String vertexId, FetchHints fetchHints, Long endTime, Authorizations authorizations) { for (Vertex vertex : getVertices(fetchHints, endTime, authorizations)) { if (vertex.getId().equals(vertexId)) { return vertex; } } return null; }
@Override protected boolean isIncluded(Vertex otherVertex) { return otherVertex.getId().equals(getOtherVertexId()); } };
public GraphUpdateContext.UpdateFuture<Edge> addOrUpdateProductEdgeToEntity(GraphUpdateContext ctx, Vertex productVertex, String entityId, UpdateProductEdgeOptions options, Visibility visibility) { return addOrUpdateProductEdgeToEntity( ctx, getEdgeId(productVertex.getId(), entityId), productVertex, entityId, options, visibility ); }
/** * If this is a resolved term mention. This allows setting that information. * * @param resolvedToVertex The vertex this term mention resolves to. * @param resolvedEdge The edge that links the source vertex to the resolved vertex. */ public TermMentionBuilder resolvedTo(Vertex resolvedToVertex, Edge resolvedEdge) { return resolvedTo(resolvedToVertex.getId(), resolvedEdge.getId()); }
public String search(Graph graph, Authorizations authorizations) { Query query = graph.query(authorizations).limit(1); List<Vertex> vertices = Lists.newArrayList(query.vertices()); if (vertices.size() == 0) { throw new VisalloException("query returned no vertices"); } else if (vertices.size() > 1) { throw new VisalloException("query returned more than one vertex"); } return vertices.get(0).getId(); }
public VertexiumUser(Vertex userVertex) { this.userId = userVertex.getId(); for (Property property : userVertex.getProperties()) { this.properties.put(property.getName(), property.getValue()); } }
@Override public Iterable<String> getEdgeIds(final Vertex otherVertex, final Direction direction, final String[] labels, final Authorizations authorizations) { getFetchHints().validateHasEdgeFetchHints(direction, labels); return getEdgeIdsWithOtherVertexId(otherVertex.getId(), direction, labels, authorizations); }
private FilterBuilder getDirectionInEdgeFilter() { FilterBuilder outVertexIdFilter = FilterBuilders.termFilter(ElasticsearchSingleDocumentSearchIndex.IN_VERTEX_ID_FIELD_NAME, sourceVertex.getId()); if (otherVertexId != null) { FilterBuilder inVertexIdFilter = FilterBuilders.termFilter(ElasticsearchSingleDocumentSearchIndex.OUT_VERTEX_ID_FIELD_NAME, otherVertexId); return FilterBuilders.andFilter(outVertexIdFilter, inVertexIdFilter); } return outVertexIdFilter; }
private FilterBuilder getDirectionOutEdgeFilter() { FilterBuilder outVertexIdFilter = FilterBuilders.termFilter(ElasticsearchSingleDocumentSearchIndex.OUT_VERTEX_ID_FIELD_NAME, sourceVertex.getId()); if (otherVertexId != null) { FilterBuilder inVertexIdFilter = FilterBuilders.termFilter(ElasticsearchSingleDocumentSearchIndex.IN_VERTEX_ID_FIELD_NAME, otherVertexId); return FilterBuilders.andFilter(outVertexIdFilter, inVertexIdFilter); } return outVertexIdFilter; }
private void unresolveTermMentionsForProperty(Vertex vertex, Property property, Authorizations authorizations) { for (Vertex termMention : termMentionRepository.findResolvedTo(vertex.getId(), authorizations)) { String key = VisalloProperties.TERM_MENTION_REF_PROPERTY_KEY.getPropertyValue(termMention); String name = VisalloProperties.TERM_MENTION_REF_PROPERTY_NAME.getPropertyValue(termMention); String visibility = VisalloProperties.TERM_MENTION_REF_PROPERTY_VISIBILITY.getPropertyValue(termMention); if (property.getKey().equals(key) && property.getName().equals(name) && property.getVisibility().getVisibilityString().equals(visibility)) { unresolveTerm(termMention, authorizations); } } }
@Override public void updatePropertyDependentIris(OntologyProperty property, Collection<String> newDependentPropertyIris, User user, String workspaceId) { VertexiumOntologyProperty vertexiumProperty = (VertexiumOntologyProperty) property; if (!isPublic(workspaceId) || property.getSandboxStatus() == SandboxStatus.PRIVATE) { throw new UnsupportedOperationException("Sandboxed updating of dependent iris is not currently supported for properties"); } saveDependentProperties(vertexiumProperty.getVertex().getId(), newDependentPropertyIris, user, workspaceId); graph.flush(); vertexiumProperty.setDependentProperties(newDependentPropertyIris); }
@Override public Iterable<Edge> getEdges(final Vertex otherVertex, Direction direction, FetchHints fetchHints, Authorizations authorizations) { getFetchHints().validateHasEdgeFetchHints(direction); return getGraph().getEdges(getEdgeIdsWithOtherVertexId(otherVertex.getId(), direction, null, authorizations), fetchHints, authorizations); }
public static ClientApiSearch toClientApiSearch(Vertex searchVertex, ClientApiSearch.Scope scope) { ClientApiSearch result = new ClientApiSearch(); result.id = searchVertex.getId(); result.name = SearchProperties.NAME.getPropertyValue(searchVertex); result.url = SearchProperties.URL.getPropertyValue(searchVertex); result.scope = scope; result.parameters = ClientApiConverter.toClientApiValue(SearchProperties.PARAMETERS.getPropertyValue( searchVertex)); return result; }
private QueryBuilder getDirectionInEdgeFilter() { QueryBuilder outVertexIdFilter = QueryBuilders.termQuery(Elasticsearch2SearchIndex.IN_VERTEX_ID_FIELD_NAME, sourceVertex.getId()); if (otherVertexId != null) { QueryBuilder inVertexIdFilter = QueryBuilders.termQuery(Elasticsearch2SearchIndex.OUT_VERTEX_ID_FIELD_NAME, otherVertexId); return QueryBuilders.boolQuery() .must(outVertexIdFilter) .must(inVertexIdFilter); } return outVertexIdFilter; }
@Test public void testBlankVisibilityString() { Vertex v = graph.addVertex("v1", VISIBILITY_EMPTY, AUTHORIZATIONS_EMPTY); assertNotNull(v); assertEquals("v1", v.getId()); graph.flush(); v = graph.getVertex("v1", AUTHORIZATIONS_EMPTY); assertNotNull(v); assertEquals("v1", v.getId()); assertEquals(VISIBILITY_EMPTY, v.getVisibility()); }