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

x33g5p2x  于2022-01-29 转载在 其他  
字(7.6k)|赞(0)|评价(0)|浏览(111)

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

Triple.getPredicate介绍

暂无

代码示例

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

/**
 *
 * @param triples
 * @returnan {@link Iterator}<{@link IRI}> containing the predicates from
 * an {@link Iterator}<{@link Triple}>
 */
private Iterator<IRI> getUniquePredicates(final Iterator<Triple> triples) {
  final Set<IRI> resultSet = new HashSet<IRI>();
  while (triples.hasNext()) {
    resultSet.add(triples.next().getPredicate());
  }
  return resultSet.iterator();
}

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

/**
 *
 * @param triples
 * @returnan {@link Iterator}<{@link IRI}> containing the predicates from
 * an {@link Iterator}<{@link Triple}>
 */
private Iterator<IRI> getUniquePredicates(final Iterator<Triple> triples) {
  final Set<IRI> resultSet = new HashSet<IRI>();
  while (triples.hasNext()) {
    resultSet.add(triples.next().getPredicate());
  }
  return resultSet.iterator();
}

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

@Override
  public boolean matches(Triple t) {
    return 
      objectUri != null
      && t.getPredicate().equals(predicateUri)
      && t.getObject().equals(objectUri)
    ;
  }
}

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

private static Triple map(Triple triple, Map<BlankNode, BlankNode> map) {
  final BlankNodeOrIRI oSubject = triple.getSubject();
  BlankNodeOrIRI subject = oSubject instanceof BlankNode ?
    map.get((BlankNode)oSubject) : oSubject;
  RDFTerm oObject = triple.getObject();
  RDFTerm object = oObject instanceof BlankNode ?
    map.get((BlankNode)oObject) : oObject;
  return new TripleImpl(subject, triple.getPredicate(), object);
}

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

private static Set<Property> getProperties(BlankNode bNode, Graph g) {
  Set<Property> result = new HashSet<Property>();
  Iterator<Triple> ti = g.filter(bNode, null, null);
  while (ti.hasNext()) {
    Triple triple = ti.next();
    result.add(new ForwardProperty(triple.getPredicate(), triple.getObject()));
  }
  ti = g.filter(null, null, bNode);
  while (ti.hasNext()) {
    Triple triple = ti.next();
    result.add(new BackwardProperty(triple.getSubject(), triple.getPredicate()));
  }
  return result;
}
private static int nodeHash(RDFTerm resource, Map<BlankNode, Integer> bNodeHashMap) {

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

@Override
public boolean contains(Object o) {
  if (!(o instanceof Triple)) {
    return false;
  }
  Triple t = (Triple) o;
  return filter(t.getSubject(), t.getPredicate(), t.getObject()).hasNext();
}

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

private static Triple getReplacement(Triple triple, BlankNode bNode, BlankNodeOrIRI replacementNode) {
  if (triple.getSubject().equals(bNode)) {
    if (triple.getObject().equals(bNode)) {
      return new TripleImpl(replacementNode, triple.getPredicate(), replacementNode);
    } else {
      return new TripleImpl(replacementNode, triple.getPredicate(), triple.getObject());
    }
  } else {
    if (triple.getObject().equals(bNode)) {
      return new TripleImpl(triple.getSubject(), triple.getPredicate(), replacementNode);
    } else {
      return null;
    }
  }
}
private static void addInverted(Map<BlankNode, Integer> result, IntHashMap<Set<BlankNode>> hashNodeMap) {

代码示例来源:origin: org.apache.stanbol/org.apache.stanbol.ontologymanager.multiplexer.clerezza

void mapLocator(org.semanticweb.owlapi.model.IRI locator, IRI graphName) {
  if (graphName == null) throw new IllegalArgumentException("A null graph name is not allowed.");
  // Null locator is a legal argument, will remove all locator mappings from the supplied graph
  Set<Triple> remove = new HashSet<Triple>();
  for (Iterator<Triple> nodes = graph.filter(graphName, null, null); nodes.hasNext();) {
    Triple t = nodes.next();
    // isOntology |= RDF.type.equals(t.getPredicate()) && OWL.Ontology.equals(t.getObject());
    if (RETRIEVED_FROM_URIREF.equals(t.getPredicate())) remove.add(t);
  }
  graph.removeAll(remove);
  if (locator != null) {
    Literal litloc = LiteralFactory.getInstance().createTypedLiteral(
      new IRI(locator.toString()));
    graph.add(new TripleImpl(graphName, RETRIEVED_FROM_URIREF, litloc));
  }
}

代码示例来源:origin: org.apache.stanbol/org.apache.stanbol.commons.indexedgraph

@Override
  public int compare(Triple a, Triple b) {
    int c = IndexedGraph.compare(a.getObject(), b.getObject(), hashCodeConflictMap);
    if (c == 0) {
      c = IndexedGraph.compare(a.getSubject(), b.getSubject(), hashCodeConflictMap);
      if (c == 0) {
        c = IndexedGraph.compare(a.getPredicate(), b.getPredicate(), hashCodeConflictMap);
      }
    }
    return c;
  }
};

代码示例来源:origin: org.apache.stanbol/org.apache.stanbol.commons.indexedgraph

@Override
  public int compare(Triple a, Triple b) {
    int c = IndexedGraph.compare(a.getPredicate(), b.getPredicate(), hashCodeConflictMap);
    if (c == 0) {
      c = IndexedGraph.compare(a.getObject(), b.getObject(), hashCodeConflictMap);
      if (c == 0) {
        c = IndexedGraph.compare(a.getSubject(), b.getSubject(), hashCodeConflictMap);
      }
    }
    return c;
  }
};

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

