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


Java Graph类代码示例

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


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

示例1: getProduct

import com.hp.hpl.jena.graph.Graph; //导入依赖的package包/类
public static Product getProduct(Node subject,Graph graph,HashMap<Node,Product> hashmap){
	Product product=hashmap.get(subject);
	if (product!=null){
		return product;
	}
	else{
		product=new Product();
		ExtendedIterator<Node> compositions=GraphUtil.listSubjects(graph,RELATING_OBJECT,subject);
		if(compositions.hasNext()){
			ExtendedIterator<Node> childIterator=GraphUtil.listObjects(graph,compositions.next(),RELATED_OBJECTS);
			while (childIterator.hasNext()){
				Node childNode=childIterator.next();
				Product child=hashmap.get(childNode);
				if (child!=null){
					product.getTriangles().addAll(child.getTriangles());
				}
				else{
					child=getProduct(childNode,graph,hashmap);
					product.getTriangles().addAll(child.getTriangles());
				}
			}
		}
		return product;
		}			
}
 
开发者ID:BenzclyZhang,项目名称:BimSPARQL,代码行数:26,代码来源:ProductUtil.java

示例2: 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

示例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));
		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

示例4: addStorey

import com.hp.hpl.jena.graph.Graph; //导入依赖的package包/类
protected void addStorey(LinkedList<Storey> storeys, Storey s, Graph graph) {

		int i = 0;
		if (storeys.size() == 0) {
			storeys.add(s);
			return;
		} else {
			for (i = 0; i < storeys.size(); i++) {
				if (i < storeys.size() - 1) {
					if (storeys.get(i).elevation < s.elevation && storeys.get(i + 1).elevation > s.elevation) {
						break;
					}
				} else {
					if (storeys.get(i).elevation < s.elevation) {
						storeys.add(s);
						return;
					}else if(storeys.get(i).elevation>s.elevation){
						storeys.add(i,s);
						return;
					}
				}

			}
			storeys.add(i + 1, s);
		}
	}
 
开发者ID:BenzclyZhang,项目名称:BimSPARQL,代码行数:27,代码来源:HasUpperStoreyPF.java

示例5: verifyValue

