本文整理了Java中org.vertexium.Graph.getMetadata()
方法的一些代码示例,展示了Graph.getMetadata()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Graph.getMetadata()
方法的具体详情如下:
包路径:org.vertexium.Graph
类名称:Graph
方法名:getMetadata
[英]Gets all metadata.
[中]获取所有元数据。
代码示例来源:origin: org.visallo/visallo-core
public void checkVisalloGraphVersion(Graph g) {
Object visalloGraphVersionObj = g.getMetadata(GRAPH_METADATA_VISALLO_GRAPH_VERSION_KEY);
if (visalloGraphVersionObj == null) {
g.setMetadata(GRAPH_METADATA_VISALLO_GRAPH_VERSION_KEY, GRAPH_METADATA_VISALLO_GRAPH_VERSION);
} else if (visalloGraphVersionObj instanceof Integer) {
Integer visalloGraphVersion = (Integer) visalloGraphVersionObj;
if (!GRAPH_METADATA_VISALLO_GRAPH_VERSION.equals(visalloGraphVersion)) {
throw new VisalloException("Invalid " + GRAPH_METADATA_VISALLO_GRAPH_VERSION_KEY + " expected " + GRAPH_METADATA_VISALLO_GRAPH_VERSION + " found " + visalloGraphVersion);
}
} else {
throw new VisalloException("Invalid " + GRAPH_METADATA_VISALLO_GRAPH_VERSION_KEY + " expected Integer found " + visalloGraphVersionObj.getClass().getName());
}
}
代码示例来源:origin: visallo/vertexium
private void saveHashToVisibility(Graph graph, String hash, String visibilityString) {
String hashToVisibilityKey = getHashToVisibilityKey(hash);
String foundVisibilityString = (String) graph.getMetadata(hashToVisibilityKey);
if (foundVisibilityString == null) {
graph.setMetadata(hashToVisibilityKey, visibilityString);
}
}
代码示例来源:origin: org.vertexium/vertexium-test
@Test
public void testGraphMetadata() {
List<GraphMetadataEntry> existingMetadata = toList(graph.getMetadata());
graph.setMetadata("test1", "value1old");
graph.setMetadata("test1", "value1");
graph.setMetadata("test2", "value2");
assertEquals("value1", graph.getMetadata("test1"));
assertEquals("value2", graph.getMetadata("test2"));
assertEquals(null, graph.getMetadata("missingProp"));
List<GraphMetadataEntry> newMetadata = toList(graph.getMetadata());
assertEquals(existingMetadata.size() + 2, newMetadata.size());
}
代码示例来源:origin: org.vertexium/vertexium-elasticsearch5
private void saveHashToVisibility(Graph graph, String hash, String visibilityString) {
String hashToVisibilityKey = getHashToVisibilityKey(hash);
String foundVisibilityString = (String) graph.getMetadata(hashToVisibilityKey);
if (foundVisibilityString == null) {
graph.setMetadata(hashToVisibilityKey, visibilityString);
}
}
代码示例来源:origin: org.vertexium/vertexium-elasticsearch2
private void saveHashToVisibility(Graph graph, String hash, String visibilityString) {
String hashToVisibilityKey = getHashToVisibilityKey(hash);
String foundVisibilityString = (String) graph.getMetadata(hashToVisibilityKey);
if (foundVisibilityString == null) {
graph.setMetadata(hashToVisibilityKey, visibilityString);
}
}
代码示例来源:origin: visallo/vertexium
@Test
public void testGraphMetadata() {
List<GraphMetadataEntry> existingMetadata = toList(graph.getMetadata());
graph.setMetadata("test1", "value1old");
graph.setMetadata("test1", "value1");
graph.setMetadata("test2", "value2");
assertEquals("value1", graph.getMetadata("test1"));
assertEquals("value2", graph.getMetadata("test2"));
assertEquals(null, graph.getMetadata("missingProp"));
List<GraphMetadataEntry> newMetadata = toList(graph.getMetadata());
assertEquals(existingMetadata.size() + 2, newMetadata.size());
}
代码示例来源:origin: org.vertexium/vertexium-elasticsearch-singledocument
private void saveHashToVisibility(Graph graph, String hash, String visibilityString) {
String hashToVisibilityKey = getHashToVisibilityKey(hash);
String foundVisibilityString = (String) graph.getMetadata(hashToVisibilityKey);
if (foundVisibilityString == null) {
graph.setMetadata(hashToVisibilityKey, visibilityString);
}
}
代码示例来源:origin: org.vertexium/vertexium-elasticsearch2
@Override
public Visibility getVisibilityFromHash(Graph graph, String visibilityHash) {
String visibilityString = (String) graph.getMetadata(getHashToVisibilityKey(visibilityHash));
if (visibilityString == null) {
LOGGER.warn("Could not find visibility matching the hash \"%s\" in the metadata table.", visibilityHash);
return null;
}
return new Visibility(visibilityString);
}
代码示例来源:origin: org.visallo/visallo-core
public void verifyVersion(int requiredVersion) {
Object version = graph.getMetadata(VISALLO_VERSION_KEY);
if (version == null) {
writeVersion();
return;
}
if (!(version instanceof Integer)) {
throw new VisalloException("Invalid " + VISALLO_VERSION_KEY + " found. Expected Integer, found " + version.getClass().getName());
}
Integer versionInt = (Integer) version;
if (versionInt != requiredVersion) {
throw new VisalloException("Invalid " + VISALLO_VERSION_KEY + " found. Expected " + requiredVersion + ", found " + versionInt);
}
LOGGER.info("Visallo graph version verified: %d", versionInt);
}
代码示例来源:origin: org.vertexium/vertexium-elasticsearch5
@Override
public Visibility getVisibilityFromHash(Graph graph, String visibilityHash) {
String visibilityString = (String) graph.getMetadata(getHashToVisibilityKey(visibilityHash));
if (visibilityString == null) {
LOGGER.warn("Could not find visibility matching the hash \"%s\" in the metadata table.", visibilityHash);
return null;
}
return new Visibility(visibilityString);
}
代码示例来源:origin: visallo/vertexium
@Override
public Visibility getVisibilityFromHash(Graph graph, String visibilityHash) {
String visibilityString = (String) graph.getMetadata(getHashToVisibilityKey(visibilityHash));
if (visibilityString == null) {
LOGGER.warn("Could not find visibility matching the hash \"%s\" in the metadata table.", visibilityHash);
return null;
}
return new Visibility(visibilityString);
}
代码示例来源:origin: org.vertexium/vertexium-elasticsearch-singledocument
@Override
public Visibility getVisibilityFromHash(Graph graph, String visibilityHash) {
String visibilityString = (String) graph.getMetadata(getHashToVisibilityKey(visibilityHash));
if (visibilityString == null) {
LOGGER.warn("Could not find visibility matching the hash \"%s\" in the metadata table.", visibilityHash);
return null;
}
return new Visibility(visibilityString);
}
代码示例来源:origin: org.vertexium/vertexium-elasticsearch-singledocument
public String getHash(Graph graph, String propertyName, Visibility visibility) {
String visibilityString = visibility.getVisibilityString();
String propertyNameVisibilityToHashKey = getMetadataKey(propertyName, visibilityString);
String hash = (String) graph.getMetadata(propertyNameVisibilityToHashKey);
if (hash != null) {
saveHashToVisibility(graph, hash, visibilityString);
return hash;
}
hash = Hashing.murmur3_128().hashString(visibilityString, UTF8).toString();
graph.setMetadata(propertyNameVisibilityToHashKey, hash);
saveHashToVisibility(graph, hash, visibilityString);
return hash;
}
代码示例来源:origin: org.vertexium/vertexium-elasticsearch2
public String getHash(Graph graph, String propertyName, Visibility visibility) {
String visibilityString = visibility.getVisibilityString();
String propertyNameVisibilityToHashKey = getMetadataKey(propertyName, visibilityString);
String hash = (String) graph.getMetadata(propertyNameVisibilityToHashKey);
if (hash != null) {
saveHashToVisibility(graph, hash, visibilityString);
return hash;
}
hash = Hashing.murmur3_128().hashString(visibilityString, UTF8).toString();
graph.setMetadata(propertyNameVisibilityToHashKey, hash);
saveHashToVisibility(graph, hash, visibilityString);
return hash;
}
代码示例来源:origin: visallo/vertexium
public String getHash(Graph graph, String propertyName, Visibility visibility) {
String visibilityString = visibility.getVisibilityString();
String propertyNameVisibilityToHashKey = getMetadataKey(propertyName, visibilityString);
String hash = (String) graph.getMetadata(propertyNameVisibilityToHashKey);
if (hash != null) {
saveHashToVisibility(graph, hash, visibilityString);
return hash;
}
hash = Hashing.murmur3_128().hashString(visibilityString, UTF8).toString();
graph.setMetadata(propertyNameVisibilityToHashKey, hash);
saveHashToVisibility(graph, hash, visibilityString);
return hash;
}
代码示例来源:origin: org.vertexium/vertexium-elasticsearch5
public String getHash(Graph graph, String propertyName, Visibility visibility) {
String visibilityString = visibility.getVisibilityString();
String propertyNameVisibilityToHashKey = getMetadataKey(propertyName, visibilityString);
String hash = (String) graph.getMetadata(propertyNameVisibilityToHashKey);
if (hash != null) {
saveHashToVisibility(graph, hash, visibilityString);
return hash;
}
hash = Hashing.murmur3_128().hashString(visibilityString, UTF8).toString();
graph.setMetadata(propertyNameVisibilityToHashKey, hash);
saveHashToVisibility(graph, hash, visibilityString);
return hash;
}
代码示例来源:origin: org.visallo/visallo-tools-migration-core
@Override
protected final int run() throws Exception {
graph = getGraph();
try {
Object visalloGraphVersionObj = graph.getMetadata(GRAPH_METADATA_VISALLO_GRAPH_VERSION_KEY);
if (visalloGraphVersionObj == null) {
throw new VisalloException("No graph metadata version set");
} else if (visalloGraphVersionObj instanceof Integer) {
Integer visalloGraphVersion = (Integer) visalloGraphVersionObj;
if (getFinalGraphVersion().equals(visalloGraphVersion)) {
throw new VisalloException("Migration has already completed. Graph version: " + visalloGraphVersion);
} else if (!getNeededGraphVersion().equals(visalloGraphVersion)) {
throw new VisalloException("Migration can only run from version " + getNeededGraphVersion() +
". Current graph version = " + visalloGraphVersion);
}
} else {
throw new VisalloException("Unexpected value for graph version: " + visalloGraphVersionObj);
}
if (migrate(graph)) {
graph.setMetadata(GRAPH_METADATA_VISALLO_GRAPH_VERSION_KEY, getFinalGraphVersion());
}
graph.flush();
afterMigrate(graph);
return 0;
} finally {
graph.shutdown();
}
}
内容来源于网络,如有侵权,请联系作者删除!