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


Java Graph.find方法代码示例

本文整理汇总了Java中com.hp.hpl.jena.graph.Graph.find方法的典型用法代码示例。如果您正苦于以下问题:Java Graph.find方法的具体用法?Java Graph.find怎么用?Java Graph.find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.hp.hpl.jena.graph.Graph的用法示例。


在下文中一共展示了Graph.find方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getRelatedSubjects

import com.hp.hpl.jena.graph.Graph; //导入方法依赖的package包/类
@Override
protected HashSet<Node> getRelatedSubjects(Node node, ExecutionContext execCxt) {
	HashSet<Node> results = new HashSet<Node>();

	Graph graph = execCxt.getActiveGraph();

	Node clazz = NodeFactory.createURI(Namespace.IFC2X3_TC1 + "IfcBuildingStorey");
	LinkedList<Storey> storeys = new LinkedList<Storey>();
	if (graph.contains(node, RDF.type.asNode(), clazz)) {
		Storey storey = new Storey(node, elevation(node, graph));
		ExtendedIterator<Triple> triples = graph.find(null, RDF.type.asNode(), clazz);
		while (triples.hasNext()) {
			Node subject = triples.next().getSubject();
			Storey s = new Storey(subject, elevation(subject, graph));
			if (s.elevation > storey.elevation) {
				addStorey(storeys, s, graph);
			}
		}
		if (storeys.size() > 0) {
			results.add(storeys.get(0).storey);
		}
	}
	return results;
}
 
开发者ID:BenzclyZhang,项目名称:BimSPARQL,代码行数:25,代码来源:HasLowerStoreyPF.java

示例2: getRelatedObjects

import com.hp.hpl.jena.graph.Graph; //导入方法依赖的package包/类
@Override
protected HashSet<Node> getRelatedObjects(Node node, ExecutionContext execCxt) {
	HashSet<Node> results = new HashSet<Node>();

	Graph graph = execCxt.getActiveGraph();

	Node clazz = NodeFactory.createURI(Namespace.IFC2X3_TC1 + "IfcBuildingStorey");
	LinkedList<Storey> storeys = new LinkedList<Storey>();
	if (graph.contains(node, RDF.type.asNode(), clazz)) {
		Storey storey = new Storey(node, elevation(node, graph));
		ExtendedIterator<Triple> triples = graph.find(null, RDF.type.asNode(), clazz);
		while (triples.hasNext()) {
			Node subject = triples.next().getSubject();
			Storey s = new Storey(subject, elevation(subject, graph));
			if (s.elevation < storey.elevation) {
				addStorey(storeys, s, graph);
			}
		}
		if (storeys.size() > 0) {
			results.add(storeys.get(storeys.size() - 1).storey);
		}
	}
	return results;

}
 
开发者ID:BenzclyZhang,项目名称:BimSPARQL,代码行数:26,代码来源:HasLowerStoreyPF.java

示例3: getRelatedObjects

import com.hp.hpl.jena.graph.Graph; //导入方法依赖的package包/类
@Override
protected HashSet<Node> getRelatedObjects(Node node, ExecutionContext execCxt) {
	HashSet<Node> results = new HashSet<Node>();

	Graph graph = execCxt.getActiveGraph();

	Node clazz = NodeFactory.createURI(Namespace.IFC2X3_TC1 + "IfcBuildingStorey");
	LinkedList<Storey> storeys = new LinkedList<Storey>();
	if (graph.contains(node, RDF.type.asNode(), clazz)) {
		Storey storey = new Storey(node, elevation(node, graph));
		if (storey.elevation == Double.NaN) {
			return results;
		}
		ExtendedIterator<Triple> triples = graph.find(null, RDF.type.asNode(), clazz);
		while (triples.hasNext()) {
			Node subject = triples.next().getSubject();
			Storey s = new Storey(subject, elevation(subject, graph));
			if (s.elevation != Double.NaN) {
				if (s.elevation > storey.elevation) {
					addStorey(storeys, s, graph);
				}
			}
		}
		if (storeys.size() > 0) {
			results.add(storeys.get(0).storey);
		}
	}
	return results;
}
 
