Refine search
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; }
/** 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; }
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; }
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; }
private static void addIntersections( Model result, Model schema ) { StmtIterator it = schema.listStatements( ANY, OWL.intersectionOf, ANY ); while (it.hasNext()) addIntersections( result, schema, it.nextStatement() ); }
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; }
/** 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() ); }
/** 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() ); }
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 ; }
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 ; }
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; }
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); } }
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); } }
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 ; }
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); } }
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); } }
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 ); } } }
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; }
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; }
protected Statement getDefaultStatement() { StmtIterator iter = getModel().listStatements( this, RDF.li(1), (RDFNode) null ); try { return iter.hasNext() ? iter.nextStatement() : null; } finally { iter.close(); } }