org.apache.clerezza.commons.rdf.Graph.getImmutableGraph()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(9.1k)|赞(0)|评价(0)|浏览(128)

本文整理了Java中org.apache.clerezza.commons.rdf.Graph.getImmutableGraph()方法的一些代码示例,展示了Graph.getImmutableGraph()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Graph.getImmutableGraph()方法的具体详情如下:
包路径:org.apache.clerezza.commons.rdf.Graph
类名称:Graph
方法名:getImmutableGraph

Graph.getImmutableGraph介绍

暂无

代码示例

代码示例来源:origin: org.apache.clerezza/rdf.core

@Override
public ImmutableGraph getImmutableGraph() {
  return this.triples.getImmutableGraph();
}

代码示例来源:origin: org.apache.clerezza/rdf.core.test

@Override
public ImmutableGraph getImmutableGraph() {
  return wrapped.getImmutableGraph();
}

代码示例来源:origin: apache/clerezza

@Override
public ImmutableGraph getImmutableGraph() {
  return wrapped.getImmutableGraph();
}

代码示例来源:origin: apache/clerezza

@Override
public ImmutableGraph getImmutableGraph() {
  return this.triples.getImmutableGraph();
}

代码示例来源:origin: org.apache.clerezza/rdf.jena.tdb.storage

/**
 * Getter for the {@link ImmutableGraph}
 * @return the {@link ImmutableGraph}
 * @throws IllegalStateException if this {@link ModelGraph} is 
 * {@link #readWrite}
 */
