org.apache.clerezza.commons.rdf.Graph.filter()方法的使用及代码示例

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

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

Graph.filter介绍

暂无

代码示例

代码示例来源:origin: apache/stanbol

protected boolean chekcFallbackMode(IRI entityReference, Graph metadata) {
  return fallbackMode ? //in case we use fallback mode
      //filter entities for those an outgoing relation is present
      !metadata.filter(entityReference, null, null).hasNext() :
        true; //otherwise process all entities
}
/**

代码示例来源:origin: org.apache.stanbol/org.apache.stanbol.enhancer.servicesapi

public static void addDependend(Collection<BlankNodeOrIRI> collection, Graph executionPlan, BlankNodeOrIRI executionNode){
  for(Iterator<Triple> it = executionPlan.filter(executionNode, DEPENDS_ON, null);
      it.hasNext();collection.add((BlankNodeOrIRI)it.next().getObject()));
}
public static boolean isOptional(Graph executionPlan, BlankNodeOrIRI executionNode) {

代码示例来源:origin: org.apache.clerezza/rdf.utils

private BlankNodeOrIRI getRest(BlankNodeOrIRI list) {
  return (BlankNodeOrIRI) tc.filter(list, RDF.rest, null).next().getObject();
}

代码示例来源:origin: org.apache.clerezza/rdf.utils

private Set<IRI> getIfps(Graph tBox) {
  final Iterator<Triple> ifpDefinitions = tBox.filter(null, RDF.type,
      OWL.InverseFunctionalProperty);
  final Set<IRI> ifps = new HashSet<IRI>();
  while (ifpDefinitions.hasNext()) {
    final Triple triple = ifpDefinitions.next();
    ifps.add((IRI) triple.getSubject());
  }
  return ifps;
}

代码示例来源:origin: org.apache.stanbol/org.apache.stanbol.enhancer.engines.dereference.core

protected boolean chekcFallbackMode(IRI entityReference, Graph metadata) {
  return fallbackMode ? //in case we use fallback mode
      //filter entities for those an outgoing relation is present
      !metadata.filter(entityReference, null, null).hasNext() :
        true; //otherwise process all entities
}
/**

代码示例来源:origin: apache/clerezza

private BlankNodeOrIRI getRest(BlankNodeOrIRI list) {
  return (BlankNodeOrIRI) tc.filter(list, RDF.rest, null).next().getObject();
}

代码示例来源:origin: apache/clerezza

private Set<IRI> getIfps(Graph tBox) {
  final Iterator<Triple> ifpDefinitions = tBox.filter(null, RDF.type,
      OWL.InverseFunctionalProperty);
  final Set<IRI> ifps = new HashSet<IRI>();
  while (ifpDefinitions.hasNext()) {
    final Triple triple = ifpDefinitions.next();
    ifps.add((IRI) triple.getSubject());
  }
  return ifps;
}

代码示例来源:origin: apache/stanbol

/**
 * Internally used to check if a URI resource represents an representation
 * @param resource the resource to check
 * @return the state
 */
protected final boolean isRepresentation(IRI resource){
  return graph.filter(resource, null, null).hasNext();
}

代码示例来源:origin: org.apache.clerezza/rdf.core

private void removeList(BlankNodeOrIRI list, Graph permissionMGraph) {
  try {
    Triple t = permissionMGraph.filter(list, rest, null).next();
    RDFTerm restList = t.getObject();
    removeList((BlankNodeOrIRI) restList, permissionMGraph);
    permissionMGraph.remove(t);
    Iterator<Triple> iter = permissionMGraph.filter(list, first, null);
    iter.next();
    iter.remove();
  } catch (NoSuchElementException e) {
    //if it has no rest its rdf:NIL and has no first
  }
}

代码示例来源:origin: org.apache.stanbol/org.apache.stanbol.enhancer.rdfentities

