本文整理了Java中org.apache.jena.graph.Triple.getMatchSubject()
方法的一些代码示例,展示了Triple.getMatchSubject()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Triple.getMatchSubject()
方法的具体详情如下:
包路径:org.apache.jena.graph.Triple
类名称:Triple
方法名:getMatchSubject
[英]Return subject or null, not Node.ANY
[中]返回subject或null,而不是Node。任何
代码示例来源:origin: org.apache.jena/jena-csv
public Node getMatchSubject(){
return pattern.get(0).getMatchSubject();
}
代码示例来源:origin: apache/jena
@Override
protected ExtendedIterator<Triple> graphBaseFind(Triple m) {
if ( m == null ) m = Triple.ANY ;
Node s = m.getMatchSubject() ;
Node p = m.getMatchPredicate() ;
Node o = m.getMatchObject() ;
return graphBaseFind(s, p, o) ;
}
代码示例来源:origin: apache/jena
@Override
public ExtendedIterator<Triple> find( Triple triple ) {
return find(triple.getMatchSubject(), triple.getMatchPredicate(), triple.getMatchObject());
}
代码示例来源:origin: ch.epfl.bluebrain.nexus.org.topbraid/shacl
@Override
public ExtendedIterator<Triple> find(Triple m) {
return find(m.getMatchSubject(), m.getMatchPredicate(), m.getMatchObject());
}
代码示例来源:origin: apache/jena
/**
* Returns an iterator over Triples.
*
* <p>This code used to have the .filterKeep component uncommented. We
* think this is because of earlier history, before .matches on a literal node
* was implemented as sameValueAs rather than equals. If it turns out that
* the filter is needed, it can be commented back in, AND a corresponding
* filter added to find(Node x 3) -- and test cases, of course.
*/
@Override
protected ExtendedIterator<Triple> graphBaseFind(Triple triple) {
return graphBaseFind(triple.getMatchSubject(), triple.getMatchPredicate(), triple.getMatchObject())
// .filterKeep(new TripleMatchFilter(m.asTriple()))
;
}
代码示例来源:origin: org.apache.jena/jena-core
@Override
public ExtendedIterator<Triple> find( Triple triple ) {
return find(triple.getMatchSubject(), triple.getMatchPredicate(), triple.getMatchObject());
}
代码示例来源:origin: org.apache.jena/jena-core
/**
* Returns an iterator over Triples.
*
* <p>This code used to have the .filterKeep component uncommented. We
* think this is because of earlier history, before .matches on a literal node
* was implemented as sameValueAs rather than equals. If it turns out that
* the filter is needed, it can be commented back in, AND a corresponding
* filter added to find(Node x 3) -- and test cases, of course.
*/
@Override
protected ExtendedIterator<Triple> graphBaseFind(Triple triple) {
return graphBaseFind(triple.getMatchSubject(), triple.getMatchPredicate(), triple.getMatchObject())
// .filterKeep(new TripleMatchFilter(m.asTriple()))
;
}
代码示例来源:origin: TopQuadrant/shacl
@Override
public ExtendedIterator<Triple> find(Triple m) {
return find(m.getMatchSubject(), m.getMatchPredicate(), m.getMatchObject());
}
代码示例来源:origin: rdfhdt/hdt-java
public TripleID getTriplePatID(Triple jenaTriple) {
int subject=0, predicate=0, object=0;
if(jenaTriple.getMatchSubject()!=null) {
subject = getIntID(jenaTriple.getMatchSubject(), TripleComponentRole.SUBJECT);
}
if(jenaTriple.getMatchPredicate()!=null) {
predicate = getIntID(jenaTriple.getMatchPredicate(), TripleComponentRole.PREDICATE);
}
if(jenaTriple.getMatchObject()!=null) {
object = getIntID(jenaTriple.getMatchObject(), TripleComponentRole.OBJECT);
}
return new TripleID(subject, predicate, object);
}
代码示例来源:origin: apache/jena
@Override
protected ExtendedIterator<Triple> graphBaseFind(Triple m) {
List<Triple> results = new ArrayList<>();
for ( Triple t : triples )
if ( t.matches(m.getMatchSubject(), m.getMatchPredicate(), m.getMatchObject()) )
results.add(t);
return WrappedIterator.create(results.iterator());
}
}
代码示例来源:origin: apache/jena
@Override
protected ExtendedIterator<Triple> graphBaseFind(Triple m) {
List<Triple> results = new ArrayList<>();
Iterator<Quad> iter = findNG(graphName, m.getMatchSubject(), m.getMatchPredicate(), m.getMatchObject());
for ( ; iter.hasNext() ; )
results.add(iter.next().asTriple());
return WrappedIterator.create(results.iterator());
}
}
代码示例来源:origin: ch.epfl.bluebrain.nexus.org.topbraid/shacl
if(t.getMatchSubject().isVariable()) {
results.add(t.getMatchSubject().getName());
代码示例来源:origin: TopQuadrant/shacl
if(t.getMatchSubject().isVariable()) {
results.add(t.getMatchSubject().getName());
代码示例来源:origin: apache/jena
protected static ExtendedIterator<Triple> graphBaseFindNG(DatasetGraphTDB dataset, Node graphNode, Triple m) {
Node gn = graphNode ;
// Explicitly named union graph.
if ( isUnionGraph(gn) )
gn = Node.ANY ;
Iterator<Quad> iter = dataset.getQuadTable().find(gn, m.getMatchSubject(), m.getMatchPredicate(), m.getMatchObject()) ;
if ( iter == null )
return org.apache.jena.util.iterator.NullIterator.instance() ;
Iterator<Triple> iterTriples = projectQuadsToTriples((gn == Node.ANY ? null : gn), iter) ;
if ( gn == Node.ANY )
iterTriples = Iter.distinct(iterTriples) ;
return WrappedIterator.createNoRemove(iterTriples) ;
}
代码示例来源:origin: franzinc/agraph-java-client
public ExtendedIterator<Triple> findExposed(Triple m) {
if (matchesReification(m)) {
if (m.getMatchPredicate() != null) {
return graph.graphBaseFind(m);
} else {
//String queryString = "construct {?s ?p ?o} where { {?s ?p ?o . FILTER (?p IN (rdf:subject, rdf:predicate, rdf:object)) } UNION {?s rdf:type rdf:Statement} }";
String queryString = "construct {?s ?p ?o} where { {?s ?p ?o . FILTER (?p = rdf:subject || ?p = rdf:predicate || ?p = rdf:object)} UNION {?s ?p ?o . FILTER (?p = rdf:type && ?o = rdf:Statement)} }";
AGRepositoryConnection conn = graph.getConnection();
AGValueFactory vf = conn.getValueFactory();
AGGraphQuery gq = conn.prepareGraphQuery(QueryLanguage.SPARQL, queryString);
GraphQueryResult result;
try {
if (m.getMatchSubject() != null) {
gq.setBinding("s", vf.asValue(m.getMatchSubject()));
}
if (m.getMatchObject() != null) {
gq.setBinding("o", vf.asValue(m.getMatchObject()));
}
gq.setDataset(graph.getDataset());
result = gq.evaluate();
return new AGTripleIteratorGQ(graph, result);
} catch (QueryEvaluationException e) {
throw new RuntimeException(e);
}
}
} else {
return NullIterator.instance();
}
}
代码示例来源:origin: franzinc/agraph-java-client
@Override
protected ExtendedIterator<Triple> graphBaseFind(Triple m) {
RepositoryResult<Statement> result;
try {
// TODO: allow arbitrary values in subject and predicate positions?
Node s = m.getMatchSubject();
Node p = m.getMatchPredicate();
Node o = m.getMatchObject();
// quickly return no results if RDF constraints for subject and predicate
// are violated, as occurs in the Jena test suite for Graph.
if ((s != null && s.isLiteral())
|| (p != null && (p.isLiteral() || p.isBlank()))) {
result = conn.createRepositoryResult(new ArrayList<Statement>());
} else {
StatementCollector collector = new StatementCollector();
conn.prepareHttpRepoClient().getStatements(
vf.asResource(s), vf.asURI(p), vf.asValue(o),
entailmentRegime, collector, contexts);
result = conn.createRepositoryResult(collector.getStatements());
}
} catch (AGHttpException | RDFHandlerException e) {
throw new RuntimeException(e);
}
return new AGTripleIterator(this, result);
}
代码示例来源:origin: apache/jena
@Override
protected ExtendedIterator<Triple> graphBaseFind(Triple m)
Node s = m.getMatchSubject() ;
Var sVar = null ;
if ( s == null )
代码示例来源:origin: org.apache.jena/jena-csv
Node s = triple.getMatchSubject();
Node p = triple.getMatchPredicate();
Node o = triple.getMatchObject();
代码示例来源:origin: apache/jena
assertEquals(a, it3.next().getMatchSubject());
代码示例来源:origin: org.apache.jena/jena-core
assertEquals(a, it3.next().getMatchSubject());
内容来源于网络,如有侵权,请联系作者删除!