public ImmutableGraph getImmutableGraph() {
  if(readWrite){
    throw new IllegalStateException("Unable to return ImmutableGraph for read/write models.");
  }
  return graph.getImmutableGraph();
}
/**

代码示例来源:origin: org.apache.clerezza/rdf.schemagen

private ImmutableGraph getNodeContext(BlankNodeOrIRI resource, Graph graph) {
  final HashSet<BlankNode> dontExpand = new HashSet<BlankNode>();
  if (resource instanceof BlankNode) {
    dontExpand.add((BlankNode) resource);
  }
  return getContextOf(resource, dontExpand, graph).getImmutableGraph();
}

代码示例来源:origin: apache/clerezza

private ImmutableGraph getNodeContext(BlankNodeOrIRI resource, Graph graph) {
  final HashSet<BlankNode> dontExpand = new HashSet<BlankNode>();
  if (resource instanceof BlankNode) {
    dontExpand.add((BlankNode) resource);
  }
  return getContextOf(resource, dontExpand, graph).getImmutableGraph();
}

代码示例来源:origin: org.apache.clerezza/rdf.jena.tdb.storage

private ImmutableGraph getImmutableGraph(File tcDir) {
  return getGraph(tcDir).getImmutableGraph();
}

代码示例来源:origin: apache/stanbol

private ImmutableGraph parseResponse(InputStream is) {
  JenaParserProvider jenaParserProvider = new JenaParserProvider();
  //NOTE(rw): the new third parameter is the base URI used to resolve relative paths
  Graph g = new SimpleGraph();
  jenaParserProvider.parse(g,is, SupportedFormat.RDF_XML,null);
  log.debug("graph: " + g.toString());
  return g.getImmutableGraph();
}

代码示例来源:origin: org.apache.clerezza/rdf.core

@Override
public Object getService(Bundle arg0, ServiceRegistration arg1) {
  Graph tc = 
      new SecuredGraph(tcManager.getImmutableGraph(name), name,
      tcAccessController);
  return tc.getImmutableGraph();
}

代码示例来源:origin: apache/stanbol

@SuppressWarnings("unchecked")
@Override
public <O> O export(Class<O> returnType, boolean merge, org.semanticweb.owlapi.model.IRI universalPrefix) {
  if (OWLOntology.class.isAssignableFrom(returnType)) {
    return (O) exportToOWLOntology(merge, universalPrefix);
  }
  if (Graph.class.isAssignableFrom(returnType)) {
    Graph root = exportToGraph(merge, universalPrefix);
    // A Clerezza graph has to be cast properly.
    if (returnType == ImmutableGraph.class) root = ((Graph) root).getImmutableGraph();
    else if (returnType == Graph.class) {}
    return (O) root;
  }
  throw new UnsupportedOperationException("Cannot export scope " + getID() + " to a " + returnType);
}

代码示例来源:origin: apache/clerezza

@Override
public Object getService(Bundle arg0, ServiceRegistration arg1) {
  Graph tc = 
      new SecuredGraph(tcManager.getImmutableGraph(name), name,
      tcAccessController);
  return tc.getImmutableGraph();
}

代码示例来源:origin: org.apache.stanbol/org.apache.stanbol.ontologymanager.multiplexer.clerezza

@SuppressWarnings("unchecked")
@Override
public <O> O getOntology(OWLOntologyID ontologyId, Class<O> returnType, boolean merge, org.semanticweb.owlapi.model.IRI universalPrefix) {
  if (OWLOntology.class.isAssignableFrom(returnType)) return (O) getOntologyAsOWLOntology(ontologyId,
    merge, universalPrefix);
  if (Graph.class.isAssignableFrom(returnType)) {
    Graph root = getOntologyAsGraph(ontologyId, merge, universalPrefix);
    // A Clerezza graph has to be cast properly.
    if (returnType == ImmutableGraph.class) root = ((Graph) root).getImmutableGraph();
    else if (returnType == Graph.class) {}
    // We don't know of other Graph subclasses: just try to cast the Graph.
    return (O) root;
  }
  throw new UnsupportedOperationException("Cannot export ontology collector " + getID() + " to a "
                      + returnType);
}

代码示例来源:origin: org.apache.stanbol/org.apache.stanbol.ontologymanager.multiplexer.clerezza

@SuppressWarnings("unchecked")
@Override
public <O> O export(Class<O> returnType, boolean merge, org.semanticweb.owlapi.model.IRI universalPrefix) {
  if (OWLOntology.class.isAssignableFrom(returnType)) {
    return (O) exportToOWLOntology(merge, universalPrefix);
  }
  if (Graph.class.isAssignableFrom(returnType)) {
    Graph root = exportToGraph(merge, universalPrefix);
    // A Clerezza graph has to be cast properly.
    if (returnType == ImmutableGraph.class) root = ((Graph) root).getImmutableGraph();
    else if (returnType == Graph.class) {}
    return (O) root;
  }
  throw new UnsupportedOperationException("Cannot export ontology collector " + getID() + " to a "
                      + returnType);
}

代码示例来源:origin: apache/stanbol

@SuppressWarnings("unchecked")
@Override
public <O> O export(Class<O> returnType, boolean merge, org.semanticweb.owlapi.model.IRI universalPrefix) {
  if (OWLOntology.class.isAssignableFrom(returnType)) {
    return (O) exportToOWLOntology(merge, universalPrefix);
  }
  if (Graph.class.isAssignableFrom(returnType)) {
    Graph root = exportToGraph(merge, universalPrefix);
    // A Clerezza graph has to be cast properly.
    if (returnType == ImmutableGraph.class) root = ((Graph) root).getImmutableGraph();
    else if (returnType == Graph.class) {}
    return (O) root;
  }
  throw new UnsupportedOperationException("Cannot export ontology collector " + getID() + " to a "
                      + returnType);
}

代码示例来源:origin: apache/stanbol

@SuppressWarnings("unchecked")
@Override
public <O> O getOntology(OWLOntologyID ontologyId, Class<O> returnType, boolean merge, org.semanticweb.owlapi.model.IRI universalPrefix) {
  if (OWLOntology.class.isAssignableFrom(returnType)) return (O) getOntologyAsOWLOntology(ontologyId,
    merge, universalPrefix);
  if (Graph.class.isAssignableFrom(returnType)) {
    Graph root = getOntologyAsGraph(ontologyId, merge, universalPrefix);
    // A Clerezza graph has to be cast properly.
    if (returnType == ImmutableGraph.class) root = ((Graph) root).getImmutableGraph();
    else if (returnType == Graph.class) {}
    // We don't know of other Graph subclasses: just try to cast the Graph.
    return (O) root;
  }
  throw new UnsupportedOperationException("Cannot export ontology collector " + getID() + " to a "
                      + returnType);
}

代码示例来源:origin: org.apache.stanbol/org.apache.stanbol.ontologymanager.multiplexer.clerezza

@SuppressWarnings("unchecked")
@Override
public <O> O export(Class<O> returnType, boolean merge, org.semanticweb.owlapi.model.IRI universalPrefix) {
  if (OWLOntology.class.isAssignableFrom(returnType)) {
    return (O) exportToOWLOntology(merge, universalPrefix);
  }
  if (Graph.class.isAssignableFrom(returnType)) {
    Graph root = exportToGraph(merge, universalPrefix);
    // A Clerezza graph has to be cast properly.
    if (returnType == ImmutableGraph.class) root = ((Graph) root).getImmutableGraph();
    else if (returnType == Graph.class) {}
    return (O) root;
  }
  throw new UnsupportedOperationException("Cannot export scope " + getID() + " to a " + returnType);
}

代码示例来源:origin: apache/stanbol

/**
 * Wraps the supplied <code>graph</code> into a new input source. No origin will be set.
 * 
 * @param graph
 *            the RDF graph
 * @throws IllegalArgumentException
 *             if <code>graph</code> is neither a {@link ImmutableGraph} nor a {@link Graph}.
 */