@Override
  public int compare(Triple a, Triple b) {
    int c = IndexedGraph.compare(a.getObject(), b.getObject(), hashCodeConflictMap);
    if (c == 0) {
      c = IndexedGraph.compare(a.getSubject(), b.getSubject(), hashCodeConflictMap);
      if (c == 0) {
        c = IndexedGraph.compare(a.getPredicate(), b.getPredicate(), hashCodeConflictMap);
      }
    }
    return c;
  }
};

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

@Override
  public int compare(Triple a, Triple b) {
    int c = IndexedGraph.compare(a.getSubject(), b.getSubject(), hashCodeConflictMap);
    if (c == 0) {
      c = IndexedGraph.compare(a.getPredicate(), b.getPredicate(), hashCodeConflictMap);
      if (c == 0) {
        c = IndexedGraph.compare(a.getObject(), b.getObject(), hashCodeConflictMap);
      }
    }
    return c;
  }
};

代码示例来源:origin: org.apache.stanbol/org.apache.stanbol.commons.indexedgraph

@Override
  public int compare(Triple a, Triple b) {
    int c = IndexedGraph.compare(a.getSubject(), b.getSubject(), hashCodeConflictMap);
    if (c == 0) {
      c = IndexedGraph.compare(a.getPredicate(), b.getPredicate(), hashCodeConflictMap);
      if (c == 0) {
        c = IndexedGraph.compare(a.getObject(), b.getObject(), hashCodeConflictMap);
      }
    }
    return c;
  }
};

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

@Override
  public int compare(Triple a, Triple b) {
    int c = IndexedGraph.compare(a.getPredicate(), b.getPredicate(), hashCodeConflictMap);
    if (c == 0) {
      c = IndexedGraph.compare(a.getObject(), b.getObject(), hashCodeConflictMap);
      if (c == 0) {
        c = IndexedGraph.compare(a.getSubject(), b.getSubject(), hashCodeConflictMap);
      }
    }
    return c;
  }
};

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

private RDFTerm getExistingRDFTerm() {
  Triple triple = getRandomTriple();
  if (triple == null) {
    return null;
  }
  switch (rollDice(3)) {
    case 0:
      return triple.getSubject();
    case 1:
      return triple.getPredicate();
    case 2:
      return triple.getObject();
  }
  return null;
}

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

private RDFTerm getExistingRDFTerm() {
  Triple triple = getRandomTriple();
  if (triple == null) {
    return null;
  }
  switch (rollDice(3)) {
    case 0:
      return triple.getSubject();
    case 1:
      return triple.getPredicate();
    case 2:
      return triple.getObject();
  }
  return null;
}

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

private Triple toTargetTriple(Triple triple) {
  if (triple == null) {
    return null;
  }
  return new TripleImpl(toTargetRDFTerm(triple.getSubject()),
      triple.getPredicate(), toTargetRDFTerm(triple.getObject()));
}

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

private Triple toSourceTriple(Triple triple) {
  if (triple == null) {
    return null;
  }
  return new TripleImpl(toSourceRDFTerm(triple.getSubject()),
      triple.getPredicate(), toSourceRDFTerm(triple.getObject()));
}

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

private Triple toSourceTriple(Triple triple) {
  if (triple == null) {
    return null;
  }
  return new TripleImpl(toSourceRDFTerm(triple.getSubject()),
      triple.getPredicate(), toSourceRDFTerm(triple.getObject()));
}

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

private Triple toTargetTriple(Triple triple) {
  if (triple == null) {
    return null;
  }
  return new TripleImpl(toTargetRDFTerm(triple.getSubject()),
      triple.getPredicate(), toTargetRDFTerm(triple.getObject()));
}

相关文章