本文整理了Java中org.vertexium.Vertex
类的一些代码示例,展示了Vertex
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Vertex
类的具体详情如下:
包路径:org.vertexium.Vertex
类名称:Vertex
暂无
代码示例来源:origin: org.vertexium/vertexium-core
@Override
public Iterable<RelatedEdge> findRelatedEdgeSummaryForVertices(Iterable<Vertex> verticesIterable, Authorizations authorizations) {
List<RelatedEdge> results = new ArrayList<>();
List<Vertex> vertices = IterableUtils.toList(verticesIterable);
for (Vertex outVertex : vertices) {
Iterable<EdgeInfo> edgeInfos = outVertex.getEdgeInfos(Direction.OUT, authorizations);
for (EdgeInfo edgeInfo : edgeInfos) {
for (Vertex inVertex : vertices) {
if (edgeInfo.getVertexId().equals(inVertex.getId())) {
results.add(new RelatedEdgeImpl(edgeInfo.getEdgeId(), edgeInfo.getLabel(), outVertex.getId(), inVertex.getId()));
}
}
}
}
return results;
}
代码示例来源:origin: org.visallo/visallo-model-vertexium
protected ImmutableList<String> getDependentPropertyIris(Vertex vertex, String workspaceId) {
List<Edge> dependentProperties = Lists.newArrayList(vertex.getEdges(Direction.OUT, OntologyProperties.EDGE_LABEL_DEPENDENT_PROPERTY, getAuthorizations(workspaceId)));
dependentProperties.sort((e1, e2) -> {
Integer o1 = OntologyProperties.DEPENDENT_PROPERTY_ORDER_PROPERTY_NAME.getPropertyValue(e1, 0);
Integer o2 = OntologyProperties.DEPENDENT_PROPERTY_ORDER_PROPERTY_NAME.getPropertyValue(e2, 0);
return Integer.compare(o1, o2);
});
return ImmutableList.copyOf(dependentProperties.stream().map(e -> {
String propertyId = e.getOtherVertexId(vertex.getId());
return propertyId.substring(VertexiumOntologyRepository.ID_PREFIX_PROPERTY.length());
}).collect(Collectors.toList()));
}
代码示例来源:origin: org.visallo/visallo-core
private void publishGlyphIconProperties(Edge hasImageEdge, String workspaceId, Authorizations authorizations) {
Vertex entityVertex = hasImageEdge.getVertex(Direction.OUT, authorizations);
checkNotNull(entityVertex, "Could not find has image source vertex " + hasImageEdge.getVertexId(Direction.OUT));
ExistingElementMutation elementMutation = entityVertex.prepareMutation();
Iterable<Property> glyphIconProperties = entityVertex.getProperties(VisalloProperties.ENTITY_IMAGE_VERTEX_ID.getPropertyName());
for (Property glyphIconProperty : glyphIconProperties) {
if (publishNewProperty(elementMutation, glyphIconProperty, workspaceId)) {
elementMutation.save(authorizations);
return;
}
}
LOGGER.warn("new has image edge without a glyph icon property being set on vertex %s", entityVertex.getId());
}
代码示例来源:origin: org.vertexium/vertexium-accumulo
public VertexBuilder prepareVertex(Vertex vertex) {
return prepareVertex(vertex.getId(), null, vertex.getVisibility());
}
代码示例来源:origin: org.visallo/visallo-model-vertexium
public VertexiumUser(Vertex userVertex) {
this.userId = userVertex.getId();
for (Property property : userVertex.getProperties()) {
this.properties.put(property.getName(), property.getValue());
}
}
代码示例来源:origin: org.visallo/visallo-model-vertexium
private List<String> getAssociatedElements(String elementType) {
Iterable<Vertex> vertices = vertex.getVertices(Direction.BOTH, LabelName.HAS_PROPERTY.toString(), vertex.getAuthorizations());
List<String> result = StreamSupport.stream(vertices.spliterator(), false)
.filter(v -> elementType.equals(VisalloProperties.CONCEPT_TYPE.getPropertyValue(v)))
.map(OntologyProperties.ONTOLOGY_TITLE::getPropertyValue)
.collect(Collectors.toList());
CloseableUtils.closeQuietly(vertices);
return result;
}
}
代码示例来源:origin: org.visallo/visallo-core
public PingLongRunningProcessQueueItem(Vertex vertex) {
type = TYPE;
id = vertex.getId();
vertexId = vertex.getId();
}
代码示例来源:origin: org.vertexium/vertexium-cypher
private Stream<Edge> findEdges(
VertexiumCypherQueryContext ctx,
String name,
ListMultimap<String, CypherAstBase> propertiesMap,
Vertex startingVertex,
Direction direction,
List<String> labelNames
) {
if (name == null && propertiesMap.size() == 0) {
return stream(startingVertex.getEdgeInfos(direction, labelNamesToArray(labelNames), ctx.getAuthorizations()))
.map(edgeInfo -> new EdgeInfoEdge(ctx.getGraph(), startingVertex.getId(), edgeInfo, ctx.getFetchHints(), ctx.getAuthorizations()));
}
return stream(startingVertex.getEdges(direction, labelNamesToArray(labelNames), ctx.getFetchHints(), ctx.getAuthorizations()));
}
代码示例来源:origin: org.vertexium/vertexium-accumulo-titan-hadoop
private FaunusVertex createFaunusVertexFromRow(AccumuloGraph graph, PeekingIterator<Map.Entry<Key, Value>> row, Authorizations authorizations) {
final Vertex v = AccumuloVertexInputFormat.createVertex(graph, row, authorizations);
final long vertexId = toFaunusVertexId(v.getId());
FaunusVertex faunusVertex = new FaunusVertex();
faunusVertex.setId(vertexId);
faunusVertex.setVertexLabel(v.getId());
faunusVertex.addProperty("vertexiumId", v.getId());
for (Property property : v.getProperties()) {
if (property.getValue() instanceof StreamingPropertyValue) {
continue;
}
faunusVertex.addProperty(property.getName(), property.getValue());
}
for (EdgeInfo edgeInfo : v.getEdgeInfos(Direction.OUT, authorizations)) {
faunusVertex.addEdge(com.tinkerpop.blueprints.Direction.OUT, edgeInfo.getLabel(), toFaunusVertexId(edgeInfo.getVertexId()));
}
for (EdgeInfo edgeInfo : v.getEdgeInfos(Direction.IN, authorizations)) {
faunusVertex.addEdge(com.tinkerpop.blueprints.Direction.IN, edgeInfo.getLabel(), toFaunusVertexId(edgeInfo.getVertexId()));
}
return faunusVertex;
}
代码示例来源:origin: org.vertexium/vertexium-test
@Test
public void testElementMutationDoesntChangeObjectUntilSave() {
Vertex v = graph.addVertex("v1", VISIBILITY_EMPTY, AUTHORIZATIONS_ALL);
v.setProperty("prop1", "value1-1", VISIBILITY_A, AUTHORIZATIONS_ALL);
graph.flush();
ElementMutation<Vertex> m = v.prepareMutation()
.setProperty("prop1", "value1-2", VISIBILITY_A)
.setProperty("prop2", "value2-2", VISIBILITY_A);
Assert.assertEquals(1, count(v.getProperties()));
assertEquals("value1-1", v.getPropertyValue("prop1"));
v = m.save(AUTHORIZATIONS_A_AND_B);
Assert.assertEquals(2, count(v.getProperties()));
assertEquals("value1-2", v.getPropertyValue("prop1"));
assertEquals("value2-2", v.getPropertyValue("prop2"));
}
代码示例来源:origin: org.visallo/visallo-model-vertexium
private Vertex getParentVertex(Vertex vertex, String workspaceId) {
try {
return Iterables.getOnlyElement(vertex.getVertices(Direction.OUT, LabelName.IS_A.toString(), getAuthorizations(workspaceId)), null);
} catch (IllegalArgumentException iae) {
throw new IllegalStateException(String.format(
"Unexpected number of parents for concept %s",
OntologyProperties.TITLE.getPropertyValue(vertex)
), iae);
}
}
代码示例来源:origin: org.vertexium/vertexium-test
@Test
public void testAddVertexWithPropertiesWithTwoDifferentVisibilities() {
Vertex v = graph.prepareVertex("v1", VISIBILITY_EMPTY)
.setProperty("prop1", "value1a", VISIBILITY_A)
.setProperty("prop1", "value1b", VISIBILITY_B)
.save(AUTHORIZATIONS_A_AND_B);
Assert.assertEquals(2, count(v.getProperties("prop1")));
graph.flush();
v = graph.getVertex("v1", AUTHORIZATIONS_A_AND_B);
Assert.assertEquals(2, count(v.getProperties("prop1")));
v = graph.getVertex("v1", AUTHORIZATIONS_A);
Assert.assertEquals(1, count(v.getProperties("prop1")));
assertEquals("value1a", v.getPropertyValue("prop1"));
v = graph.getVertex("v1", AUTHORIZATIONS_B);
Assert.assertEquals(1, count(v.getProperties("prop1")));
assertEquals("value1b", v.getPropertyValue("prop1"));
}
代码示例来源:origin: org.visallo/visallo-core
@Override
public void cleanUpElements(Graph graph, Vertex productVertex, Authorizations authorizations) {
Iterable<Edge> productElementEdges = productVertex.getEdges(
Direction.OUT,
WorkspaceProperties.PRODUCT_TO_ENTITY_RELATIONSHIP_IRI,
authorizations
);
for (Edge productToElement : productElementEdges) {
graph.softDeleteEdge(productToElement, authorizations);
}
graph.flush();
}
代码示例来源:origin: org.vertexium/vertexium-test
@Test
public void testMetadataMutationsOnVertex() {
Metadata metadataPropB = Metadata.create();
metadataPropB.add("meta1", "meta1", VISIBILITY_A);
Vertex vertex = graph.prepareVertex("v1", VISIBILITY_A)
.setProperty("propBmeta", "propBmeta", metadataPropB, VISIBILITY_A)
.save(AUTHORIZATIONS_ALL);
graph.flush();
ExistingElementMutation<Vertex> m = vertex.prepareMutation();
m.setPropertyMetadata("propBmeta", "meta1", "meta2", VISIBILITY_A);
vertex = m.save(AUTHORIZATIONS_ALL);
assertEquals("meta2", vertex.getProperty("propBmeta").getMetadata().getEntry("meta1").getValue());
}
代码示例来源:origin: org.visallo/visallo-model-vertexium
@Override
public boolean hasGlyphIconResource() {
// TODO: This can be changed to GLYPH_ICON.getPropertyValue(vertex) once ENTITY_IMAGE_URL is added
return vertex.getPropertyValue(OntologyProperties.GLYPH_ICON.getPropertyName()) != null ||
vertex.getPropertyValue(OntologyProperties.GLYPH_ICON_FILE_NAME.getPropertyName()) != null;
}
代码示例来源:origin: org.vertexium/vertexium-test
@Test
public void testSoftDeletePropertyWithVisibility() {
Vertex v1 = graph.prepareVertex("v1", VISIBILITY_A)
.addPropertyValue("key1", "name1", "value1", VISIBILITY_A)
.addPropertyValue("key1", "name1", "value2", VISIBILITY_B)
.save(AUTHORIZATIONS_A_AND_B);
graph.flush();
assertEquals(2, count(graph.getVertex("v1", AUTHORIZATIONS_A_AND_B).getProperties()));
org.vertexium.test.util.IterableUtils.assertContains("value1", v1.getPropertyValues("name1"));
org.vertexium.test.util.IterableUtils.assertContains("value2", v1.getPropertyValues("name1"));
graph.getVertex("v1", AUTHORIZATIONS_A_AND_B).softDeleteProperty("key1", "name1", VISIBILITY_A, AUTHORIZATIONS_A_AND_B);
graph.flush();
assertEquals(1, count(graph.getVertex("v1", AUTHORIZATIONS_A_AND_B).getProperties()));
assertEquals(1, count(graph.getVertex("v1", AUTHORIZATIONS_A_AND_B).getPropertyValues("key1", "name1")));
org.vertexium.test.util.IterableUtils.assertContains("value2", graph.getVertex("v1", AUTHORIZATIONS_A_AND_B).getPropertyValues("name1"));
}
代码示例来源:origin: org.visallo/visallo-model-vertexium
private void deleteChangeableProperties(Vertex vertex, Authorizations authorizations) {
for (Property property : vertex.getProperties()) {
if (OntologyProperties.CHANGEABLE_PROPERTY_IRI.contains(property.getName())) {
vertex.softDeleteProperty(property.getKey(), property.getName(), authorizations);
}
}
graph.flush();
}
代码示例来源:origin: org.visallo/visallo-web
private byte[] createAndSaveCachedImage(Vertex vertex, String propertyKey, String url, int maxWidth, int maxHeight, int jpegQuality, Authorizations authorizations) throws IOException {
byte[] imageData = getAndSaveImageData(vertex, url, authorizations);
imageData = ImageUtils.resize(imageData, maxWidth, maxHeight, jpegQuality);
StreamingPropertyValue value = new StreamingPropertyValue(new ByteArrayInputStream(imageData), byte[].class);
value.store(true).searchIndex(false);
ExistingElementMutation<Vertex> m = vertex.prepareMutation();
VisalloProperties.CACHED_IMAGE.addPropertyValue(m, propertyKey, value, vertex.getVisibility());
m.save(authorizations);
return imageData;
}
代码示例来源:origin: org.vertexium/vertexium-test
@Test
public void testConcurrentModificationOfProperties() {
Vertex v = graph.prepareVertex("v1", VISIBILITY_EMPTY)
.setProperty("prop1", "value1", VISIBILITY_A)
.setProperty("prop2", "value2", VISIBILITY_A)
.save(AUTHORIZATIONS_A_AND_B);
int i = 0;
for (Property p : v.getProperties()) {
assertNotNull(p.toString());
if (i == 0) {
v.setProperty("prop3", "value3", VISIBILITY_A, AUTHORIZATIONS_A_AND_B);
}
i++;
}
}
代码示例来源:origin: org.vertexium/vertexium-core
@Override
protected boolean isIncluded(Vertex vertex) {
if (filters.contains(ElementFilter.ELEMENT)) {
if (vertex.getVisibility().hasAuthorization(authorizationToMatch)) {
return true;
}
}
return isIncludedByAuthorizations(vertex, filters, authorizationToMatch);
}
};
内容来源于网络,如有侵权,请联系作者删除!