本文整理汇总了Java中com.hp.hpl.jena.util.iterator.Map1Iterator类的典型用法代码示例。如果您正苦于以下问题:Java Map1Iterator类的具体用法?Java Map1Iterator怎么用?Java Map1Iterator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Map1Iterator类属于com.hp.hpl.jena.util.iterator包,在下文中一共展示了Map1Iterator类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: prepareBindings
import com.hp.hpl.jena.util.iterator.Map1Iterator; //导入依赖的package包/类
public BindingQueryPlan prepareBindings(GraphQuery q, Node[] variables) {
this.variables = variables;
this.indexes = new HashMap<Node,Integer>();
for (int i = 0; i < variables.length; i++) {
indexes.put(variables[i], new Integer(i));
}
BasicPattern pattern = new BasicPattern();
for (Triple t: q.getPattern()) {
pattern.add(t);
}
Plan plan = QueryEngineD2RQ.getFactory().create(new OpBGP(pattern), dataset, null, null);
final ExtendedIterator<Domain> queryIterator = new Map1Iterator<Binding,Domain>(new BindingToDomain(), plan.iterator());
return new BindingQueryPlan() {
public ExtendedIterator<Domain> executeBindings() {
return queryIterator;
}
};
}
示例2: prepareBindings
import com.hp.hpl.jena.util.iterator.Map1Iterator; //导入依赖的package包/类
public BindingQueryPlan prepareBindings(Query q, Node[] variables) {
this.variables = variables;
this.indexes = new HashMap<Node,Integer>();
for (int i = 0; i < variables.length; i++) {
indexes.put(variables[i], new Integer(i));
}
BasicPattern pattern = new BasicPattern();
for (Triple t: q.getPattern()) {
pattern.add(t);
}
Plan plan = QueryEngineD2RQ.getFactory().create(new OpBGP(pattern), dataset, null, null);
final ExtendedIterator<Domain> queryIterator = new Map1Iterator<Binding,Domain>(new BindingToDomain(), plan.iterator());
return new BindingQueryPlan() {
public ExtendedIterator<Domain> executeBindings() {
return queryIterator;
}
};
}
示例3: iterator
import com.hp.hpl.jena.util.iterator.Map1Iterator; //导入依赖的package包/类
/**
* An Iterator over the pairs of the Relation.
* Each pair is returned as a java.util.Map.Entry.
* The first element is accessed through <code>getKey()</code>,
* the second through <code>getValue()</code>.
*@see java.util.Map.Entry
*/
public Iterator<PairEntry<T, T>> iterator()
{
// Map<T, Set<T>> => Map.Entry<T, Set<T>> via "rows.entrySet()"
// Map.Entry<T, Set<T>> => Iterator<PairEntry<T, T>>
// Iterator<PairEntry<T, T>> ==> Iterator<PairEntry<T, T>> via IteratorIterator
// Convert Map.Entry<T, Set<T>> to Iterator<PairEntry<T, T>>
// applied to an entrySet.
Map1<Map.Entry<T, Set<T>>, Iterator<PairEntry<T, T>>> m1 =
new Map1<Map.Entry<T, Set<T>>, Iterator<PairEntry<T, T>>>(){
public Iterator<PairEntry<T, T>> map1(Entry<T, Set<T>> entry)
{
return pairEntry(entry) ;
}} ;
Map1Iterator<Map.Entry<T, Set<T>>,Iterator<PairEntry<T, T>>> iter1 =
new Map1Iterator<Map.Entry<T, Set<T>>,Iterator<PairEntry<T, T>>>(m1 , rows.entrySet().iterator()) ;
// And now flatten it.
Iterator<PairEntry<T, T>> iter2 = new IteratorIterator<PairEntry<T, T>>(iter1) ;
return iter2 ;
}
示例4: prepareBindings
import com.hp.hpl.jena.util.iterator.Map1Iterator; //导入依赖的package包/类
/**
* <p>Method that prepares the bindings for a query plan</p>
* @param q - the input query
* @param variables - the variables in the given query
* @return a binding query plan
*
* @see de.fuberlin.wiwiss.d2rq.D2RQQueryHandler#prepareBindings(Query, Node[])
*/
@SuppressWarnings("unchecked")
public BindingQueryPlan prepareBindings(Query q, Node[] variables)
{
this.variables = variables;
this.indexes = new HashMap();
for (int i = 0; i < variables.length; i++) { indexes.put(variables[i], new Integer(i)); }
BasicPattern pattern = new BasicPattern();
Iterator it = q.getPattern().iterator();
while (it.hasNext())
{
Triple t = (Triple) it.next();
pattern.add(t);
}
Plan plan = QueryEngineD2RQ.getFactory().create(new OpBGP(pattern), dataset, null, null);
final ExtendedIterator queryIterator = new Map1Iterator(new BindingToDomain(), plan.iterator());
return new BindingQueryPlan()
{
public ExtendedIterator executeBindings() { return queryIterator; }
};
}
示例5: pairEntry
import com.hp.hpl.jena.util.iterator.Map1Iterator; //导入依赖的package包/类
private static <T> Iterator<PairEntry<T, T>> pairEntry(Map.Entry<T, Set<T>> pair)
{
final T a = pair.getKey() ;
Set<T> bs = pair.getValue() ;
return new Map1Iterator<T, PairEntry<T, T>>(inner(a), bs.iterator()) ;
}