public GraphSource(Graph graph) {
  if (graph instanceof ImmutableGraph) bindRootOntology(graph);
  else if (graph instanceof Graph) bindRootOntology(((Graph) graph).getImmutableGraph());
  else throw new IllegalArgumentException("GraphSource supports only ImmutableGraph and Graph types. "
                      + graph.getClass() + " is not supported.");
  bindPhysicalOrigin(null);
}

代码示例来源:origin: org.apache.stanbol/org.apache.stanbol.ontologymanager.sources.clerezza

/**
 * Wraps the supplied <code>graph</code> into a new input source. No origin will be set.
 * 
 * @param graph
 *            the RDF graph
 * @throws IllegalArgumentException
 *             if <code>graph</code> is neither a {@link ImmutableGraph} nor a {@link Graph}.
 */
public GraphSource(Graph graph) {
  if (graph instanceof ImmutableGraph) bindRootOntology(graph);
  else if (graph instanceof Graph) bindRootOntology(((Graph) graph).getImmutableGraph());
  else throw new IllegalArgumentException("GraphSource supports only ImmutableGraph and Graph types. "
                      + graph.getClass() + " is not supported.");
  bindPhysicalOrigin(null);
}

代码示例来源:origin: org.apache.clerezza/rdf.core

/**
 * Parses a serialized ImmutableGraph from an InputStream. This delegates the
 * processing to the provider registered for the specified format, if
 * the formatIdentifier contains a ';'-character only the section before
 * that character is used for choosing the provider.
 *
 * @param serializedGraph an inputstream with the serialization
 * @param formatIdentifier a string identifying the format (usually the MIME-type)
 * @param baseUri the uri against which relative uri-refs are evaluated
 * @return the ImmutableGraph read from the stream
 * @throws UnsupportedFormatException
 */
public ImmutableGraph parse(InputStream serializedGraph,
    String formatIdentifier, IRI baseUri) throws UnsupportedFormatException {
  Graph graph = new SimpleMGraph();
  parse(graph, serializedGraph, formatIdentifier, baseUri);
  return graph.getImmutableGraph();
}

相关文章