本文整理了Java中com.hp.hpl.jena.graph.Triple
类的一些代码示例,展示了Triple
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Triple
类的具体详情如下:
包路径:com.hp.hpl.jena.graph.Triple
类名称:Triple
[英]Triples are the basis for RDF statements; they have a subject, predicate, and object field (all nodes) and express the notion that the relationship named by the predicate holds between the subject and the object.
[中]三元组是RDF语句的基础;它们有一个主语、谓语和宾语字段(所有节点),并表示由谓语命名的关系在主语和宾语之间保持的概念。
代码示例来源:origin: com.hp.hpl.jena/arq
/** Check a triple - assumes individual nodes are legal */
public boolean check(Triple triple, long line, long col)
{
return checkTriple(triple.getSubject(), triple.getPredicate(), triple.getObject(), line, col) ;
}
代码示例来源:origin: paulhoule/infovore
@Override
public Triple economize(Triple that) {
return new Triple(
e(that.getSubject()),
e(that.getPredicate()),
e(that.getObject())
);
}
代码示例来源:origin: epimorphics/elda
private Triple rename(Triple t) {
Node S = t.getSubject(), P = t.getPredicate(), O = t.getObject();
Node newS = rename(S), newP = rename(P), newO = rename(O);
if (newS == S && newP == P && newO == O) return t;
return Triple.create(newS, newP, newO);
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-core
/**
Answer true iff this triple can be compared for sameValueAs by .equals(),
ie, it is a concrete triple with a non-literal object.
*/
protected final boolean isSafeForEquality( Triple t )
{ return t.isConcrete() && !t.getObject().isLiteral(); }
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-core
@Override
public boolean accept(Triple t) {
if (t.getSubject().isLiteral()) return true;
if (t.getPredicate().isBlank() || t.getPredicate().isLiteral()) return true;
return false;
}
} ) );
代码示例来源:origin: com.github.ansell.pellet/pellet-query
private Node getObject(Node subj, Node pred) {
for( final Iterator<Triple> i = triples.iterator(); i.hasNext(); ) {
Triple t = i.next();
if( subj.equals( t.getSubject() ) && pred.equals( t.getPredicate() ) ) {
i.remove();
return t.getObject();
}
}
return null;
}
代码示例来源:origin: DeFacto/DeFacto
/**
* Defacto config and example data loading.
*/
@PostConstruct
protected void init() {
for (final FactBenchExample example : FactBenchExamplesLoader.loadExamples()) {
examples.put(new JSONObject().put("fact", example.getFact())
.put("s", example.getTriple().getSubject().getURI())
.put("p", example.getTriple().getPredicate().getURI())
.put("o", example.getTriple().getObject().getURI()));
}
}
代码示例来源:origin: Quetzal-RDF/quetzal
protected Set<String> getAllVariables(Triple t) {
Set<String> ret = new HashSet<String>();
Node s = t.getSubject();
Node o = t.getObject();
if (s.isVariable()) {
ret.add(s.getName());
}
if (o.isVariable()) {
ret.add(o.getName());
}
return ret;
}
代码示例来源:origin: epimorphics/elda
public static long hashTriple(Triple t) {
long result = 0;
Node S = t.getSubject(), P = t.getPredicate(), O = t.getObject();
if (!S.isBlank()) result = (long) S.hashCode() << 32;
if (!P.isBlank()) result ^= (long) P.hashCode() << 16;
if (!O.isBlank()) result ^= (long) O.hashCode();
return result;
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq
@Override
protected void check(Triple t)
{
if ( Var.isVar(getGraph()) )
throw new QueryParseException("Variables not permitted in data quad", -1, -1) ;
if ( Var.isVar(t.getSubject()) || Var.isVar(t.getPredicate()) || Var.isVar(t.getObject()))
throw new QueryParseException("Variables not permitted in data quad", -1, -1) ;
if ( t.getSubject().isLiteral() )
throw new QueryParseException("Literals not allowed as subjects in data", -1, -1) ;
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-core
@Override
public boolean accept( Triple t) {
if (t.getSubject().isLiteral()) return true;
Node n = t.getObject();
return n.isLiteral() && n.getLiteralDatatype() == FunctorDatatype.theFunctorDatatype;
}
};
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq
private static boolean isMagicProperty(PropertyFunctionRegistry registry, Triple pfTriple)
{
if ( ! pfTriple.getPredicate().isURI() )
return false ;
if ( registry.manages(pfTriple.getPredicate().getURI()) )
return true ;
return false ;
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-core
/**
* Validate a triple add to see if it should reinvoke the hook. If so
* then the inference will be restarted at next prepare time. Incremental
* re-processing is not yet supported but in this case would be useful.
*/
@Override
public boolean needsRerun(FBRuleInfGraph infGraph, Triple t) {
return (t.getPredicate().getURI().startsWith(memberPrefix));
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-core
@Override
public boolean accept(Triple triple)
{
return triple.getPredicate().equals(subject) ||
triple.getPredicate().equals(predicate) ||
triple.getPredicate().equals(object) ||
( triple.getPredicate().equals(rdfType) && triple.getObject().equals(statement) ) ;
}} ;
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-core
/**
* Return the triple pattern as a triple
*/
public Triple asTriple() {
return new Triple(subject,predicate, object);
}
代码示例来源:origin: com.github.ansell.pellet/pellet-query
private boolean hasObject(Node subj, Node pred) {
for( final Iterator<Triple> i = triples.iterator(); i.hasNext(); ) {
Triple t = i.next();
if( subj.equals( t.getSubject() ) && pred.equals( t.getPredicate() ) )
return true;
}
return false;
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-core
protected static boolean equalsObjectOK( Triple t )
{
Node o = t.getObject();
return o.isLiteral() ? o.getLiteralDatatype() == null : true;
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-core
/**
* Validate a triple add to see if it should reinvoke the hook. If so
* then the inference will be restarted at next prepare time. Incremental
* re-processing is not yet supported.
*/
@Override
public boolean needsRerun(FBRuleInfGraph infGraph, Triple t) {
return (t.getPredicate().equals(OWL.intersectionOf.asNode()));
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-core
@Override
public Triple asTriple() {
return Triple.create( subject.asNode(), predicate.asNode(), object.asNode() );
}
代码示例来源:origin: net.sourceforge.owlapi/pellet-jena-ignazio1977
public boolean entails(Triple pattern) {
prepare();
if( isSyntaxTriple( pattern ) ) {
return true;
}
if( isBnodeTypeQuery( pattern ) ) {
return !containsTriple( Triple.create( pattern.getObject(), RDFS.subClassOf.asNode(), OWL.Nothing.asNode() ) );
}
else {
return containsTriple( pattern );
}
}
内容来源于网络,如有侵权,请联系作者删除!