本文整理了Java中com.hp.hpl.jena.rdf.model.Model.listStatements()
方法的一些代码示例,展示了Model.listStatements()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Model.listStatements()
方法的具体详情如下:
包路径:com.hp.hpl.jena.rdf.model.Model
类名称:Model
方法名:listStatements
[英]List all statements.
Subsequent operations on those statements may modify this model.
[中]列出所有声明。
对这些语句的后续操作可能会修改此模型。
代码示例来源:origin: com.googlecode.foresite-toolkit/foresite
public boolean hasProxy()
throws OREException
{
Selector selector = new SimpleSelector(null, ORE.proxyFor, res);
StmtIterator itr = model.listStatements(selector);
if (itr.hasNext())
{
return true;
}
return false;
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-core
/**
Answer the set of all classes which appear in <code>m</code> as the
subject or object of a <code>rdfs:subClassOf</code> statement.
*/
private static Set<RDFNode> findClassesBySubClassOf( Model m )
{
Set<RDFNode> classes = new HashSet<RDFNode>();
StmtIterator it = m.listStatements( null, RDFS.subClassOf, (RDFNode) null );
while (it.hasNext()) addClasses( classes, it.nextStatement() );
return classes;
}
代码示例来源:origin: com.googlecode.foresite-toolkit/foresite
public List<Triple> listAllTriples()
throws OREException
{
StmtIterator itr = model.listStatements();
List<Triple> triples = new ArrayList<Triple>();
while (itr.hasNext())
{
Statement statement = itr.nextStatement();
Triple triple = JenaOREFactory.createTriple(statement);
triples.add(triple);
}
return triples;
}
代码示例来源:origin: com.googlecode.foresite-toolkit/foresite
public ResourceMap getResourceMap(URI uri) throws OREException
{
Selector selector = new SimpleSelector(null, ORE.isAggregatedBy, res);
StmtIterator itr = model.listStatements(selector);
if (itr.hasNext())
{
ResourceMap rem = JenaOREFactory.createResourceMap(model, uri);
return rem;
}
return null;
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-core
private static void addIntersections( Model result, Model schema )
{
StmtIterator it = schema.listStatements( ANY, OWL.intersectionOf, ANY );
while (it.hasNext()) addIntersections( result, schema, it.nextStatement() );
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-core
private static List<Resource> equivalentTypes( Resource type )
{
List<Resource> types = new ArrayList<Resource>();
types.add( type );
for (StmtIterator it = type.getModel().listStatements( ANY, OWL.equivalentClass, type ); it.hasNext();)
types.add( it.nextStatement().getSubject() );
return types;
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-core
/**
Load all the classes which are objects of any (t, ja:assembler, S) statements
in <code>m</code>. <code>group.implementWIth(t,c)</code> is called
for each statement, where <code>c</code> is an instance of the class named
by <code>S</code>. The order in which the classes are loaded is not
specified, and loading stops immediately if any class cannot be loaded.
*/
public static void loadAssemblerClasses( AssemblerGroup group, Model m )
{
StmtIterator it = m.listStatements( ANY, JA.assembler, ANY );
while (it.hasNext()) loadAssemblerClass( group, it.nextStatement() );
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-core
/**
Load all the classes which are objects of any (t, ja:loadClass, S)
statements in <code>m</code>. The order in which the classes are
loaded is not specified, and loading stops immediately if any class
cannot be loaded.
<p>
Contrast with <code>loadClasses(AssemblerGroup,Model)</code>,
which loads classes and assumes that those classes are assemblers to
be added to the group.
*/
public static void loadArbitraryClasses( AssemblerGroup g, Model m )
{
StmtIterator it = m.listStatements( null, JA.loadClass, ANY );
while (it.hasNext()) loadArbitraryClass( g, it.nextStatement() );
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq
public static Resource getResourceByType(Model model, Resource type)
{
// See also
StmtIterator sIter = model.listStatements(null, RDF.type, type) ;
if ( ! sIter.hasNext() )
return null ;
Resource r = sIter.nextStatement().getSubject() ;
if ( sIter.hasNext() )
throw new TypeNotUniqueException(r) ;
return r ;
}
代码示例来源:origin: com.hp.hpl.jena/arq
public static Resource getResourceByType(Model model, Resource type)
{
// See also
StmtIterator sIter = model.listStatements(null, RDF.type, type) ;
if ( ! sIter.hasNext() )
return null ;
Resource r = sIter.nextStatement().getSubject() ;
if ( sIter.hasNext() )
throw new TypeNotUniqueException(r) ;
return r ;
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-core
private Model withImports( FileManager fm, Model model, Set<String> loading )
{
StmtIterator oit = model.listStatements( null, OWL.imports, (RDFNode) null );
StmtIterator jit = model.listStatements( null, JA.imports, (RDFNode) null );
if (oit.hasNext() || jit.hasNext())
{
MultiUnion g = new MultiUnion( new Graph[] { model.getGraph() } );
addImportedGraphs( fm, loading, oit, g );
addImportedGraphs( fm, loading, jit, g );
return ModelFactory.createModelForGraph( g );
}
else
return model;
}
代码示例来源:origin: com.googlecode.foresite-toolkit/foresite
public void setTypes(List<URI> types)
{
super.setTypes(types);
// ensure that the required type is still set
Selector selector = new SimpleSelector(res, RDF.type, ORE.Proxy);
StmtIterator itr = model.listStatements(selector);
if (!itr.hasNext())
{
res.addProperty(RDF.type, ORE.Proxy);
}
}
代码示例来源:origin: com.googlecode.foresite-toolkit/foresite
public void setTypes(List<URI> types)
{
super.setTypes(types);
// ensure that the required type is still set
Selector selector = new SimpleSelector(res, RDF.type, ORE.Aggregation);
StmtIterator itr = model.listStatements(selector);
if (!itr.hasNext())
{
res.addProperty(RDF.type, ORE.AggregatedResource);
}
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-core
protected int countArcsTo(Property prop, Resource resource)
{
int numArcs = 0 ;
StmtIterator sIter = resource.getModel().listStatements(null, prop, resource) ;
for ( ; sIter.hasNext() ; )
{
sIter.nextStatement() ;
numArcs++ ;
}
sIter.close() ;
return numArcs ;
}
代码示例来源:origin: com.googlecode.foresite-toolkit/foresite
public void setTypes(List<URI> types)
{
super.setTypes(types);
// ensure that the required type is still set
Selector selector = new SimpleSelector(res, RDF.type, ORE.ResourceMap);
StmtIterator itr = model.listStatements(selector);
if (!itr.hasNext())
{
res.addProperty(RDF.type, ORE.ResourceMap);
}
}
代码示例来源:origin: com.googlecode.foresite-toolkit/foresite
public void setTypes(List<URI> types)
{
super.setTypes(types);
// ensure that the required type is still set
Selector selector = new SimpleSelector(res, RDF.type, ORE.Aggregation);
StmtIterator itr = model.listStatements(selector);
if (!itr.hasNext())
{
res.addProperty(RDF.type, ORE.Aggregation);
}
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-core
protected static void addDomainTypes( Model result, Model schema )
{
for (StmtIterator it = schema.listStatements( ANY, RDFS.domain, ANY ); it.hasNext();)
{
Statement s = it.nextStatement();
Property property = s.getSubject().as( Property.class );
RDFNode type = s.getObject();
for (StmtIterator x = result.listStatements( ANY, property, ANY ); x.hasNext();)
{
Statement t = x.nextStatement();
result.add( t.getSubject(), RDF.type, type );
}
}
}
代码示例来源:origin: de.unibonn.iai.eis/luzzu-semantics
public static String getClassLabel(Resource uri){
StmtIterator iter = InternalModelConf.getDAQModel().listStatements(uri, RDFS.label, (RDFNode) null);
String label = "";
while (iter.hasNext()){
label = iter.nextStatement().getObject().toString();
}
return label;
}
代码示例来源:origin: de.unibonn.iai.eis/luzzu-semantics
public static String getClassDescription(Resource uri){
StmtIterator iter = InternalModelConf.getDAQModel().listStatements(uri, RDFS.comment, (RDFNode) null);
String label = "";
while (iter.hasNext()){
label = iter.nextStatement().getObject().toString();
}
return label;
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-core
protected Statement getDefaultStatement()
{
StmtIterator iter = getModel().listStatements( this, RDF.li(1), (RDFNode) null );
try { return iter.hasNext() ? iter.nextStatement() : null; }
finally { iter.close(); }
}
内容来源于网络,如有侵权,请联系作者删除!