本文整理匯總了Java中com.tinkerpop.blueprints.Vertex.getProperty方法的典型用法代碼示例。如果您正苦於以下問題:Java Vertex.getProperty方法的具體用法?Java Vertex.getProperty怎麽用?Java Vertex.getProperty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.tinkerpop.blueprints.Vertex
的用法示例。
在下文中一共展示了Vertex.getProperty方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getUser
import com.tinkerpop.blueprints.Vertex; //導入方法依賴的package包/類
public User getUser( String id ) {
Graph graph = (Graph) connection.get();
logger.debug("getUser: " + id );
try {
Vertex v = graph.getVertex( id );
if( v == null ) {
throw new UserNotFoundException( id );
}
User user = new User( v.getId().toString(),
v.getProperty( GremlinDAOSpec.USER_PROPERTY_EMAIL ),
v.getProperty( GremlinDAOSpec.USER_PROPERTY_FIRST_NAME ).toString(),
v.getProperty( GremlinDAOSpec.USER_PROPERTY_LAST_NAME ).toString()
);
return user;
}
finally {
graph.shutdown();
}
}
示例2: getAllUsers
import com.tinkerpop.blueprints.Vertex; //導入方法依賴的package包/類
@Override
public List<User> getAllUsers() {
List<User> users = new ArrayList<User>();
Graph graph = (Graph) connection.get();
logger.debug("getAllUsers" );
try {
Iterable<Vertex> iterable = graph.getVertices( GremlinDAOSpec.UNIVERSAL_PROPERTY_TYPE, GremlinDAOSpec.USER_CLASS );
Iterator<Vertex> it = iterable.iterator();
while( it.hasNext() ) {
Vertex v = it.next();
User user = new User( v.getId().toString(),
v.getProperty( GremlinDAOSpec.USER_PROPERTY_EMAIL ),
v.getProperty( GremlinDAOSpec.USER_PROPERTY_FIRST_NAME ).toString(),
v.getProperty( GremlinDAOSpec.USER_PROPERTY_LAST_NAME ).toString()
);
users.add(user);
}
return users;
}
finally {
graph.shutdown();
}
}
示例3: getMeshRootVertex
import com.tinkerpop.blueprints.Vertex; //導入方法依賴的package包/類
/**
* Return the mesh root vertex.
*
* @return
*/
public static Vertex getMeshRootVertex(TransactionalGraph graph) {
Iterator<Vertex> it = graph.getVertices("@class", MESH_ROOT_TYPE).iterator();
if (it.hasNext()) {
return it.next();
} else {
Iterator<Vertex> itLegacy = graph.getVertices(PolymorphicTypeResolver.TYPE_RESOLUTION_KEY, MESH_ROOT_LEGACY_TYPE).iterator();
if (itLegacy.hasNext()) {
return itLegacy.next();
} else {
// Legacy index less handling
for (Vertex vertex : graph.getVertices()) {
String fermaType = vertex.getProperty("ferma_type");
if (fermaType != null && fermaType.endsWith(MESH_ROOT_TYPE)) {
return vertex;
}
}
return null;
}
}
}
示例4: updateProperty
import com.tinkerpop.blueprints.Vertex; //導入方法依賴的package包/類
private void updateProperty(String propertyName, Vertex node) {
Object obj = node.getProperty(propertyName);
if (obj == null) {
return;
}
if (!(obj instanceof String)) {
if (log.isDebugEnabled()) {
log.debug("Property '{}' for node '{}' in database is no string so we don't convert it. {}: '{}'", propertyName, node.getProperty(UUID), obj.getClass(), obj);
}
return;
}
String strVal = (String) obj;
Number numVal;
try {
numVal = format.parse(strVal);
} catch (ParseException e) {
log.warn("Could not parse the number '{}', for field '{}' in node {}", strVal, propertyName, node.getId());
numVal = 0;
}
node.removeProperty(propertyName);
node.setProperty(propertyName, numVal);
}
示例5: apply
import com.tinkerpop.blueprints.Vertex; //導入方法依賴的package包/類
@Override
public void apply() {
Vertex meshRoot = getMeshRootVertex();
Vertex microschemaRoot = meshRoot.getVertices(OUT, "HAS_MICROSCHEMA_ROOT").iterator().next();
Iterator<Vertex> microschemaIt = microschemaRoot.getVertices(OUT, "HAS_SCHEMA_CONTAINER_ITEM").iterator();
while (microschemaIt.hasNext()) {
Vertex microschemaVertex = microschemaIt.next();
Iterator<Vertex> versionIt = microschemaVertex.getVertices(OUT, "HAS_PARENT_CONTAINER").iterator();
while (versionIt.hasNext()) {
Vertex microschemaVersion = versionIt.next();
String json = microschemaVersion.getProperty("json");
JsonObject schema = new JsonObject(json);
schema.remove("editor");
schema.remove("edited");
schema.remove("creator");
schema.remove("created");
schema.remove("rolePerms");
schema.remove("permissions");
microschemaVersion.setProperty("json", schema.toString());
}
}
}
示例6: migrateTags
import com.tinkerpop.blueprints.Vertex; //導入方法依賴的package包/類
/**
* Tags no longer have a TagGraphFieldContainerImpl. The value is now stored directly in the tag vertex.
*
* @param meshRoot
*/
private void migrateTags(Vertex meshRoot) {
Vertex tagRoot = meshRoot.getVertices(Direction.OUT, "HAS_TAG_ROOT").iterator().next();
for (Vertex tag : tagRoot.getVertices(Direction.OUT, "HAS_TAG")) {
Iterator<Vertex> tagFieldIterator = tag.getVertices(Direction.OUT, "HAS_FIELD_CONTAINER").iterator();
Vertex tagFieldContainer = tagFieldIterator.next();
if (tagFieldIterator.hasNext()) {
fail("The tag with uuid {" + tag.getProperty("uuid") + "} got more then one field container.");
}
// Load the tag value from the field container and store it directly into the tag. Remove the now no longer needed field container from the graph.
String tagValue = tagFieldContainer.getProperty("name");
tag.setProperty("tagValue", tagValue);
tagFieldContainer.remove();
// Check editor /creator
getOrFixUserReference(tag, "HAS_EDITOR");
getOrFixUserReference(tag, "HAS_CREATOR");
}
}
示例7: apply
import com.tinkerpop.blueprints.Vertex; //導入方法依賴的package包/類
@Override
public void apply() {
Vertex meshRoot = getMeshRootVertex();
Vertex schemaRoot = meshRoot.getVertices(OUT, "HAS_ROOT_SCHEMA").iterator().next();
Iterator<Vertex> schemaIt = schemaRoot.getVertices(OUT, "HAS_SCHEMA_CONTAINER_ITEM").iterator();
while (schemaIt.hasNext()) {
Vertex schemaVertex = schemaIt.next();
Iterator<Vertex> versionIt = schemaVertex.getVertices(OUT, "HAS_PARENT_CONTAINER").iterator();
while (versionIt.hasNext()) {
Vertex schemaVersion = versionIt.next();
String json = schemaVersion.getProperty("json");
JsonObject schema = new JsonObject(json);
schema.remove("editor");
schema.remove("edited");
schema.remove("creator");
schema.remove("created");
schema.remove("rolePerms");
schema.remove("permissions");
schemaVersion.setProperty("json", schema.toString());
}
}
}
示例8: updateMicroschemas
import com.tinkerpop.blueprints.Vertex; //導入方法依賴的package包/類
private void updateMicroschemas(Vertex meshRoot) {
Vertex microschemaRoot = meshRoot.getVertices(OUT, "HAS_MICROSCHEMA_ROOT").iterator().next();
Iterator<Vertex> microschemaIt = microschemaRoot.getVertices(OUT, "HAS_SCHEMA_CONTAINER_ITEM").iterator();
while (microschemaIt.hasNext()) {
Vertex microschemaVertex = microschemaIt.next();
Iterator<Vertex> versionIt = microschemaVertex.getVertices(OUT, "HAS_PARENT_CONTAINER").iterator();
while (versionIt.hasNext()) {
Vertex schemaVersion = versionIt.next();
// Update the version within the vertex
int vertexVersion = schemaVersion.getProperty("version");
schemaVersion.removeProperty("version");
schemaVersion.setProperty("version", String.valueOf(vertexVersion) + ".0");
// Update the version within the json
String json = schemaVersion.getProperty("json");
JsonObject schema = new JsonObject(json);
int version = schema.getInteger("version");
schema.remove("version");
schema.put("version", String.valueOf(version) + ".0");
schemaVersion.setProperty("json", schema.toString());
}
}
}
示例9: migrateContainer
import com.tinkerpop.blueprints.Vertex; //導入方法依賴的package包/類
private void migrateContainer(Vertex container) {
boolean isPublished = false;
Iterable<Edge> edges = container.getEdges(Direction.IN, "HAS_FIELD_CONTAINER");
// Check whether the container is published
for (Edge edge : edges) {
String type = edge.getProperty("edgeType");
if ("P".equals(type)) {
isPublished = true;
}
}
// The container is not published anywhere. Remove the bogus publish webroot info which otherwise causes publish webroot conflicts with new versions.
if (!isPublished) {
if (container.getProperty(WEBROOT_PUB) != null) {
log.info("Found inconsistency on container {" + container.getProperty("uuid") + "}");
container.removeProperty(WEBROOT_PUB);
log.info("Inconsistency fixed");
}
}
}
示例10: getUserAuthentication
import com.tinkerpop.blueprints.Vertex; //導入方法依賴的package包/類
@Override
public UserSecurity getUserAuthentication( String id ) throws UserNotFoundException {
Graph graph = (Graph) connection.get();
logger.debug("getUserAuthentication: " + id );
try {
Vertex v = graph.getVertex( id );
if( v == null ) throw new UserNotFoundException( id );
Object oEmail = v.getProperty( GremlinDAOSpec.USER_PROPERTY_EMAIL );
Object oPassword = v.getProperty( GremlinDAOSpec.USER_PROPERTY_PASSWORD );
Object oToken = v.getProperty( GremlinDAOSpec.USER_PROPERTY_TOKEN );
Object oRole = v.getProperty( GremlinDAOSpec.USER_PROPERTY_ROLE );
String email = null;
String password = null;
String token = null;
String role = null;
if( oEmail != null )
email = oEmail.toString();
if( oPassword != null )
password = oPassword.toString();
if( oToken != null )
token = oToken.toString();
if( oRole != null )
role = oRole.toString();
UserSecurity user = new UserSecurity( email, password, token, role );
return user;
}
finally {
graph.shutdown();
}
}
示例11: updateUuids
import com.tinkerpop.blueprints.Vertex; //導入方法依賴的package包/類
/**
* We currently can't specify the uuid during element creation. Thus we need to update it afterwards.
*/
private void updateUuids() {
try (Tx tx = db.tx()) {
for (Vertex v : tx.getGraph().getVertices()) {
String uuid = v.getProperty("uuid");
String mapping = uuidMapping.get(uuid);
if (mapping != null) {
v.setProperty("uuid", mapping);
uuidMapping.remove(mapping);
}
}
tx.success();
}
}
示例12: findBinary
import com.tinkerpop.blueprints.Vertex; //導入方法依賴的package包/類
private Vertex findBinary(String hash, Vertex binaryRoot) {
for (Vertex binary : binaryRoot.getVertices(OUT, "HAS_BINARY")) {
String foundHash = binary.getProperty(NEW_HASH_KEY);
if (foundHash.equals(hash)) {
return binary;
}
}
return null;
}
示例13: updateLists
import com.tinkerpop.blueprints.Vertex; //導入方法依賴的package包/類
private void updateLists(Vertex container, Map<String, JsonObject> fieldMap) {
for (Vertex listElement: container.getVertices(Direction.OUT, HAS_LIST)) {
String fieldName = listElement.getProperty(FIELD_KEY);
if (fieldMap.containsKey(fieldName) && NUMBER_TYPE.equals(fieldMap.get(fieldName).getString(FIELD_LIST_TYPE_KEY))) {
listElement.getPropertyKeys().stream()
.filter(k -> k.startsWith(ITEM_PREFIX))
.forEach(k -> updateProperty(k, listElement));
}
}
}
示例14: migrateNode
import com.tinkerpop.blueprints.Vertex; //導入方法依賴的package包/類
private void migrateNode(Vertex node) {
// Extract and remove the published flag from the node
String publishFlag = node.getProperty("published");
node.removeProperty("published");
// Set the published flag to all node graph field containers
Iterable<Vertex> containers = node.getVertices(Direction.OUT, "HAS_FIELD_CONTAINER");
for (Vertex container : containers) {
if (publishFlag != null) {
container.setProperty("published", publishFlag);
}
}
log.info("Migrated node {" + node.getProperty("uuid") + "}");
}
示例15: fixName
import com.tinkerpop.blueprints.Vertex; //導入方法依賴的package包/類
private void fixName(Vertex schemaVertex) {
String name = schemaVertex.getProperty("name");
if (!isEmpty(name)) {
name = name.replaceAll("-", "_");
schemaVertex.setProperty("name", name);
}
}