本文整理了Java中org.apache.clerezza.commons.rdf.Graph.addAll()
方法的一些代码示例,展示了Graph.addAll()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Graph.addAll()
方法的具体详情如下:
包路径:org.apache.clerezza.commons.rdf.Graph
类名称:Graph
方法名:addAll
暂无
代码示例来源:origin: org.apache.clerezza/rdf.core
@Override
public Boolean run() {
return graph.addAll(c);
}
});
代码示例来源:origin: org.apache.clerezza/rdf.core.test
@Override
public boolean addAll(Collection<? extends Triple> c) {
return wrapped.addAll(c);
}
代码示例来源:origin: apache/clerezza
@Override
public Boolean run() {
return graph.addAll(c);
}
});
代码示例来源:origin: apache/clerezza
@Override
public boolean addAll(Collection<? extends Triple> c) {
return wrapped.addAll(c);
}
代码示例来源:origin: org.apache.clerezza.commons-rdf/commons-rdf-impl-utils
@Override
public boolean addAll(Collection<? extends Triple> c) {
return wrapped.addAll(c);
}
代码示例来源:origin: org.apache.clerezza/rdf.core
@Override
public boolean addAll(Collection<? extends Triple> c) {
checkWrite();
return wrapped.addAll(c);
}
代码示例来源:origin: apache/clerezza
@Override
public boolean addAll(Collection<? extends Triple> c) {
checkWrite();
return wrapped.addAll(c);
}
代码示例来源:origin: apache/stanbol
@PUT
@Path("users/{username}")
@Consumes(SupportedFormat.TURTLE)
public Response createUser(@Context UriInfo uriInfo, @PathParam("username") String userName, ImmutableGraph inputGraph) {
Lock writeLock = systemGraph.getLock().writeLock();
writeLock.lock();
systemGraph.addAll(inputGraph);
writeLock.unlock();
UriBuilder uriBuilder = uriInfo.getBaseUriBuilder();
URI createdResource = uriBuilder.replacePath("/user-management/users/" + userName).build();
return Response.created(createdResource).build();
}
代码示例来源:origin: apache/stanbol
private void addRDFTo(Graph graph, Representation representation) {
graph.addAll(valueFactory.toRdfRepresentation(representation).getRdfGraph());
}
代码示例来源:origin: org.apache.stanbol/org.apache.stanbol.enhancer.engines.htmlextractor
public synchronized void extract(String id, Document doc, Map<String, Object> params,
Graph result)
throws ExtractorException {
if (params == null) {
params = new HashMap<String, Object>();
}
params.put(this.uriParameter, id);
initTransformerParameters(params);
Source source = new DOMSource(doc);
ByteArrayOutputStream writer = new ByteArrayOutputStream(8192);
StreamResult output = new StreamResult(writer);
try {
this.transformer.transform(source, output);
if (LOG.isDebugEnabled()) {
String rdf = writer.toString("UTF-8");
LOG.debug(rdf);
}
InputStream reader = new ByteArrayInputStream(writer.toByteArray());
Parser rdfParser = Parser.getInstance();
ImmutableGraph graph = rdfParser.parse(reader, this.syntax);
result.addAll(graph);
} catch (TransformerException e) {
throw new ExtractorException(e.getMessage(), e);
} catch (IOException e) {
throw new ExtractorException(e.getMessage(), e);
}
}
代码示例来源:origin: org.apache.clerezza/rdf.jena.tdb.storage
@Override
public ImmutableGraph createImmutableGraph(IRI name, Graph triples)
throws UnsupportedOperationException, EntityAlreadyExistsException {
File tcDir = getImmutableGraphDir(name);
if (tcDir.exists()) {
throw new EntityAlreadyExistsException(name);
}
if (triples == null) {
triples = new SimpleGraph();
}
tcDir.mkdirs();
File otimizationIndicator = new File(tcDir, "fixed.opt");
try {
otimizationIndicator.createNewFile();
} catch (IOException ex) {
throw new RuntimeException(ex);
}
Graph mGraph = getGraph(tcDir);
mGraph.addAll(triples);
ImmutableGraph result = mGraph.getImmutableGraph();
TDB.sync(dir2Dataset.get(tcDir));
graphMap.put(name, result);
return result;
}
代码示例来源:origin: org.apache.clerezza/rdf.stable.serializer
private List<MSG> decomposeGraphToMSGs(Graph tc) {
Graph tmp = new SimpleGraph();
tmp.addAll(tc);
List<MSG> msgSet = new LinkedList<MSG>();
while (tmp.size() > 0) {
Triple triple = tmp.iterator().next();
Graph msgTc = new SimpleGraph();
boolean containsBlankNode = fillMSG(triple, tmp, msgTc);
MSG msg = new MSG(msgTc);
msg.containsBlankNodes = containsBlankNode;
msgSet.add(msg);
}
return msgSet;
}
代码示例来源:origin: apache/stanbol
private Graph getExpandedContext(GraphNode node, GraphNode recipe) {
final Graph result = new SimpleGraph(node.getNodeContext());
final Set<RDFTerm> expandedResources = new HashSet<RDFTerm>();
expandedResources.add(node.getNode());
while (true) {
Set<RDFTerm> additionalExpansionRes = getAdditionalExpansionResources(result, recipe);
additionalExpansionRes.removeAll(expandedResources);
if (additionalExpansionRes.size() == 0) {
return result;
}
for (RDFTerm resource : additionalExpansionRes) {
final GraphNode additionalNode = new GraphNode(resource, node.getGraph());
result.addAll(additionalNode.getNodeContext());
expandedResources.add(resource);
}
}
}
代码示例来源:origin: org.apache.clerezza/jaxrs.rdf.providers
private Graph getExpandedContext(GraphNode node) {
final Graph result = new SimpleGraph(node.getNodeContext());
final Set<RDFTerm> expandedResources = new HashSet<RDFTerm>();
expandedResources.add(node.getNode());
while (true) {
Set<RDFTerm> additionalExpansionRes = getAdditionalExpansionResources(result);
additionalExpansionRes.removeAll(expandedResources);
if (additionalExpansionRes.size() == 0) {
return result;
}
for (RDFTerm resource : additionalExpansionRes) {
final GraphNode additionalNode = new GraphNode(resource, node.getGraph());
result.addAll(additionalNode.getNodeContext());
expandedResources.add(resource);
}
}
}
代码示例来源:origin: apache/clerezza
private Graph getExpandedContext(GraphNode node) {
final Graph result = new SimpleGraph(node.getNodeContext());
final Set<RDFTerm> expandedResources = new HashSet<RDFTerm>();
expandedResources.add(node.getNode());
while (true) {
Set<RDFTerm> additionalExpansionRes = getAdditionalExpansionResources(result);
additionalExpansionRes.removeAll(expandedResources);
if (additionalExpansionRes.size() == 0) {
return result;
}
for (RDFTerm resource : additionalExpansionRes) {
final GraphNode additionalNode = new GraphNode(resource, node.getGraph());
result.addAll(additionalNode.getNodeContext());
expandedResources.add(resource);
}
}
}
代码示例来源:origin: org.apache.clerezza/rdf.utils
private Graph getContextOf(RDFTerm node, final Set<RDFTerm> dontExpand, Acceptor acceptor) {
Graph result = new SimpleGraph();
if (node instanceof BlankNodeOrIRI) {
Iterator<Triple> forwardProperties = graph.filter((BlankNodeOrIRI) node, null, null);
while (forwardProperties.hasNext()) {
Triple triple = forwardProperties.next();
result.add(triple);
RDFTerm object = triple.getObject();
if (acceptor.expand(object) && !dontExpand.contains(object)) {
dontExpand.add(object);
result.addAll(getContextOf(object, dontExpand, acceptor));
}
}
}
Iterator<Triple> backwardProperties = graph.filter(null, null, node);
while (backwardProperties.hasNext()) {
Triple triple = backwardProperties.next();
result.add(triple);
BlankNodeOrIRI subject = triple.getSubject();
if (acceptor.expand(subject) && !dontExpand.contains(subject)) {
dontExpand.add(subject);
result.addAll(getContextOf(subject, dontExpand, acceptor));
}
}
return result;
}
代码示例来源:origin: apache/stanbol
/**
* Enhances the parsed ContentItem
* @param ci the content item to enhance
* @param reqProp the request properties or <code>null</code> if none
* @throws EnhancementException
*/
protected void enhance(ContentItem ci, Map<String,Object> reqProp) throws EnhancementException {
if (jobManager != null) {
jobManager.enhanceContent(ci, getChain());
}
Graph graph = ci.getMetadata();
Boolean includeExecutionMetadata = RequestPropertiesHelper.isIncludeExecutionMetadata(reqProp);
if (includeExecutionMetadata != null && includeExecutionMetadata.booleanValue()) {
try {
graph.addAll(ci.getPart(ExecutionMetadata.CHAIN_EXECUTION, Graph.class));
} catch (NoSuchPartException e) {
// no executionMetadata available
}
}
}
代码示例来源:origin: org.apache.stanbol/org.apache.stanbol.enhancer.jersey
/**
* Enhances the parsed ContentItem
* @param ci the content item to enhance
* @param reqProp the request properties or <code>null</code> if none
* @throws EnhancementException
*/
protected void enhance(ContentItem ci, Map<String,Object> reqProp) throws EnhancementException {
if (jobManager != null) {
jobManager.enhanceContent(ci, getChain());
}
Graph graph = ci.getMetadata();
Boolean includeExecutionMetadata = RequestPropertiesHelper.isIncludeExecutionMetadata(reqProp);
if (includeExecutionMetadata != null && includeExecutionMetadata.booleanValue()) {
try {
graph.addAll(ci.getPart(ExecutionMetadata.CHAIN_EXECUTION, Graph.class));
} catch (NoSuchPartException e) {
// no executionMetadata available
}
}
}
代码示例来源:origin: apache/stanbol
/**
* Fetch the OWLOntology containing the graph associated to an entity from Linked Data. It uses the Entity
* Hub for accessing LOD and fetching entities.
*
* @param entityURI
* {@link String}
* @return the {@link OWLOntology} of the entity
*/
private Graph populateWithEntity(String entityURI, Graph target) {
log.debug("Requesting signature of entity {}", entityURI);
Graph graph = target != null ? target : new IndexedGraph();
// Query the Entity Hub
Entity signature = referencedSiteManager.getEntity(entityURI);
if (signature != null) {
RdfRepresentation rdfSignature = RdfValueFactory.getInstance().toRdfRepresentation(
signature.getRepresentation());
graph.addAll(rdfSignature.getRdfGraph());
}
return graph;
}
代码示例来源:origin: org.apache.clerezza/rdf.stable.serializer
private boolean fillMSG(Triple triple, Graph tc,
Graph msg) {
boolean containsBlankNode = false;
RDFTerm resource = triple.getSubject();
if (resource instanceof BlankNode) {
containsBlankNode = true;
} else {
resource = triple.getObject();
if (resource instanceof BlankNode) {
containsBlankNode = true;
}
}
if (containsBlankNode) {
GraphNode gn = new GraphNode(resource, tc);
ImmutableGraph context = gn.getNodeContext();
msg.addAll(context);
tc.removeAll(context);
} else {
msg.add(triple);
tc.remove(triple);
}
return containsBlankNode;
}
内容来源于网络,如有侵权,请联系作者删除!