开发者ID:BenzclyZhang,项目名称:BimSPARQL,代码行数:30,代码来源:HasUpperStoreyPF.java

示例4: getRelatedSubjects

import com.hp.hpl.jena.graph.Graph; //导入方法依赖的package包/类
@Override
protected HashSet<Node> getRelatedSubjects(Node node, ExecutionContext execCxt) {
	HashSet<Node> results = new HashSet<Node>();

	Graph graph = execCxt.getActiveGraph();

	Node clazz = NodeFactory.createURI(Namespace.IFC2X3_TC1 + "IfcBuildingStorey");
	LinkedList<Storey> storeys = new LinkedList<Storey>();
	if (graph.contains(node, RDF.type.asNode(), clazz)) {
		Storey storey = new Storey(node, elevation(node, graph));
		if (storey.elevation == Double.NaN) {
			return results;
		}
		ExtendedIterator<Triple> triples = graph.find(null, RDF.type.asNode(), clazz);
		while (triples.hasNext()) {
			Node subject = triples.next().getSubject();
			Storey s = new Storey(subject, elevation(subject, graph));
			if (s.elevation != Double.NaN) {
				if (s.elevation < storey.elevation) {
					addStorey(storeys, s, graph);
				}
			}
		}
		if (storeys.size() > 0) {
			results.add(storeys.get(storeys.size() - 1).storey);
		}
	}
	return results;

}
 
开发者ID:BenzclyZhang,项目名称:BimSPARQL,代码行数:31,代码来源:HasUpperStoreyPF.java

示例5: getProcessableElements

import com.hp.hpl.jena.graph.Graph; //导入方法依赖的package包/类
private HashSet<Geometry> getProcessableElements(Graph graph){
	HashSet<Geometry> all=new HashSet<Geometry>();
	for(Node cls:ProcessableTypes){
		ExtendedIterator<Triple> it=graph.find(null, RDF.type.asNode(), cls);
		while(it.hasNext()){
			Geometry geometry=getGeometry(it.next().getSubject(),graph);
			if(geometry!=null){
				addGeometry(all,geometry);
	}
		}

	}
	return all;
}
 
开发者ID:BenzclyZhang,项目名称:BimSPARQL,代码行数:15,代码来源:IsOutsidePF.java

示例6: getInstanceOf

import com.hp.hpl.jena.graph.Graph; //导入方法依赖的package包/类
protected HashSet<Node> getInstanceOf(Node cls,Graph graph){
	HashSet<Node> nodes=new HashSet<Node>();
	ExtendedIterator<Triple> it=graph.find(null, RDF.type.asNode(), cls);
	while(it.hasNext()){
		nodes.add(it.next().getSubject());
	}
	return nodes;
}
 
开发者ID:BenzclyZhang,项目名称:BimSPARQL,代码行数:9,代码来源:IsOutsidePF.java

示例7: getAllFatherElements

import com.hp.hpl.jena.graph.Graph; //导入方法依赖的package包/类
protected HashSet<Node> getAllFatherElements(Node node, Graph graph,HashSet<Node> allElements) {
	ExtendedIterator<Triple> iterator2=graph.find(null,NodeFactory.createURI(Namespace.IFC2X3_TC1+"relatedObjects_IfcRelDecomposes") , node);
	while (iterator2.hasNext()){
		Node rel=iterator2.next().getSubject();
		ExtendedIterator<Triple> iter=graph.find(rel,NodeFactory.createURI(Namespace.IFC2X3_TC1+"relatingObject_IfcRelDecomposes"),null);
		while(iter.hasNext()){
			Node object=iter.next().getObject();
			allElements.add(object);
			allElements=getAllFatherElements(object,graph,allElements);
		}
	}
	return allElements;
}
 
开发者ID:BenzclyZhang,项目名称:BimSPARQL,代码行数:14,代码来源:IsOutsidePF.java

示例8: instanceOf

