当前位置: 首页>>代码示例>>Java>>正文


Java TripleMatch类代码示例

本文整理汇总了Java中com.hp.hpl.jena.graph.TripleMatch的典型用法代码示例。如果您正苦于以下问题:Java TripleMatch类的具体用法?Java TripleMatch怎么用?Java TripleMatch使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TripleMatch类属于com.hp.hpl.jena.graph包,在下文中一共展示了TripleMatch类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: graphBaseFind

import com.hp.hpl.jena.graph.TripleMatch; //导入依赖的package包/类
@Override
protected ExtendedIterator<Triple> graphBaseFind(TripleMatch tm)
{
    try
    {
        // this is very odd behavior -- clean up a bit
        return context.find(
                tm.getMatchSubject() != null ? tm.getMatchSubject() : ((Triple)tm).getSubject(),
                tm.getMatchPredicate() != null ? tm.getMatchPredicate() : ((Triple)tm).getPredicate(),
                tm.getMatchObject() != null ? tm.getMatchObject() : ((Triple)tm).getObject());
    }
    catch (IOException e)
    {
        log.error("", e);
        throw new QueryException(e);
    }
}
 
开发者ID:daedafusion,项目名称:knowledge,代码行数:18,代码来源:JenaAdapter.java

示例2: graphBaseFind

import com.hp.hpl.jena.graph.TripleMatch; //导入依赖的package包/类
@Override
protected ExtendedIterator<Triple> graphBaseFind(final TripleMatch pattern) {
	try {
		final byte [][] identifiers = 
			(name == null)
				? dictionary.asIdentifiers(
						pattern.getMatchSubject(), 
						pattern.getMatchPredicate(), 
						pattern.getMatchObject())
				: dictionary.asIdentifiers(
						pattern.getMatchSubject(), 
						pattern.getMatchPredicate(), 
						pattern.getMatchObject(), 
						name);		
		return WrappedIterator.createNoRemove(dictionary.asTripleIterator(query(identifiers)));
	} catch (StorageLayerException exception) {
		LOGGER.error(MessageCatalog._00010_DATA_ACCESS_LAYER_FAILURE, exception);
		return EMPTY_TRIPLES_ITERATOR;
	}
}
 
开发者ID:spaziocodice,项目名称:jena-nosql,代码行数:21,代码来源:NoSqlGraph.java

示例3: graphBaseFind

import com.hp.hpl.jena.graph.TripleMatch; //导入依赖的package包/类
/**
 * Overloaded to reuse and update the cache.
 */
@Override
public ExtendedIterator<Triple> graphBaseFind(TripleMatch m) {
	List<Triple> cached = queryCache.get(m);
	if (cached != null) {
           return WrappedIterator.create(cached.iterator());
	}
	ExtendedIterator<Triple> it = super.graphBaseFind(m);
	final List<Triple> list = it.toList();
	queryCache.put(m, list);
	return WrappedIterator.create(list.iterator());
}
 
开发者ID:d2rq,项目名称:r2rml-kit,代码行数:15,代码来源:CachingGraphD2RQ.java

示例4: graphBaseFind

import com.hp.hpl.jena.graph.TripleMatch; //导入依赖的package包/类
@Override
public ExtendedIterator<Triple> graphBaseFind(TripleMatch m) {
	checkOpen();
	Triple t = m.asTriple();
	if (log.isDebugEnabled()) {
		log.debug("Find: " + PrettyPrinter.toString(t, getPrefixMapping()));
	}
	FindQuery query = new FindQuery(t, mapping.getTripleRelations(), 
			new ExecutionContext(mapping.getContext(), this, null, null));
	ExtendedIterator<Triple> result = TripleQueryIter.create(query.iterator());
	result = result.andThen(mapping.getAdditionalTriples().find(t));
	return result;
   }
 
开发者ID:d2rq,项目名称:r2rml-kit,代码行数:14,代码来源:GraphD2RQ.java

示例5: graphBaseFind

import com.hp.hpl.jena.graph.TripleMatch; //导入依赖的package包/类
@Override
public ExtendedIterator<Triple> graphBaseFind(TripleMatch m) {
	checkOpen();
	Triple t = m.asTriple();
	if (log.isDebugEnabled()) {
		log.debug("Find: " + PrettyPrinter.toString(t, getPrefixMapping()));
	}
	FindQuery query = new FindQuery(t, mapping.compiledPropertyBridges(), null);
	ExtendedIterator<Triple> result = TripleQueryIter.create(query.iterator());
	if (mapping.configuration().getServeVocabulary()) {
		result = result.andThen(mapping.getVocabularyModel().getGraph().find(t));
	}
	return result;
   }
 