import com.hp.hpl.jena.graph.Graph; //导入依赖的package包/类
@Override
protected QueryIterator verifyValue(Binding binding, Graph graph, Node product, Geometry geometry, Node object,
		ExecutionContext execCxt) {
	boolean b = false;
	try {
		if (product.getLocalName().equals("IfcWallStandardCase_5397")){
			System.out.println("");
		}
		HashSet<Geometry> allGeometries=getProcessableElements(graph);
		b = new ExternalQuadTreeImpl(geometry, allGeometries).getIsExternal();
	} catch (Exception e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	Node node = NodeFactory.createLiteral(Boolean.toString(b), null, XSDDatatype.XSDboolean);
	if (node.equals(object)) {
		return IterLib.result(binding, execCxt);
	} else {
		return IterLib.noResults(execCxt);
	}
}
 
开发者ID:BenzclyZhang,项目名称:BimSPARQL,代码行数:22,代码来源:IsOutsidePF.java

示例6: execEvaluated

import com.hp.hpl.jena.graph.Graph; //导入依赖的package包/类
public QueryIterator execEvaluated(Binding binding, Node product,
		 Node predicate, Node object,
		ExecutionContext execCxt) {
	Graph graph = execCxt.getActiveGraph();
	Geometry geometry=getGeometry(product,graph);
	if(geometry==null){
		return IterLib.noResults(execCxt);
	}
	if (Var.isVar(product))
		throw new ARQInternalErrorException(
				this.getClass().getName()+": Subject are variables without binding");
	if (Var.isVar(object))
		return getValue(binding, graph, product,geometry,
				Var.alloc(object), execCxt);
	else
		return verifyValue(binding, graph, product,geometry,object,
				execCxt);

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

示例7: verifyValue

import com.hp.hpl.jena.graph.Graph; //导入依赖的package包/类
@Override
protected QueryIterator verifyValue(Binding binding, Graph graph, Node product, Geometry geometry, Node object,
		ExecutionContext execCxt) {
	String obj;
	try{
	obj=(String)object.getLiteralValue();
	}catch (Exception e){
		return IterLib.noResults(execCxt);
	}
	String b=computeValue(geometry);
	if(b==null){
		return IterLib.noResults(execCxt);
	}
	if(b.equals(obj)){
		return IterLib.result(binding, execCxt);
	}
	return IterLib.noResults(execCxt);
}
 
开发者ID:BenzclyZhang,项目名称:BimSPARQL,代码行数:19,代码来源:FunctionBaseProductEwktValue.java

示例8: execEvaluated

import com.hp.hpl.jena.graph.Graph; //导入依赖的package包/类
public QueryIterator execEvaluated(Binding binding, Node product,
		 Node predicate, Node object,
		ExecutionContext execCxt) {
	Graph graph = execCxt.getActiveGraph();
	Geometry geometry=getGeometry(product,graph);
	if (Var.isVar(product))
		throw new ARQInternalErrorException(
				this.getClass().getName()+": Subject are variables without binding");
	if (Var.isVar(object))
		return getValue(binding, graph, product,geometry,
				Var.alloc(object), execCxt);
	else
		return verifyValue(binding, graph, product,geometry,object,
				execCxt);

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

示例9: verify

import com.hp.hpl.jena.graph.Graph; //导入依赖的package包/类
protected QueryIterator verify(Binding binding, Graph queryGraph, Node matchSubject, Node predicate,
		Node matchObject, ExecutionContext execCxt) {
	Geometry s=getGeometry(matchSubject, execCxt.getActiveGraph());
	Geometry o=getGeometry(matchObject, execCxt.getActiveGraph());
	try {
		if(evaluateSpatialRelation(s,o)){
			return IterLib.result(binding, execCxt);
		}
		else{
			return IterLib.noResults(execCxt);
		}
	} catch (GeometryException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}return IterLib.noResults(execCxt);
}
 
开发者ID:BenzclyZhang,项目名称:BimSPARQL,代码行数:17,代码来源:FunctionBaseSpatialRelation.java

示例10: writeRecords

import com.hp.hpl.jena.graph.Graph; //导入依赖的package包/类
/**
 * Uses the graph that was created to add the triple and either merges or adds based on the 
 * availability of the graph node
 * @param rdfTriple
 * @param graph
 */
private void writeRecords(Triple rdfTriple, Graph graph) {
	// Add triple to the graph
	graph.add(rdfTriple);
    if (dsg.containsGraph(graphNode))
    {
    	logger.debug("Yes, we have this graphNode in MarkLogic");
    	logger.debug("Triple [" + rdfTriple.toString() + "]");
    	dsg.mergeGraph(graphNode, graph);
    }
    else
    {   
    	logger.debug("Store the graph in MarkLogic.");
    	dsg.addGraph(graphNode, graph);
    }
}
 
开发者ID:marklogic-community,项目名称:marklogic-spring-batch,代码行数:22,代码来源:RdfTripleItemWriter.java

示例11: registerSerializers

import com.hp.hpl.jena.graph.Graph; //导入依赖的package包/类
/**
 * @param conf
 *            register some Jena serialisers to this configuration
 */
public static void registerSerializers(Config conf) {
	conf.registerSerialization(Node[].class, NodeSerialiser_ARRAY.class);
	conf.registerSerialization(Node_URI.class, NodeSerialiser_URI.class);
	conf.registerSerialization(Node_Literal.class, NodeSerialiser_Literal.class);
	conf.registerSerialization(Node_Blank.class, NodeSerialiser_Blank.class);
	conf.registerSerialization(Node_Variable.class, NodeSerialiser_Variable.class);
	conf.registerSerialization(Triple.class, TripleSerialiser.class);
	conf.registerSerialization(ArrayList.class);
	conf.registerSerialization(KestrelServerSpec.class, KestrelServerSpec_Serializer.class);
	conf.registerSerialization(Rule.class, RuleSerializer.class);
	conf.registerSerialization(Graph.class, GraphSerialiser.class);
	conf.registerSerialization(GraphMem.class, GraphSerialiser.class);
	conf.registerSerialization(MultiUnion.class, GraphSerialiser.class);
	conf.registerSerialization(Template.class, TemplateSerialiser.class);
	conf.registerSerialization(ElementFilter.class);
	// conf.registerSerialization(Node_NULL.class);
	// conf.registerSerialization(Node_Blank.class);
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:23,代码来源:JenaStormUtils.java

示例12: InferrayInfGraph

import com.hp.hpl.jena.graph.Graph; //导入依赖的package包/类
public InferrayInfGraph(final Graph data, final InferrayReasoner reasoner,
		final SupportedProfile profile) {
	super(data, reasoner);
	if (LOGGER.isTraceEnabled()) {
		LOGGER.trace("Building Infgraph");
	}
	fdata = new FGraph(data);
	this.profile = profile;
	final ConfigurationBuilder builder = new ConfigurationBuilder();
	final PropertyConfiguration config = builder.setDumpFileOnExit(false)
			.setForceQuickSort(false).setMultithread(true)
			.setThreadpoolSize(8).setAxiomaticTriplesDirectory("/tmp/")
			.setFastClosure(true).setExportTriples(true)
			.setSortingAlgorithm(SortingAlgorithm.HYBRID_IMD)
			.setRulesProfile(profile).setDumpFileOnExit(false).build();
	inferray = new Inferray(config);
	this.binder = new JenaBinder(inferray, inferray.getRulesprofile(), this);
	this.modified = new HashSet<>();
	graphListener = new InferrayGraphListener(data, inferray, binder);
	previousVersion = version;
	this.fdeductions = new FGraph(Factory.createDefaultGraph());
}
 
开发者ID:jsubercaze,项目名称:inferray,代码行数:23,代码来源:InferrayInfGraph.java

示例13: wireTopology

import com.hp.hpl.jena.graph.Graph; //导入依赖的package包/类
private void wireTopology() {
	String fileName = "data/Earthquakes-Spain-2013.ttl";
	//String rdfSpout = "rdfStreamSpout";
	//String fixedBatchSpout = "fixedBatchSpout";
	//String triple2graph = "triple2graph";
	
	builder.setSpout("rdfSpout1", new RDFStreamSpout(fileName));
	//builder.setSpout("rdfSpout2", new RDFStreamSpout(fileName));
	builder.setBolt("triple2graph1", new Triple2GraphBolt(STARTING_PATTERN_ID)).globalGrouping("rdfSpout1");
	//builder.setBolt("triple2graph2", new Triple2GraphBolt(STARTING_PATTERN_ID)).shuffleGrouping("rdfSpout2");
	//builder.setBolt("graphCounter1", new RollingWindowBolt<Graph>(15, 3)).fieldsGrouping("triple2graph1", new Fields("name"));
	
	builder.setBolt("graphCounter1", new RollingWindowBolt<Graph>(30, 15)).globalGrouping("triple2graph1");
	//builder.setBolt("graphCounter2", new RollingCountBolt(15, 3)).fieldsGrouping("triple2graph2", new Fields("name"));
	//builder.setBolt("bgpBolt", new OpBGPBolt("obs", triplesPattern)).shuffleGrouping("graphCounter1");
	
	//builder.setBolt("bgpBolt", new OpBGPBolt(new Fields("obs", "value", "timestamp", "geometry"), triplesPattern)).globalGrouping("graphCounter1");
	builder.setBolt("bgpBolt", new OpBGPBolt(new Fields("obs"), triplesPattern)).globalGrouping("graphCounter1");
	//builder.setBolt("acker", new AckerPrinterBolt()).globalGrouping("graphCounter1").globalGrouping("graphCounter2");
	
	builder.setBolt("acker", new AckerPrinterBolt()).globalGrouping("bgpBolt");
}
 
开发者ID:allaves,项目名称:storm-query-operators,代码行数:23,代码来源:OpBGPTopology.java

示例14: setUp

import com.hp.hpl.jena.graph.Graph; //导入依赖的package包/类
@Before
public void setUp() throws FedoraException {
    initMocks(this);

    objectWithChildren = new FedoraObjectImpl(mockRepository, mockHelper, objectPath);
    objectWithoutChildren = new FedoraObjectImpl(mockRepository, mockHelper, objectWithoutChildrenPath);
    objectChild = new FedoraObjectImpl(mockRepository, mockHelper, objectChildPath);
    customChild = new FedoraObjectImpl(mockRepository, mockHelper, customChildPath);
    datastreamChild = new FedoraDatastreamImpl(mockRepository, mockHelper, datastreamChildPath);

    final Graph graph = createDefaultGraph();
    graph.add( create(objectSubj, CONTAINS.asNode(), datastreamChildSubj) );
    graph.add( create(objectSubj, CONTAINS.asNode(), objectChildSubj) );
    graph.add( create(objectSubj, CONTAINS.asNode(), customChildSubj) );
    graph.add( create(datastreamChildSubj, HAS_MIXIN_TYPE.asNode(), createLiteral(BINARY)) );
    graph.add( create(objectChildSubj, HAS_MIXIN_TYPE.asNode(), createLiteral(CONTAINER)) );
    graph.add( create(customChildSubj, HAS_MIXIN_TYPE.asNode(), createLiteral(CUSTOM)) );
    objectWithChildren.setGraph( graph );
    objectWithoutChildren.setGraph( createDefaultGraph() );

    when(mockRepository.getRepositoryUrl()).thenReturn(repositoryURL);
    when(mockRepository.getObject(eq(objectPath))).thenReturn(objectWithChildren);
    when(mockRepository.getObject(eq(objectChildPath))).thenReturn(objectChild);
    when(mockRepository.getObject(eq(customChildPath))).thenReturn(customChild);
    when(mockRepository.getDatastream(eq(datastreamChildPath))).thenReturn(datastreamChild);
}
 
开发者ID:fcrepo4-labs,项目名称:fcrepo4-client,代码行数:27,代码来源:FedoraObjectImplTest.java

示例15: setUp

import com.hp.hpl.jena.graph.Graph; //导入依赖的package包/类
@Before
public void setUp() throws IOException {
    initMocks(this);
    when(mockRepository.getRepositoryUrl()).thenReturn(repositoryURL);
    resource = new FedoraResourceImpl(mockRepository, mockHelper, path);
    assertTrue(resource != null);

    final Graph graph = createDefaultGraph();
    graph.add( create(createURI(repositoryURL + "/test"), RdfLexicon.CREATED_DATE.asNode(),
                      ResourceFactory.createPlainLiteral(testDateValue).asNode()) );
    graph.add( create(createURI(repositoryURL + "/test"), RdfLexicon.LAST_MODIFIED_DATE.asNode(),
                      ResourceFactory.createPlainLiteral(testDateValue).asNode()) );
    graph.add( create(createURI(repositoryURL + "/test"), RdfLexicon.HAS_MIXIN_TYPE.asNode(),
                      createURI(testMixinType)) );
    graph.add( create(createURI(repositoryURL + "/test"), RdfLexicon.WRITABLE.asNode(),
                      ResourceFactory.createTypedLiteral(new Boolean(isWritable)).asNode()) );
    resource.setGraph( graph );
}
 
开发者ID:fcrepo4-labs,项目名称:fcrepo4-client,代码行数:19,代码来源:FedoraResourceImplTest.java


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