@Override
public int size() {
  Iterator<Triple> results = factory.getGraph().filter(rdfNode, property, null);
  int size = 0;
  for (;results.hasNext();size++){
    results.next();
  }
  return size;
}
public boolean add(T value) {

代码示例来源:origin: org.apache.clerezza/templating.seedsnipe

/** if value id an rdf:list in tc, initialize list
 * @param tc
 */
private void doListInitialization(Graph tc) {
  if (value instanceof BlankNodeOrIRI) {        
    if ((tc.filter((BlankNodeOrIRI) value, RDF.rest, null).hasNext())
        || (tc.filter((BlankNodeOrIRI) value, OWL.sameAs, RDF_NIL).hasNext())) {
      list = new RdfList((BlankNodeOrIRI) value, tc);
    }
  }
}

代码示例来源:origin: apache/clerezza

private void removeList(BlankNodeOrIRI list, Graph permissionMGraph) {
  try {
    Triple t = permissionMGraph.filter(list, rest, null).next();
    RDFTerm restList = t.getObject();
    removeList((BlankNodeOrIRI) restList, permissionMGraph);
    permissionMGraph.remove(t);
    Iterator<Triple> iter = permissionMGraph.filter(list, first, null);
    iter.next();
    iter.remove();
  } catch (NoSuchElementException e) {
    //if it has no rest its rdf:NIL and has no first
  }
}

代码示例来源:origin: apache/stanbol

@Override
public int size() {
  Iterator<Triple> results = factory.getGraph().filter(rdfNode, property, null);
  int size = 0;
  for (;results.hasNext();size++){
    results.next();
  }
  return size;
}
public boolean add(T value) {

代码示例来源:origin: apache/stanbol

@Override
  public boolean isEmpty() {
    return !factory.getGraph().filter(rdfNode, property, null).hasNext();
  }
}

代码示例来源:origin: org.apache.clerezza/rdf.core

private void readList(BlankNodeOrIRI list, Graph permissionMGraph, LinkedList<String> target) {
  if (list.equals(rdfNil)) {
    return;
  }
  Triple restTriple = permissionMGraph.filter(list, rest, null).next();
  BlankNodeOrIRI restList = (BlankNodeOrIRI) restTriple.getObject();
  readList(restList, permissionMGraph, target);
  Triple firstTriple = permissionMGraph.filter(list, first, null).next();
  Literal firstValue = (Literal) firstTriple.getObject();
  String value = LiteralFactory.getInstance().createObject(String.class, firstValue);
  target.addFirst(value);
}

代码示例来源:origin: apache/stanbol

public static void addDependend(Collection<BlankNodeOrIRI> collection, Graph executionPlan, BlankNodeOrIRI executionNode){
  for(Iterator<Triple> it = executionPlan.filter(executionNode, DEPENDS_ON, null);
      it.hasNext();collection.add((BlankNodeOrIRI)it.next().getObject()));
}
public static boolean isOptional(Graph executionPlan, BlankNodeOrIRI executionNode) {

代码示例来源:origin: org.apache.stanbol/org.apache.stanbol.enhancer.rdfentities

@Override
  public boolean isEmpty() {
    return !factory.getGraph().filter(rdfNode, property, null).hasNext();
  }
}

代码示例来源:origin: apache/clerezza

private void readList(BlankNodeOrIRI list, Graph permissionMGraph, LinkedList<String> target) {
  if (list.equals(rdfNil)) {
    return;
  }
  Triple restTriple = permissionMGraph.filter(list, rest, null).next();
  BlankNodeOrIRI restList = (BlankNodeOrIRI) restTriple.getObject();
  readList(restList, permissionMGraph, target);
  Triple firstTriple = permissionMGraph.filter(list, first, null).next();
  Literal firstValue = (Literal) firstTriple.getObject();
  String value = LiteralFactory.getInstance().createObject(String.class, firstValue);
  target.addFirst(value);
}

代码示例来源:origin: org.apache.stanbol/org.apache.stanbol.enhancer.servicesapi

/**
 * Getter for the ChainExecution used to enhance the content item
 * @param em the graph with the execution metadata
 * @param ciUri the ID of the content item
 * @return the node that {@link ExecutionMetadata#ENHANCES} the {@link ContentItem}
 */
public static BlankNodeOrIRI getChainExecution(Graph em, IRI ciUri){
  Iterator<Triple> it = em.filter(null, ENHANCES, ciUri);
  if(it.hasNext()){
    return it.next().getSubject();
  } else {
    return null;
  }
}
/**

代码示例来源:origin: org.apache.clerezza/rdf.jena.tdb.storage

/**
 * Checks whether the given graph name already exists as the specified resource (either graph or mgraph).
 * @param graphName the graph name
 * @param graphType the resource type
 * @return true if a resource with the given name and type already exists, false otherwise.
 */
private boolean isExistingGraphName(IRI graphName, IRI graphType) {
  return graphNameIndex.getGraph().filter(graphName, RDF.type, graphType).hasNext();
}

相关文章