开发者ID:aitoralmeida,项目名称:c4a_data_repository,代码行数:15,代码来源:GraphD2RQ.java

示例6: graphBaseFind

import com.hp.hpl.jena.graph.TripleMatch; //导入依赖的package包/类
@Override
public ExtendedIterator<Triple> graphBaseFind(final TripleMatch pattern) {
	try  {
		return WrappedIterator.createNoRemove(dao.query(pattern));
	} catch (StorageLayerException exception) {
		LOGGER.error(MessageCatalog._00010_DATA_ACCESS_LAYER_FAILURE, exception);
		return EMPTY_TRIPLES_ITERATOR;
	}
}
 
开发者ID:spaziocodice,项目名称:jena-nosql,代码行数:10,代码来源:SolrGraph.java

示例7: graphBaseFind

import com.hp.hpl.jena.graph.TripleMatch; //导入依赖的package包/类
@Override
protected ExtendedIterator graphBaseFind(TripleMatch m) {
  int length = 0;
  Node s = m.getMatchSubject();
  Node p = m.getMatchPredicate();
  Node o = m.getMatchObject();

  if (s == null || s.equals(Node.ANY)) {
    s = Node.createVariable("s");
    length++;
  }
  if (p == null || p.equals(Node.ANY)) {
    p = Node.createVariable("p");
    length++;
  }
  if (o == null || o.equals(Node.ANY)) {
    o = Node.createVariable("o");
    length++;
  }

  // Check not already a variable.
      
  Node[] variables = new Node[length];
  int i = 0;
      
  if (s.isVariable()) variables[i++] = s;  
  if (p.isVariable()) variables[i++] = p;
  if (o.isVariable()) variables[i++] = o;
      
  Triple t = new Triple(s,p,o) ;
  com.hp.hpl.jena.graph.query.Query graphQuery = new com.hp.hpl.jena.graph.query.Query();
  graphQuery.addMatch(t);
  BindingQueryPlan plan = queryHandler().prepareBindings(graphQuery, variables);
  ExtendedIterator iter = plan.executeBindings(); // Of domains
  return new AnswerBindingIterator(iter, variables, t);
}
 
开发者ID:quoll,项目名称:mulgara,代码行数:37,代码来源:GraphMulgara.java

示例8: newPattern

import com.hp.hpl.jena.graph.TripleMatch; //导入依赖的package包/类
/**
 * @param  match       the Jena triple matcher
 * @return an RDF::Pattern instance
 */
public RubyObject newPattern(TripleMatch match) {
  return newTriple(
    newValue(match.getMatchSubject()),
    newValue(match.getMatchPredicate()),
    newValue(match.getMatchObject())
  );
}
 
开发者ID:ruby-rdf,项目名称:rdf-arq,代码行数:12,代码来源:Factory.java

示例9: removeEldestEntry

import com.hp.hpl.jena.graph.TripleMatch; //导入依赖的package包/类
@Override
protected boolean removeEldestEntry(Map.Entry<TripleMatch,List<Triple>> eldest) {
    return size() > MAX_ENTRIES;
}
 
开发者ID:d2rq,项目名称:r2rml-kit,代码行数:5,代码来源:CachingGraphD2RQ.java

示例10: graphBaseFind

import com.hp.hpl.jena.graph.TripleMatch; //导入依赖的package包/类
@Override
	protected ExtendedIterator<Triple> graphBaseFind(TripleMatch m) {
		
		Node s = m.getMatchSubject() ;
		Var sVar = null ;
		if ( s == null )
		{
			sVar = Var.alloc("s") ;
			s = sVar ;
		}
		
		Node p = m.getMatchPredicate() ;
		Var pVar = null ;
		if ( p == null )
		{
			pVar = Var.alloc("p") ;
			p = pVar ;
		}
		
		Node o = m.getMatchObject() ;
		Var oVar = null ;
		if ( o == null )
		{
			oVar = Var.alloc("o") ;
			o = oVar ;
		}
		
		Triple triple = new Triple(s, p ,o) ;
		
		BasicPattern pattern = new BasicPattern() ;
		pattern.add(triple) ;
		ElementTriplesBlock element = new ElementTriplesBlock(pattern);
		Query query = new Query();
		query.setQuerySelectType(); 
		query.setQueryResultStar(true);
		query.setQueryPattern(element);
//		query.setDistinct(true);
		
		boolean resNotEmpty = true;
		query.setLimit(tripleSliceSize);
		long offsetCounter = 0;
		Set<Triple> triples = new HashSet<Triple>() ;
		while (resNotEmpty) {
			long offset = tripleSliceSize * offsetCounter++;
			query.setOffset(offset);
			QueryExecution qe = QueryExecutionFactory.sparqlService(serviceURI, query);
			logger.debug(query.serialize());
	
			ResultSet res = qe.execSelect();
			if (!res.hasNext()) resNotEmpty = false;
			
			while(res.hasNext()) {
				QuerySolution sol = res.nextSolution();
				Node subj;
				if (s.isVariable()) {
					subj = sol.get("s").asNode();
				} else {
					subj= s;
				}
				
				Node pred;
				if (p.isVariable()) {
					pred = sol.get("p").asNode();
				} else {
					pred = p;
				}
				
				Node obj;
				if (o.isVariable()) {
					obj = sol.get("o").asNode();
				} else {
					obj = o;
				}
				Triple resTriple = new Triple(subj, pred, obj);
				
				triples.add(resTriple);
			}
			qe.close();
		}
		return WrappedIterator.createNoRemove(triples.iterator()) ;
	}
 
