com.hp.hpl.jena.graph.Graph Java Examples

The following examples show how to use com.hp.hpl.jena.graph.Graph. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AutoReloadableDataset.java    From GeoTriples with Apache License 2.0 6 votes vote down vote up
private void reload() {
	loader.getMapping().connect();
	Graph graph = loader.getGraphD2RQ();
	
	datasetGraph = DatasetGraphFactory.createOneGraph(graph);
	defaultModel = ModelFactory.createModelForGraph(datasetGraph.getDefaultGraph());		

	hasTruncatedResults = false;
	for (SQLConnection db: loader.getMapping().getSQLConnections()) {
		if (db.limit() != Database.NO_LIMIT) {
			hasTruncatedResults = true;
		}
	}

	if (autoReload) {
		lastModified = watchedFile.lastModified();
		lastReload = System.currentTimeMillis();
	}
}
 
Example #2
Source File: RdfBulkUpdateRequestHandler.java    From SolRDF with Apache License 2.0 5 votes vote down vote up
@Override
public void load(
		final SolrQueryRequest request, 
		final SolrQueryResponse response,
		final ContentStream stream, 
		final UpdateRequestProcessor processor) throws Exception {
	
	final PipedRDFIterator<Triple> iterator = new PipedRDFIterator<Triple>();
	final StreamRDF inputStream = new PipedTriplesStream(iterator);
	
	executor.submit(new Runnable() {
		@Override
		public void run() {
			try {
				RDFDataMgr.parse(
						inputStream, 
						stream.getStream(), 
						RDFLanguages.contentTypeToLang(stream.getContentType()));
			} catch (final IOException exception) {
				throw new SolrException(ErrorCode.SERVER_ERROR, exception);
			}					
		}
	});
		
	// Graph Store Protocol indicates the target graph URI separately.
	// So the incoming Content-type here is one that maps "Triples Loader" but
	// the indexed tuple could be a Quad.
	final String graphUri = request.getParams().get(Names.GRAPH_URI_ATTRIBUTE_NAME);
	
	final DatasetGraph dataset = new LocalDatasetGraph(request, response, null, null);
	final Graph defaultGraph = graphUri == null 
			? dataset.getDefaultGraph() 
			: dataset.getGraph(NodeFactory.createURI(graphUri));
	while (iterator.hasNext()) {
		defaultGraph.add(iterator.next());
	}		
}
 
Example #3
Source File: UniqueRelationshipFactory.java    From neo4jena with Apache License 2.0 4 votes vote down vote up
public UniqueRelationshipFactory(GraphDatabaseService graphdb, Graph graph) {
	//this.graphdb = graphdb;
	this.graph = graph;
}
 
Example #4
Source File: NeoGraphMaker.java    From neo4jena with Apache License 2.0 4 votes vote down vote up
@Override
public Graph createGraph(String arg0) {
	// TODO Auto-generated method stub
	
	return null;
}
 
Example #5
Source File: NeoGraphMaker.java    From neo4jena with Apache License 2.0 4 votes vote down vote up
@Override
public Graph createGraph(String arg0, boolean arg1) {
	// TODO Auto-generated method stub
	return null;
}
 
Example #6
Source File: NeoGraphMaker.java    From neo4jena with Apache License 2.0 4 votes vote down vote up
public Graph getDescription() {
	// TODO Auto-generated method stub
	return null;
}
 
Example #7
Source File: NeoGraphMaker.java    From neo4jena with Apache License 2.0 4 votes vote down vote up
public Graph getDescription(Node arg0) {
	// TODO Auto-generated method stub
	return null;
}
 
Example #8
Source File: NeoGraphMaker.java    From neo4jena with Apache License 2.0 4 votes vote down vote up
@Override
public Graph getGraph() {
	// TODO Auto-generated method stub
	return null;
}
 
Example #9
Source File: NeoGraphMaker.java    From neo4jena with Apache License 2.0 4 votes vote down vote up
@Override
public Graph openGraph() {
	// TODO Auto-generated method stub
	return null;
}
 
Example #10
Source File: NeoGraphMaker.java    From neo4jena with Apache License 2.0 4 votes vote down vote up
@Override
public Graph openGraph(String arg0) {
	// TODO Auto-generated method stub
	return null;
}
 
Example #11
Source File: NeoGraphMaker.java    From neo4jena with Apache License 2.0 4 votes vote down vote up
@Override
public Graph openGraph(String arg0, boolean arg1) {
	// TODO Auto-generated method stub
	return null;
}
 
Example #12
Source File: NeoGraphMaker.java    From neo4jena with Apache License 2.0 4 votes vote down vote up
@Override
public Graph createGraph() {
	// TODO Auto-generated method stub
	return neoGraph;
}
 
Example #13
Source File: Neo4j.java    From neo4jena with Apache License 2.0 4 votes vote down vote up
@Override
public boolean dependsOn(Graph arg0) {
	// TODO Auto-generated method stub
	return false;
}
 
Example #14
Source File: Neo4j.java    From neo4jena with Apache License 2.0 4 votes vote down vote up
@Override
public boolean isIsomorphicWith(Graph arg0) {
	// TODO Auto-generated method stub
	return false;
}
 