import com.hp.hpl.jena.graph.Graph; //导入方法依赖的package包/类
protected boolean instanceOf(Node node, Node clazz,Graph graph){
	ExtendedIterator<Triple> it=graph.find(node, RDF.type.asNode(), null);
	while(it.hasNext()) {
		Triple s = it.next();
			Node actualType = s.getObject();
			if(actualType.equals(clazz) || hasSuperClass(actualType, clazz,new HashSet<Node>(),graph)) {
				it.close();
				return true;
			}
	}
	return false;
}
 
开发者ID:BenzclyZhang,项目名称:BimSPARQL,代码行数:13,代码来源:IsOutsidePF.java

示例9: getOpenings

import com.hp.hpl.jena.graph.Graph; //导入方法依赖的package包/类
protected List<Geometry> getOpenings(Node product, ExecutionContext execCxt){
                 List<Geometry> openings=new ArrayList<Geometry>();
                Graph graph=execCxt.getActiveGraph();				
				ExtendedIterator<Triple> iterator2=graph.find(null,NodeFactory.createURI(Namespace.IFC2X3_TC1+"relatingBuildingElement_IfcRelVoidsElement") , product);
				while (iterator2.hasNext()){
					Node rel=iterator2.next().getSubject();
					ExtendedIterator<Triple> iter=graph.find(rel,NodeFactory.createURI(Namespace.IFC2X3_TC1+"relatedOpeningElement_IfcRelVoidsElement"),null);
					while(iter.hasNext()){
						Node object=iter.next().getObject();
						Geometry child= getGeometry(object,graph);
						openings.add(child);
}
				}
				return openings;
}
 
开发者ID:BenzclyZhang,项目名称:BimSPARQL,代码行数:16,代码来源:HasGrossWallAreaPF.java

示例10: write

import com.hp.hpl.jena.graph.Graph; //导入方法依赖的package包/类
@Override
public void write(Kryo kryo, Output output, Graph object) {
	output.writeInt(object.size());
	final Iterator<Triple> it = object.find(null, null, null);
	while (it.hasNext()) {
		final Triple next = it.next();
		kryo.writeClassAndObject(output, next);
	}
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:10,代码来源:JenaStormUtils.java

示例11: execute

import com.hp.hpl.jena.graph.Graph; //导入方法依赖的package包/类
@Override
public void execute(Tuple input) {
	ArrayList<Graph> graphList = (ArrayList<Graph>) input.getValue(0);
	ArrayList<List<Object>> tupleList = new ArrayList<List<Object>>();
	ArrayList<Object> tuple = null;
	List<Object> id = new ArrayList<Object>();
	Iterator<Triple> it = null;
	Triple triple = null;
	for (Graph g : graphList) {
		it = g.find(new Triple(null, null, null));
		tuple = new ArrayList<Object>();
		while(it.hasNext()) {
			triple = it.next();
			String s = triple.getSubject().toString();
			String p = triple.getPredicate().toString();
			String o = triple.getObject().toString();
			if (!id.isEmpty() && id.contains(p)) {
				id.add(triple.getPredicate());
			}
			tuple.add(s + " " + o);
		}
		tupleList.add(tuple);
	}
    GlobalStreamId streamId = new GlobalStreamId(input.getSourceComponent(), input.getSourceStreamId());
    if (!pending.containsKey(id)) {
    	//pending.put(id, new HashMap<GlobalStreamId, Tuple>());
    	pending.put(id, new HashMap<GlobalStreamId, ArrayList<List<Object>>>());
    }
    Map<GlobalStreamId, ArrayList<List<Object>>> parts = pending.get(id);
    if (parts.containsKey(streamId))
    	throw new RuntimeException("Received same side of single join twice");
    //parts.put(streamId, tuple);
    parts.put(streamId, tupleList);
    if (parts.size() == numSources) {
    	pending.remove(id);
    	ArrayList<Object> joinResult = new ArrayList<Object>();
    	for (String outField : outputFields) {
    		GlobalStreamId loc = fieldLocations.get(outField);
    		//joinResult.add(parts.get(loc).getValueByField(outField));
    		joinResult.add(parts.get(loc).get(id.indexOf(outField)));
    	}
    	collector.emit(joinResult);
    	collector.ack(input);
   	}
}
 
开发者ID:allaves,项目名称:storm-query-operators,代码行数:46,代码来源:RDFSimpleJoinBolt.java


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