static Set<Resource> subjects(Model model,Property p, RDFNode r) { Set<Resource> subjects = new HashSet<>(); ResIterator it = model.listSubjectsWithProperty(p, r); while(it.hasNext()) subjects.add(it.next().asResource()); it.close(); return subjects; }
while (iter.hasNext()) { Statement s = iter.next(); skosRessources.add(s.getSubject().asResource());
/** Answer this view after modifying it to contain all the property chains defined by <code>spec</code>. */ public View addViewFromRDFList(Resource spec, ShortnameService sns) { cannotUpdateALL(); if (spec.canAs(RDFList.class)) { List<ViewProperty> properties = new ArrayList<>(); Iterator<RDFNode> list = spec.as(RDFList.class).iterator(); while(list.hasNext()) { properties.add(new ViewProperty.Base(list.next().as(Property.class))); } chains.add( new PropertyChain( properties ) ); } else { String uri = spec.asResource().getURI(); Property prop = ResourceFactory.createProperty(uri); ViewProperty vp = new ViewProperty.Base(prop); chains.add(new PropertyChain(vp)); } if (chains.size() > 0) type = Type.T_CHAINS; return this; }
model.createTypedLiteral(from, NodeFactory.getType(from))); blank.addProperty(Constants.DEFACTO_TO, model.createTypedLiteral(to, NodeFactory.getType(to))); blank.addProperty(model.createProperty(blankProperty), objectRes.asResource()); model.createLiteral(entry.getValue(), entry.getKey())); subjectRes.addProperty(model.createProperty(subjectProperty), blank.asResource());
/** * Gets the thesaurus resource from the model, returning the first one only * * @param model * @return */ private Resource getSKOSThesaurus(Model model) { SimpleSelector schemeSelector = new SimpleSelector(null, null, (RDFNode) null) { public boolean selects(Statement s) { if (s.getObject().isResource()) { return s.getObject().asResource() .equals(SKOS.CONCEPTSCHEME); } else { return false; } } }; StmtIterator iter = model.listStatements(schemeSelector); Resource thesaurusSKOS = null; if (iter.hasNext()) { Statement s = iter.next(); thesaurusSKOS = s.getSubject().asResource(); } return thesaurusSKOS; }
Statement orgStms = iter.next(); Resource organizationRes = orgStms.getSubject() .asResource(); Statement foafName = organizationRes.getProperty(FOAF.name); Statement foafHomepage = organizationRes