Example #15
Source File: LocalDatasetGraph.java    From SolRDF with Apache License 2.0 4 votes vote down vote up
@Override
protected Graph _createNamedGraph(final Node graphNode) {
	return LocalGraph.readableAndWritableGraph(graphNode, request, response, qParser, listener);
}
 
Example #16
Source File: LocalDatasetGraph.java    From SolRDF with Apache License 2.0 4 votes vote down vote up
@Override
protected Graph _createDefaultGraph() {
	return LocalGraph.readableAndWritableGraph(null, request, response, qParser, listener);
}
 
Example #17
Source File: CloudDatasetGraph.java    From SolRDF with Apache License 2.0 4 votes vote down vote up
@Override
protected Graph _createNamedGraph(final Node graphNode) {
	return new CloudGraph(graphNode, cloud, CloudGraph.DEFAULT_QUERY_FETCH_SIZE, listener);
}
 
Example #18
Source File: CloudDatasetGraph.java    From SolRDF with Apache License 2.0 4 votes vote down vote up
@Override
protected Graph _createDefaultGraph() {
	return new CloudGraph(null, cloud, CloudGraph.DEFAULT_QUERY_FETCH_SIZE, listener);
}
 
Example #19
Source File: NeoGraphMaker.java    From neo4jena with Apache License 2.0 4 votes vote down vote up
public Graph addDescription(Graph arg0, Node arg1) {
	// TODO Auto-generated method stub
	return null;
}
 
Example #20
Source File: NeoGraph.java    From neo4jena with Apache License 2.0 4 votes vote down vote up
@Override
public boolean isIsomorphicWith(Graph arg0) {
	throw new RuntimeException(new MethodNotSupportedException("isIsomorphic"));
}
 
Example #21
Source File: NeoGraph.java    From neo4jena with Apache License 2.0 4 votes vote down vote up
@Override
public boolean dependsOn(Graph arg0) {
	throw new RuntimeException(new MethodNotSupportedException("dependsOn"));
}
 
Example #22
Source File: ResourceDescriber.java    From GeoTriples with Apache License 2.0 4 votes vote down vote up
public Graph description() {
	if (executed) return result;
	executed = true;

	ExecutionContext context = new ExecutionContext(
			mapping.getContext(), null, null, null);
	final QueryIterConcat qIter = new QueryIterConcat(context);
	Pingback<?> pingback = null;
	if (timeout > 0) {
		pingback = AlarmClock.get().add(new Callback<Object>() {
			public void proc(Object ignore) {
				qIter.cancel();
			}
		}, timeout);
	}
	
	FindQuery outgoing = new FindQuery(
			Triple.create(node, Node.ANY, Node.ANY), 
			mapping.getTripleRelations(), limit, context);
	qIter.add(outgoing.iterator());
	
	if (!onlyOutgoing) {
		FindQuery incoming = new FindQuery(
				Triple.create(Node.ANY, Node.ANY, node), 
				mapping.getTripleRelations(), limit, context);
		qIter.add(incoming.iterator());

		FindQuery triples = new FindQuery(
				Triple.create(Node.ANY, node, Node.ANY), 
				mapping.getTripleRelations(), limit, context);
		qIter.add(triples.iterator());
	}
	Iterator<Triple> it = TripleQueryIter.create(qIter);
	while (it.hasNext()) {
		result.add(it.next());
	}
	
	if (pingback != null) {
		AlarmClock.get().cancel(pingback);
	}
	
	return result;
}
 
Example #23
Source File: D2RQQueryHandler.java    From GeoTriples with Apache License 2.0 4 votes vote down vote up
public TreeQueryPlan prepareTree(Graph pattern) {
	throw new RuntimeException("prepareTree - Andy says Chris says this will not be called");
}
 
Example #24
Source File: D2RQQueryHandler.java    From GeoTriples with Apache License 2.0 4 votes vote down vote up
public D2RQQueryHandler(Graph graph) {
	super(graph);
	dataset = DatasetGraphFactory.createOneGraph(graph);
}
 
Example #25
Source File: R2RMLCompiler.java    From GeoTriples with Apache License 2.0 4 votes vote down vote up
public Graph getAdditionalTriples() {
	return GraphFactory.createPlainGraph();
}
 
Example #26
Source File: CompiledD2RQMapping.java    From GeoTriples with Apache License 2.0 4 votes vote down vote up
public Graph getAdditionalTriples() {
	return additionalTriples;
}
 
Example #27
Source File: CompiledD2RQMapping.java    From GeoTriples with Apache License 2.0 4 votes vote down vote up
public void setAdditionalTriples(Graph graph) {
	additionalTriples = graph;
}
 
Example #28
Source File: GeneralR2RMLCompiler.java    From GeoTriples with Apache License 2.0 4 votes vote down vote up
public Graph getAdditionalTriples() {
	return GraphFactory.createPlainGraph();
}
 
Example #29
Source File: SystemLoader.java    From GeoTriples with Apache License 2.0 4 votes vote down vote up
public Graph getGraphD2RQ() {
	if (dataGraph == null) {
		dataGraph = new GraphD2RQ(getMapping());
	}
	return dataGraph;
}
 
Example #30
Source File: GeneralSystemLoader.java    From GeoTriples with Apache License 2.0 4 votes vote down vote up
public Graph getGraphD2RQ() {
	if (dataGraph == null) {
		dataGraph = new GeneralGraphD2RQ(getMapping());
	}
	return dataGraph;
}