本文整理了Java中org.apache.jena.rdf.model.Model.getGraph()
方法的一些代码示例,展示了Model.getGraph()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Model.getGraph()
方法的具体详情如下:
包路径:org.apache.jena.rdf.model.Model
类名称:Model
方法名:getGraph
暂无
代码示例来源:origin: apache/jena
/**
* Parse the source, sending the results to a {@link Model}.
* The source must be for triples; any quads are discarded.
* This method is equivalent to {@code parse(model.getGraph())}.
*/
public void parse(Model model) {
parse(model.getGraph());
}
代码示例来源:origin: apache/jena
/** Read triples into a Model from the given location, with some parameters for the reader
* @see #read(Model,String,String,Lang,Context)
* @param model Destination for the RDF read
* @param uri URI to read from (includes file: and a plain file name).
* @param context Content object to control reading process.
* @throws RiotNotFoundException if the location is not found - the model is unchanged.
* @deprecated To be removed. Use {@code RDFParser.create().context(context)...}
*/
@Deprecated
public static void read(Model model, String uri, Context context) { read(model.getGraph(), uri, context) ; }
代码示例来源:origin: apache/jena
/** Create a GraphStore from a Model
* @param model
* @return GraphStore
*/
@Deprecated
public static GraphStore create(Model model) { return create(model.getGraph()) ; }
代码示例来源:origin: apache/jena
/** Put (replace) the default model of a Dataset */
@Override
public void putModel(Model data)
{
updater.httpPut(data.getGraph()) ;
}
代码示例来源:origin: apache/jena
/** Write the model to the output stream in the default serialization for the language.
* @param out OutputStream
* @param model Graph to write
* @param lang Language for the serialization.
*/
public static void write(OutputStream out, Model model, Lang lang) {
write(out, model.getGraph(), lang);
}
代码示例来源:origin: apache/jena
/** Write the graph to the output stream in the default serialization for the language.
* @param out OutputStream
* @param model Model to write
* @param serialization Serialization format
* @deprecated Use of writers is deprecated - use an OutputStream
*/
@Deprecated
public static void write(Writer out, Model model, RDFFormat serialization) {
write(out, model.getGraph(), serialization);
}
代码示例来源:origin: apache/jena
/** Set the source of writing to the graph argument.
* <p>
* Any previous source setting is cleared.
* <p>
* Equivalent to {@code source(model.getGraph()(s)}
*
* @param model A {@link Model}.
* @return this
*/
public RDFWriterBuilder source(Model model) {
return source(model.getGraph());
}
代码示例来源:origin: apache/jena
@Override
public Model remove( Model m )
{
GraphUtil.deleteFrom( getGraph(), m.getGraph());
return this;
}
代码示例来源:origin: apache/jena
/**
* Precompute the implications of a schema Model. The statements in the graph
* will be combined with the data when the final InfGraph is created.
*/
@Override
public Reasoner bindSchema(Model tbox) throws ReasonerException {
InfGraph graph = new BasicForwardRuleInfGraph(this, rules, null, tbox.getGraph());
return new BasicForwardRuleReasoner(rules, graph, factory);
}
代码示例来源:origin: apache/jena
@Override
protected void readWorker(Model model, Reader reader, String base)
{
ParserTurtle p = new ParserTurtle() ;
p.parse( model.getGraph(), base, reader ) ;
}
}
代码示例来源:origin: apache/jena
/** Put (create/replace) a named model of a Dataset */
@Override
public void putModel(String graphUri, Model data)
{
updater.httpPut(NodeFactory.createURI(graphUri), data.getGraph()) ;
}
代码示例来源:origin: apache/jena
/**
Answer <code>model</code> after updating it with the sub-graph of
<code>s</code> rooted at <code>r</code>, bounded by this instances
<code>boundary</code>.
*/
public Model extractInto( Model model, Resource r, Model s )
{ TripleBoundary tb = boundary.asTripleBoundary( s );
Graph g = getGraphExtract( tb ) .extractInto( model.getGraph(), r.asNode(), s.getGraph() );
return ModelFactory.createModelForGraph( g ); }
代码示例来源:origin: apache/jena
@Override
public Dataset addNamedModel(String uri, Model model) {
checkGraphName(uri) ;
Node n = NodeFactory.createURI(uri) ;
dsg.addGraph(n, model.getGraph()) ;
return this;
}
代码示例来源:origin: apache/jena
@Override
public PrefixMapping getPrefixMapping()
{
return createModel().getGraph().getPrefixMapping();
}
代码示例来源:origin: apache/jena
@Override
public PrefixMapping getPrefixMapping()
{
return ModelFactory.createDefaultModel().getGraph()
.getPrefixMapping();
}
}
代码示例来源:origin: apache/jena
@Test public void dataset2()
{
Dataset ds = graphLocation.getDataset() ;
Graph g1 = ds.getDefaultModel().getGraph() ;
Graph g2 = ds.getNamedModel("http://example/").getGraph() ;
g1.add(new Triple(n0,n1,n2) ) ;
assertTrue(g1.contains(n0,n1,n2) ) ;
assertFalse(g2.contains(n0,n1,n2) ) ;
}
代码示例来源:origin: apache/jena
public void testSchema()
{
Model schema = model( "P rdf:type owl:ObjectProperty" );
Resource root = resourceInModel( "x rdf:type ja:ReasonerFactory; x ja:schema S" );
Assembler sub = new NamedObjectAssembler( resource( "S" ), schema );
ReasonerFactory rf = (ReasonerFactory) ASSEMBLER.open( sub, root );
Reasoner r = rf.create( null );
assertIsomorphic( schema.getGraph(), ((FBRuleReasoner) r).getBoundSchema() );
}
代码示例来源:origin: apache/jena
public void testFollowOwlImports()
{
final Model modelToLoad = model( "this hasMarker B5" );
Model m = model( "x ja:reasoner y; _x owl:imports eh:/loadMe" );
FileManager fm = new FixedFileManager().add( "eh:/loadMe", modelToLoad );
Model m2 = new ImportManager().withImports( fm, m );
assertInstanceOf( MultiUnion.class, m2.getGraph() );
assertIsoModels( modelToLoad.union( m ), m2 );
}
代码示例来源:origin: apache/jena
public void testImportMayBeLiteral()
{
final Model modelToLoad = model( "this hasMarker B5" );
Model m = model( "x ja:reasoner y; _x ja:imports 'eh:/loadMe'" );
FileManager fm = new FixedFileManager().add( "eh:/loadMe", modelToLoad );
Model m2 = new ImportManager().withImports( fm, m );
assertInstanceOf( MultiUnion.class, m2.getGraph() );
assertIsoModels( modelToLoad.union( m ), m2 );
}
代码示例来源:origin: apache/jena
@Test(expected=ConcurrentModificationException.class)
public void mrswGraph2()
{
Model m = create().getDefaultModel() ;
Resource r = m.createResource("x") ;
ExtendedIterator<Statement> iter1 = m.listStatements(r, null, (RDFNode)null) ;
assertNotNull(iter1.next()) ;
Triple t = SSE.parseTriple("(<y> <p> 99)") ;
m.getGraph().add(t) ;
// Bad
iter1.hasNext();
}
内容来源于网络,如有侵权,请联系作者删除!