本文整理汇总了Java中com.hp.hpl.jena.rdf.model.ResIterator.next方法的典型用法代码示例。如果您正苦于以下问题:Java ResIterator.next方法的具体用法?Java ResIterator.next怎么用?Java ResIterator.next使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.hp.hpl.jena.rdf.model.ResIterator
的用法示例。
在下文中一共展示了ResIterator.next方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getClasses
import com.hp.hpl.jena.rdf.model.ResIterator; //导入方法依赖的package包/类
protected Set<Resource> getClasses(Model readModel) {
ResIterator iterator = readModel.listSubjectsWithProperty(RDF.type, RDFS.Class);
Resource r;
Set<Resource> classes = new HashSet<Resource>();
while (iterator.hasNext()) {
r = iterator.next();
if (!r.isAnon()) {
classes.add(r);
}
}
iterator = readModel.listSubjectsWithProperty(RDF.type, OWL.Class);
while (iterator.hasNext()) {
r = iterator.next();
if (!r.isAnon()) {
classes.add(r);
}
}
return classes;
}
示例2: fetchLabels
import com.hp.hpl.jena.rdf.model.ResIterator; //导入方法依赖的package包/类
private void fetchLabels(Model m)
{
Map<String,String> map = new HashMap();
Property p = m.getProperty(SKOS_PREF_LABEL);
ResIterator rIter = m.listResourcesWithProperty(m.getProperty(RDF_TYPE));
while ( rIter.hasNext() )
{
Resource r = rIter.next();
fetchAlternatives(map, r);
StmtIterator sIter = r.listProperties(p);
while ( sIter.hasNext() )
{
Statement stmt = sIter.next();
put(stmt.getSubject(), getKey(stmt.getString(), map));
}
map.clear();
}
}
示例3: analyse
import com.hp.hpl.jena.rdf.model.ResIterator; //导入方法依赖的package包/类
public ObjectStat analyse(File srcList, File src, File dst) throws IOException
{
Collection<String> c = loadDataURLs(srcList, PATTERN_LEXVO);
Model m = ModelFactory.createDefaultModel();
loadModel(m, src, null);
ObjectStat stat = new ObjectStat("Lexvo", true, false, true);
stat.addPropertyValue(m.getProperty("http://www.w3.org/2008/05/skos-xl#literalForm"));
ResIterator iter = m.listSubjects();
while ( iter.hasNext() )
{
Resource r = iter.next();
if ( !c.contains(r.getURI()) ) { continue; }
stat.newObject(r);
}
if ( dst != null ) { stat.print(new PrintStream(dst, "UTF-8")); }
return stat;
}
示例4: analyse
import com.hp.hpl.jena.rdf.model.ResIterator; //导入方法依赖的package包/类
public ObjectStat analyse(File srcList, File src, File dst) throws IOException
{
Collection<String> c = loadDataURLs(srcList, PATTERN_BABELNET);
Model m = ModelFactory.createDefaultModel();
loadModel(m, src, null);
ObjectStat stat = new ObjectStat("BabelNet", true, false, true);
stat.addPropertyValue(m.getProperty("http://babelnet.org/model/babelnet#gloss"));
ResIterator iter = m.listSubjects();
while ( iter.hasNext() )
{
Resource r = iter.next();
if ( !c.contains(r.getURI()) ) { continue; }
stat.newObject(r);
}
if ( dst != null ) { stat.print(new PrintStream(dst, "UTF-8")); }
return stat;
}
示例5: analyse
import com.hp.hpl.jena.rdf.model.ResIterator; //导入方法依赖的package包/类
public ObjectStat analyse(File srcList, File src, File dst) throws IOException
{
Collection<String> c = loadDataURLs(srcList, PATTERN_FREEBASE);
Model m = ModelFactory.createDefaultModel();
loadModel(m, src, null);
ObjectStat stat = new ObjectStat("Freebase", true, false, true);
stat.addPropertyValue(m.getProperty("http://www.w3.org/2000/01/rdf-schema#label"));
ResIterator iter = m.listSubjects();
while ( iter.hasNext() )
{
Resource r = iter.next();
if ( !c.contains(r.getURI()) ) { continue; }
stat.newObject(r);
}
if ( dst != null ) { stat.print(new PrintStream(dst, "UTF-8")); }
return stat;
}
示例6: analyse
import com.hp.hpl.jena.rdf.model.ResIterator; //导入方法依赖的package包/类
public ObjectStat analyse(File srcList, File src, File dst) throws IOException
{
Collection<String> c = loadDataURLs(srcList, PATTERN_EUROVOC);
Model m = ModelFactory.createDefaultModel();
loadModel(m, src, null);
ObjectStat stat = new ObjectStat("Eurovoc", true, false, true);
stat.addPropertyValue(m.getProperty("http://www.w3.org/2004/02/skos/core#prefLabel"));
stat.addPropertyValue(m.getProperty("http://www.w3.org/2004/02/skos/core#altLabel"));
ResIterator iter = m.listSubjects();
while ( iter.hasNext() )
{
Resource r = iter.next();
if ( !c.contains(r.getURI()) ) { continue; }
stat.newObject(r);
}
if ( dst != null ) { stat.print(new PrintStream(dst, "UTF-8")); }
return stat;
}
示例7: enrichImpl
import com.hp.hpl.jena.rdf.model.ResIterator; //导入方法依赖的package包/类
private void enrichImpl(ResIterator iter, CSVWriter p)
{
while (iter.hasNext())
{
Resource rsrc = iter.next();
System.out.print("Enriching resource: " + rsrc.getURI());
List<Map> l = _api.enrich(rsrc);
if ( l == null ) { System.out.println(); continue; }
int count = 0;
for ( Map m : l )
{
count++;
p.print(rsrc.getURI(), m.get("field")
, m.get("enrichment"), "", m.get("value"));
}
System.out.println(" [" + count + "]");
}
}
示例8: getGroups
import com.hp.hpl.jena.rdf.model.ResIterator; //导入方法依赖的package包/类
protected HashMap<String, Group> getGroups(Resource groupType) {
HashMap<String, Group> groups = new HashMap<>();
ResIterator i = model.listSubjectsWithProperty(RDF.type, groupType);
while (i.hasNext()) {
Resource resource = i.next();
try {
groups.put(getId(resource), getGroup(resource));
}
catch (NoUnitException | MalformedOntologyException
| UnrecogniedUnitException | EmptyDimensionException | NotFoundException e
) {
log.error("Unable to load group " + resource.getURI() + ": " + e.getMessage());
}
}
return groups;
}
示例9: getObjectsOfType
import com.hp.hpl.jena.rdf.model.ResIterator; //导入方法依赖的package包/类
public static List<String> getObjectsOfType(Model model, String uri) {
List<String> policies = new ArrayList();
ResIterator it = model.listSubjectsWithProperty(RDF.type);
while (it.hasNext()) {
Resource res = it.next();
Statement s = res.getProperty(RDF.type);
String objeto = s.getObject().asResource().getURI();
if (s.getObject().isURIResource()) {
String sujeto = s.getSubject().getURI();
String ouri = s.getObject().asResource().getURI();
if (uri.equals(ouri)) {
policies.add(sujeto);
}
}
}
return policies;
}
示例10: ToscaAdapter
import com.hp.hpl.jena.rdf.model.ResIterator; //导入方法依赖的package包/类
public ToscaAdapter( Model adapterTBox, Resource adapterABox, ToscaMDBSender sender) {
this.sender = sender;
this.uuid = UUID.randomUUID().toString();
this.adapterTBox = adapterTBox;
this.adapterABox = adapterABox;
Resource adapterType = null;
ResIterator adapterIterator = adapterTBox.listSubjectsWithProperty(RDFS.subClassOf, MessageBusOntologyModel.classAdapter);
if (adapterIterator.hasNext()) {
adapterType = adapterIterator.next();
}
this.adapterABox.addProperty(RDF.type, adapterType);
this.adapterABox.addProperty(RDFS.label, adapterABox.getLocalName());
this.adapterABox.addProperty(RDFS.comment, "An adapter for TOSCA-compliant resources");
Resource testbed = adapterABox.getModel().createResource("http://federation.av.tu-berlin.de/about#AV_Smart_Communication_Testbed");
this.adapterABox.addProperty(Omn_federation.partOfFederation, testbed);
}
示例11: updateInstances
import com.hp.hpl.jena.rdf.model.ResIterator; //导入方法依赖的package包/类
public Model updateInstances(Model model) throws InvalidRequestException, ProcessingException {
Model updatedInstancesModel = null;
try{
updatedInstancesModel = super.updateInstances(model);
} catch(InstanceNotFoundException e){
LOGGER.log(Level.INFO, "No resource instances found, looking for topologies..");
}
ResIterator resourceInstanceIterator = model.listSubjectsWithProperty(RDF.type, Omn.Topology);
while(resourceInstanceIterator.hasNext()){
Resource resourceInstance = resourceInstanceIterator.next();
LOGGER.log(Level.INFO, "Updating adapterABox: " + resourceInstance);
Model updatedModel = updateInstance(resourceInstance.getURI(), model);
updatedInstancesModel.add(updatedModel);
}
return updatedInstancesModel;
}
示例12: indexSKOSModel
import com.hp.hpl.jena.rdf.model.ResIterator; //导入方法依赖的package包/类
/**
* Creates the synonym index
*
* @throws IOException
*/
private void indexSKOSModel() throws IOException {
IndexWriterConfig cfg = new IndexWriterConfig(matchVersion, analyzer);
IndexWriter writer = new IndexWriter(indexDir, cfg);
writer.getConfig().setRAMBufferSizeMB(48);
/* iterate SKOS concepts, create Lucene docs and add them to the index */
ResIterator concept_iter = skosModel.listResourcesWithProperty(RDF.type,
SKOS.Concept);
while (concept_iter.hasNext()) {
Resource skos_concept = concept_iter.next();
Document concept_doc = createDocumentsFromConcept(skos_concept);
if (concept_doc != null) {
writer.addDocument(concept_doc);
}
}
writer.close();
}
示例13: checkForSpuriousTypes
import com.hp.hpl.jena.rdf.model.ResIterator; //导入方法依赖的package包/类
private void checkForSpuriousTypes() {
// This doesn't catch spurious subclass triples, e.g., rr:SubjectMap,
// rr:R2RMLView.
for (ComponentType type: ComponentType.values()) {
ResIterator it = model.listResourcesWithProperty(RDF.type, type.asResource());
while (it.hasNext()) {
Resource r = it.next();
if (mapping.getMappingComponent(r, type) == null) {
report.report(Problem.SPURIOUS_TYPE, r, RDF.type, type.asResource());
}
}
}
remainingTriples.removeAll(null, RDF.type, (RDFNode) null);
}
示例14: generatePartitions
import com.hp.hpl.jena.rdf.model.ResIterator; //导入方法依赖的package包/类
private static Set<Resource> generatePartitions(Model m, Resource type,
Property p) {
Set<Resource> partitions = new HashSet<Resource>();
ResIterator classIt = m.listResourcesWithProperty(RDF.type, type);
while (classIt.hasNext()) {
Resource classMap = classIt.next();
StmtIterator pIt = classMap.listProperties(p);
while (pIt.hasNext()) {
partitions.add((Resource) pIt.next().getObject());
}
}
return partitions;
}
示例15: doConversion
import com.hp.hpl.jena.rdf.model.ResIterator; //导入方法依赖的package包/类
private void doConversion(Model model) throws JenaException {
StatementHandler totm = new ToTMStatementHandler();
AResourceWrapper subjw = new AResourceWrapper();
AResourceWrapper propw = new AResourceWrapper();
AResourceWrapper objtw = new AResourceWrapper();
ALiteralWrapper litlw = new ALiteralWrapper();
ResIterator it = model.listSubjects();
while (it.hasNext()) {
Resource subject = (Resource) it.next();
StmtIterator it2 = subject.listProperties(); // get all statements
while (it2.hasNext()) {
Statement stmt = (Statement) it2.next();
subjw.resource = stmt.getSubject();
propw.resource = stmt.getPredicate();
RDFNode obj = stmt.getObject();
if (obj instanceof Resource) {
objtw.resource = (Resource) obj;
totm.statement(subjw, propw, objtw);
} else {
litlw.literal = (Literal) obj;
totm.statement(subjw, propw, litlw);
}
}
}
}