org.vertexium.Element类的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(10.5k)|赞(0)|评价(0)|浏览(334)

本文整理了Java中org.vertexium.Element类的一些代码示例,展示了Element类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element类的具体详情如下:
包路径:org.vertexium.Element
类名称:Element

Element介绍

[英]An element on the graph. This can be either a vertex or edge.

Elements also contain properties. These properties are unique given their key, name, and visibility. For example a property with key "key1" and name "age" could have to values, one with visibility "a" and one with visibility "b".
[中]图形上的一个元素。这可以是顶点或边。
元素还包含属性。鉴于这些属性的键、名称和可见性,它们是唯一的。例如,键为“key1”且名称为“age”的属性可能必须具有多个值,一个具有可见性“a”,另一个具有可见性“b”。

代码示例

代码示例来源:origin: org.vertexium/vertexium-cypher

@Override
public String toString() {
  return "{" +
      "name='" + name + '\'' +
      ", " + (element instanceof Vertex ? "vertex" : "edge") + "Id=" + (element == null ? null : element.getId()) +
      '}';
}

代码示例来源:origin: org.vertexium/vertexium-core

@Override
public ExistingElementMutation<T> softDeleteProperties(String key, String name) {
  for (Property prop : this.element.getProperties(key, name)) {
    softDeleteProperty(prop);
  }
  return this;
}

代码示例来源:origin: org.vertexium/vertexium-core

public ExistingElementMutationImpl(T element) {
  this.element = element;
  if (element != null) {
    this.oldElementVisibility = element.getVisibility();
  }
}

代码示例来源:origin: org.vertexium/vertexium-core

/**
 * Permanently deletes all properties with the given name that you have access to. Only properties which you have
 * access to will be deleted.
 *
 * @param name The name of the property to delete.
 */
default void deleteProperties(String name, Authorizations authorizations) {
  for (Property p : getProperties(name)) {
    deleteProperty(p.getKey(), p.getName(), p.getVisibility(), authorizations);
  }
}

代码示例来源:origin: visallo/vertexium

protected void deleteAllExtendedDataForElement(Element element, Authorizations authorizations) {
  if (!element.getFetchHints().isIncludeExtendedDataTableNames() || element.getExtendedDataTableNames().size() <= 0) {
    return;
  }
  for (ExtendedDataRow row : getExtendedData(ElementType.getTypeFromElement(element), element.getId(), null, authorizations)) {
    deleteExtendedDataRow(row.getId(), authorizations);
  }
}

代码示例来源:origin: org.vertexium/vertexium-core

/**
 * Soft deletes all properties with the given name that you have access to. Only properties which you have
 * access to will be soft deleted.
 *
 * @param name The name of the property to delete.
 */
default void softDeleteProperties(String name, Authorizations authorizations) {
  for (Property property : getProperties(name)) {
    softDeleteProperty(property.getKey(), property.getName(), property.getVisibility(), authorizations);
  }
}

代码示例来源:origin: org.vertexium/vertexium-core