开发者ID:SmartDataAnalytics,项目名称:R2RLint,代码行数:82,代码来源:SparqlGraph.java

示例11: find

import com.hp.hpl.jena.graph.TripleMatch; //导入依赖的package包/类
/**
 * Find the given triple(s) from the graph. 
 */
@Override
public ExtendedIterator<Triple> find(TripleMatch triple) {
	return find(triple.getMatchSubject(),triple.getMatchPredicate(), triple.getMatchObject());
}
 
开发者ID:semr,项目名称:neo4jena,代码行数:8,代码来源:NeoGraph.java

示例12: find

import com.hp.hpl.jena.graph.TripleMatch; //导入依赖的package包/类
@Override
public ExtendedIterator<Triple> find(TripleMatch arg0) {
	// TODO Auto-generated method stub
	return null;
}
 
开发者ID:semr,项目名称:neo4jena,代码行数:6,代码来源:Neo4j.java

示例13: getGraphDAO

import com.hp.hpl.jena.graph.TripleMatch; //导入依赖的package包/类
@Override
public GraphDAO<Triple, TripleMatch> getGraphDAO(final Node name) {
	return new SolrGraphDAO(indexer, searcher, name, addCommitWithinMsecs, deleteCommitWithinMsecs);
}
 
开发者ID:spaziocodice,项目名称:jena-nosql,代码行数:5,代码来源:SolrStorageLayerFactory.java

示例14: RDFSimpleJoinBolt

import com.hp.hpl.jena.graph.TripleMatch; //导入依赖的package包/类
public RDFSimpleJoinBolt(String joinAttribute, TripleMatch attr, Fields outputFields) {
		this.outputFields = outputFields;
		this.joinAttribute = joinAttribute;
//		this.left = new ArrayList<Graph>();
//		this.right = new ArrayList<Graph>();
	}
 
开发者ID:allaves,项目名称:storm-query-operators,代码行数:7,代码来源:RDFSimpleJoinBolt.java

示例15: and

import com.hp.hpl.jena.graph.TripleMatch; //导入依赖的package包/类
/** 
    Answer an ExtendedIterator returning all the triples from this store that
    match the pattern <code>m = (S, P, O)</code>.
    
    <p>Because the node-to-triples maps index on each of subject, predicate,
    and (non-literal) object, concrete S/P/O patterns can immediately select
    an appropriate map. Because the match for literals must be by sameValueAs,
    not equality, the optimisation is not applied for literals. [This is probably a
    Bad Thing for strings.]
    
    <p>Practice suggests doing the predicate test <i>last</i>, because there are
    "usually" many more statements than predicates, so the predicate doesn't
    cut down the search space very much. By "practice suggests" I mean that
    when the order went, accidentally, from S/O/P to S/P/O, performance on
    (ANY, P, O) searches on largish models with few predicates declined
    dramatically - specifically on the not-galen.owl ontology.
*/
public ExtendedIterator<Triple> find( TripleMatch tm )
    {
    Triple t = tm.asTriple();
    Node pm = t.getPredicate();
    Node om = t.getObject();
    Node sm = t.getSubject();
        
    if (sm.isConcrete())
        return new StoreTripleIterator( parent, subjects.iterator( sm, pm, om ), subjects, predicates, objects );
    else if (om.isConcrete())
        return new StoreTripleIterator( parent, objects.iterator( om, sm, pm ), objects, subjects, predicates );
    else if (pm.isConcrete())
        return new StoreTripleIterator( parent, predicates.iterator( pm, om, sm ), predicates, subjects, objects );
    else
        return new StoreTripleIterator( parent, subjects.iterateAll(), subjects, predicates, objects );
    }
 
开发者ID:jacekkopecky,项目名称:parkjam,代码行数:34,代码来源:GraphTripleStoreBase.java


注:本文中的com.hp.hpl.jena.graph.TripleMatch类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。