for (Element element : elements) {
  if (i % 1000000 == 0) {
    LOGGER.debug("checking: %s", element.getId());
  for (Property property : element.getProperties()) {
    visitor.visitProperty(element, property);
  for (String tableName : element.getExtendedDataTableNames()) {
    for (ExtendedDataRow extendedDataRow : element.getExtendedData(tableName)) {
      visitor.visitExtendedDataRow(element, tableName, extendedDataRow);
      for (Property property : extendedDataRow.getProperties()) {

代码示例来源:origin: org.visallo/visallo-core

long beforeActionTimestamp = System.currentTimeMillis() - 1;
if (action == ClientApiPublishItem.Action.DELETE) {
  element.softDeleteProperty(key, name, authorizations);
  graph.flush();
  workQueueRepository.pushPublishedPropertyDeletion(element, key, name, beforeActionTimestamp, Priority.HIGH);
  return;
ExistingElementMutation elementMutation = element.prepareMutation();
List<Property> properties = IterableUtils.toList(element.getProperties(key, name));
SandboxStatus[] sandboxStatuses = SandboxStatusUtil.getPropertySandboxStatuses(properties, workspaceId);
boolean foundProperty = false;
      element.softDeleteProperty(key, name, new Visibility(workspaceId), authorizations);
      graph.flush();
      workQueueRepository.pushPublishedPropertyDeletion(
    element.softDeleteProperty(key, name, propertyVisibility, authorizations);
    workQueueRepository.pushPublishedPropertyDeletion(
        element,
    );
    if (publicProperty != null) {
      element.markPropertyVisible(publicProperty, new Visibility(workspaceId), authorizations);
        element.softDeleteProperty(key, name, publicVisibility, authorizations);
      } else {
        newVisibility = publicVisibility;
      element.addPropertyValue(key, name, property.getValue(), metadata, newVisibility, authorizations);

代码示例来源:origin: org.visallo/visallo-core

public static JSONObject toJsonElement(Element element, String workspaceId) {
  JSONObject json = new JSONObject();
  json.put("id", element.getId());
  json.put("properties", toJsonProperties(element.getProperties(), workspaceId));
  json.put("sandboxStatus", SandboxStatusUtil.getSandboxStatus(element, workspaceId).toString());
  VisibilityJson visibilityJson = VisalloProperties.VISIBILITY_JSON.getPropertyValue(element);
  if (visibilityJson != null) {
    json.put("visibilitySource", visibilityJson.getSource());
  }
  return json;
}

代码示例来源:origin: org.visallo/visallo-core

private static void populateClientApiElement(
    ClientApiElement clientApiElement,
    org.vertexium.Element element,
    String workspaceId
) {
  clientApiElement.setId(element.getId());
  clientApiElement.getProperties().addAll(toClientApiProperties(element.getProperties(), workspaceId));
  clientApiElement.getExtendedDataTableNames().addAll(element.getExtendedDataTableNames());
  clientApiElement.setSandboxStatus(SandboxStatusUtil.getSandboxStatus(element, workspaceId));
  VisibilityJson visibilityJson = VisalloProperties.VISIBILITY_JSON.getPropertyValue(element);
  if (visibilityJson != null) {
    clientApiElement.setVisibilitySource(visibilityJson.getSource());
  }
  if (clientApiElement instanceof ClientApiVertex) {
    ClientApiVertex clientApiVertex = (ClientApiVertex) clientApiElement;
    String conceptType = VisalloProperties.CONCEPT_TYPE.getPropertyValue(element, null);
    clientApiVertex.setConceptType(conceptType);
  }
}

代码示例来源:origin: org.vertexium/vertexium-core

@Override
protected boolean isMatch(Element element) {
  for (String authorization : authorizations) {
    if (element.getVisibility().hasAuthorization(authorization)) {
      return true;
    }
    boolean hiddenVisibilityMatches = StreamUtils.stream(element.getHiddenVisibilities())
        .anyMatch(visibility -> visibility.hasAuthorization(authorization));
    if (hiddenVisibilityMatches) {
      return true;
    }
    boolean propertyMatches = StreamUtils.stream(element.getProperties())
        .anyMatch(property -> {
          if (property.getVisibility().hasAuthorization(authorization)) {
            return true;
          }
          return StreamUtils.stream(property.getHiddenVisibilities())
              .anyMatch(visibility -> visibility.hasAuthorization(authorization));
        });
    if (propertyMatches) {
      return true;
    }
  }
  return false;
}

代码示例来源:origin: org.vertexium/vertexium-elasticsearch5

MUTATION_LOGGER.trace("updateElement: %s", element.getId());
if (flushObjectQueue.containsElementId(element.getId())) {
  flushObjectQueue.flush();
  addActionRequestBuilderForFlush(element, updateRequestBuilder);
  if (mutation.getNewElementVisibility() != null && element.getFetchHints().isIncludeExtendedDataTableNames()) {
    ImmutableSet<String> extendedDataTableNames = element.getExtendedDataTableNames();
    if (extendedDataTableNames != null && !extendedDataTableNames.isEmpty()) {
      extendedDataTableNames.forEach(tableName ->
              graph,
              element,
              element.getExtendedData(tableName),
              mutation.getOldElementVisibility(),
              mutation.getNewElementVisibility()

代码示例来源:origin: org.visallo/visallo-core

Property property = getProperty(element, propertyKey, propertyName, oldVisibilitySource, workspaceId);
if (property == null) {
  throw new VisalloResourceNotFoundException("Could not find property " + propertyKey + ":" + propertyName + " on element " + element.getId());
    "%s Altering property visibility %s [%s:%s] from [%s] to [%s]",
    user.getUserId(),
    element.getId(),
    propertyKey,
    propertyName,
);
ExistingElementMutation<T> m = element.<T>prepareMutation()
    .alterPropertyVisibility(property, newVisibility);
VisalloProperties.VISIBILITY_JSON_METADATA.setMetadata(m, property, newVisibilityJson, defaultVisibility);
T newElement = m.save(authorizations);
Property newProperty = newElement.getProperty(propertyKey, propertyName, newVisibility);
checkNotNull(
    newProperty,
    "Could not find altered property " + propertyKey + ":" + propertyName + " on element " + element.getId()
);

代码示例来源:origin: org.visallo/visallo-core

Property oldProperty = element.getProperty(propertyKey, propertyName, oldPropertyVisibility);
boolean isUpdate = oldProperty != null;
propertyMetadata = VertexiumMetadataUtil.mergeMetadata(propertyMetadata, metadata);
ExistingElementMutation<T> elementMutation = element.prepareMutation();
  termMentionRepository.addSourceInfo(
      element,
      element.getId(),
      TermMentionFor.PROPERTY,
      propertyKey,
Property publicProperty = element.getProperty(propertyKey, propertyName);
  long beforeDeletionTimestamp = System.currentTimeMillis() - 1;
  element.markPropertyHidden(publicProperty, new Visibility(workspaceId), authorizations);
  graph.flush();
  workQueueRepository.pushGraphPropertyQueueHiddenOrDeleted(element, publicProperty, ElementOrPropertyStatus.HIDDEN, beforeDeletionTimestamp, workspaceId, Priority.HIGH);

代码示例来源:origin: org.vertexium/vertexium-cypher

ExistingElementMutation<Element> m = element.prepareMutation();
  for (Property property : element.getProperties()) {
    if (ctx.isLabelProperty(property)) {
      continue;

代码示例来源:origin: org.visallo/visallo-core

/**
 * Similar to {@link GraphUpdateContext#update(Element, Update)} but calls
 * {@link ElementUpdateContext#updateBuiltInProperties(Date, VisibilityJson)} and
 * {@link ElementUpdateContext#setConceptType(String)} before calling
 * updateFn.
 */
public <T extends Element> UpdateFuture<T> update(
    T element,
    Date modifiedDate,
    VisibilityJson visibilityJson,
    String conceptType,
    Update<T> updateFn
) {
  checkNotNull(element, "element cannot be null");
  return update(element.prepareMutation(), modifiedDate, visibilityJson, conceptType, updateFn);
}

代码示例来源:origin: org.vertexium/vertexium-elasticsearch

visibilityStrings.add(element.getVisibility().getVisibilityString());
for (Property property : element.getProperties()) {
  visibilityStrings.add(property.getVisibility().getVisibilityString());

代码示例来源:origin: org.vertexium/vertexium-core

/**
 * Permanently deletes a property given it's key and name from the element. Only properties which you have access
 * to can be deleted using this method.
 *
 * @param key  The property key.
 * @param name The property name.
 */
default void deleteProperty(String key, String name, Authorizations authorizations) {
  deleteProperty(key, name, null, authorizations);
}

代码示例来源:origin: visallo/vertexium

@Override
  protected Iterable<? extends ExtendedDataRow> getIterable(Element element) {
    return new SelectManyIterable<String, ExtendedDataRow>(element.getExtendedDataTableNames()) {
      @Override
      protected Iterable<? extends ExtendedDataRow> getIterable(String tableName) {
        return element.getExtendedData(tableName);
      }
    };
  }
};

代码示例来源:origin: visallo/vertexium

public Iterable<ExtendedDataRow> getRows() {
  return getElement().getExtendedData(tableName);
}

相关文章