本文整理了Java中org.apache.jena.rdf.model.ResIterator.next
方法的一些代码示例,展示了ResIterator.next
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ResIterator.next
方法的具体详情如下:
包路径:org.apache.jena.rdf.model.ResIterator
类名称:ResIterator
方法名:next
暂无
代码示例来源:origin: io.github.luzzu/luzzu-annotations
/**
* Checks if a dimension uri exists in the metadata
*
* @param dimensionType - The URI of the Dimension Type
* @return The URI if exists or null
*/
private Resource dimensionExists(Resource dimensionType){
ResIterator resIte = this.metadata.listSubjectsWithProperty(RDF.type, dimensionType);
if (resIte.hasNext()){
return resIte.next();
}
return null;
}
代码示例来源:origin: io.github.luzzu/luzzu-annotations
/**
* Checks if a category uri exists in the metadata
*
* @param categoryType - The URI of the Category Type
* @return The URI if exists or null
*/
private Resource categoryExists(Resource categoryType){
ResIterator resIte = this.metadata.listSubjectsWithProperty(RDF.type, categoryType);
if (resIte.hasNext()){
return resIte.next();
}
return null;
}
代码示例来源:origin: io.github.luzzu/luzzu-annotations
/**
* Checks if a metric uri exists in the metadata
*
* @param metricType - The URI of the Metric Type
* @return The URI if exists or null
*/
private Resource metricExists(Resource metricType){
ResIterator resIte = this.metadata.listSubjectsWithProperty(RDF.type, metricType);
if (resIte.hasNext()){
return resIte.next();
}
return null;
}
}
代码示例来源:origin: at.researchstudio.sat/won-utils-conversation
public Set<URI> getPendingCancellationProposalUris(){
Model cancellations = pendingProposals.getDefaultModel();
if (cancellations == null) {
return Collections.EMPTY_SET;
}
Set ret = new HashSet<URI>();
ResIterator it = cancellations.listSubjectsWithProperty(WONAGR.PROPOSES_TO_CANCEL);
while(it.hasNext()) {
String uri = it.next().asResource().getURI();
ret.add(URI.create(uri));
}
return ret;
}
代码示例来源:origin: at.researchstudio.sat/won-core
/**
* searches for a subject of type won:Need and returns the NeedURI
*
* @param model <code>Model</code> object which will be searched for the NeedURI
* @return <code>URI</code> which is of type won:Need
*/
public static Resource getNeedResource(Model model) {
List<Resource> needURIs = new ArrayList<>();
ResIterator iterator = model.listSubjectsWithProperty(RDF.type, WON.NEED);
while (iterator.hasNext()) {
needURIs.add(iterator.next());
}
if (needURIs.size() == 0)
return null;
else if (needURIs.size() == 1)
return needURIs.get(0);
else if (needURIs.size() > 1) {
Resource u = needURIs.get(0);
for (Resource uri : needURIs) {
if (!uri.equals(u))
throw new IncorrectPropertyCountException(1,2);
}
return u;
}
else
return null;
}
代码示例来源:origin: apache/jena
public static Resource getResourceByType(Model model, Resource type) {
ResIterator sIter = model.listSubjectsWithProperty(RDF.type, type) ;
if ( !sIter.hasNext() )
return null ;
Resource r = sIter.next();
if ( sIter.hasNext() )
throw new TypeNotUniqueException(r) ;
return r ;
}
代码示例来源:origin: apache/juneau
private List<Resource> getRoots(Model m) {
List<Resource> l = new LinkedList<>();
// First try to find the root using the "http://www.apache.org/juneau/root" property.
Property root = m.createProperty(getJuneauNs().getUri(), RDF_juneauNs_ROOT);
for (ResIterator i = m.listResourcesWithProperty(root); i.hasNext();)
l.add(i.next());
if (! l.isEmpty())
return l;
// Otherwise, we need to find all resources that aren't objects.
// We want to explicitly ignore statements where the subject
// and object are the same node.
Set<RDFNode> objects = new HashSet<>();
for (StmtIterator i = m.listStatements(); i.hasNext();) {
Statement st = i.next();
RDFNode subject = st.getSubject();
RDFNode object = st.getObject();
if (object.isResource() && ! object.equals(subject))
objects.add(object);
}
for (ResIterator i = m.listSubjects(); i.hasNext();) {
Resource r = i.next();
if (! objects.contains(r))
l.add(r);
}
return l;
}
代码示例来源:origin: SmartDataAnalytics/DL-Learner
public Set<String> difference(Set<String> alreadyQueriedIndividuals, OntModel model) {
Set<String> candidates = new HashSet<>();
Set<String> result = new HashSet<>();
for (ResIterator it = model.listSubjects(); it.hasNext(); ) {
candidates.add(it.next().getURI());
}
for (NodeIterator it = model.listObjects(); it.hasNext(); ) {
RDFNode cur = it.next();
if (cur.isURIResource() && !cur.isAnon()) {
candidates.add(((Resource) cur).getURI());
}
}
for (String candidate : candidates) {
if (!alreadyQueriedIndividuals.contains(candidate)) {
// System.out.println(candidate);
result.add(candidate);
}
}
return result;
}
代码示例来源:origin: org.apache.jena/jena-core
/**
* Return a list of all test names defined in the manifest for this test harness.
*/
public List<String> listTests() {
List<String> testList = new ArrayList<>();
ResIterator tests = testManifest.listResourcesWithProperty(RDF.type, testClass);
while (tests.hasNext()) {
testList.add(tests.next().toString());
}
return testList;
}
代码示例来源:origin: apache/jena
/**
* Return a list of all test names defined in the manifest for this test harness.
*/
public List<String> listTests() {
List<String> testList = new ArrayList<>();
ResIterator tests = testManifest.listResourcesWithProperty(RDF.type, testClass);
while (tests.hasNext()) {
testList.add(tests.next().toString());
}
return testList;
}
代码示例来源:origin: ORCID/ORCID-Source
private Individual getCountry(String countryCode) {
ResIterator hasCountryCode = getCountries().listSubjectsWithProperty(Geonames.countryCode, countryCode);
if (hasCountryCode.hasNext()) {
return getCountries().getIndividual(hasCountryCode.next().getURI());
}
return null;
}
代码示例来源:origin: apache/jena
/**
* Return a list of all test names defined in the manifest for this test harness.
*/
public List<String> listTests() {
List<String> testList = new ArrayList<>();
ResIterator tests = testManifest.listResourcesWithProperty(RDF.type, PositiveEntailmentTest);
while (tests.hasNext()) {
testList.add(tests.next().toString());
}
tests = testManifest.listResourcesWithProperty(RDF.type, NegativeEntailmentTest);
while (tests.hasNext()) {
testList.add(tests.next().toString());
}
return testList;
}
代码示例来源:origin: org.apache.jena/jena-core
/**
* Return a list of all test names defined in the manifest for this test harness.
*/
public List<String> listTests() {
List<String> testList = new ArrayList<>();
ResIterator tests = testManifest.listResourcesWithProperty(RDF.type, PositiveEntailmentTest);
while (tests.hasNext()) {
testList.add(tests.next().toString());
}
tests = testManifest.listResourcesWithProperty(RDF.type, NegativeEntailmentTest);
while (tests.hasNext()) {
testList.add(tests.next().toString());
}
return testList;
}
代码示例来源:origin: at.researchstudio.sat/won-core
/**
* get the node of the need of either the need model or the sysinfo model
*
* @param graph type specifies the need or sysinfo need node to return
* @return need or sysinfo need node
*/
protected Resource getNeedNode(NeedGraphType graph) {
if (graph.equals(NeedGraphType.NEED) && getNeedModel() != null) {
ResIterator iter = getNeedModel().listSubjectsWithProperty(RDF.type, WON.NEED);
if (iter.hasNext()) {
return iter.next();
}
} else if (graph.equals(NeedGraphType.SYSINFO) && getSysInfoModel() != null) {
ResIterator iter = getSysInfoModel().listSubjectsWithProperty(RDF.type, WON.NEED);
if (iter.hasNext()) {
return iter.next();
}
}
return null;
}
代码示例来源:origin: io.github.luzzu/luzzu-annotations
/**
* Used when the assessed dataset is stored in memory
* (Jena Dataset),
*
* @param dataset - Assessed Jena Dataset
* @param computedOn - The resource indicating the metrics computed on
*/
public QualityMetadata(Dataset dataset, Resource computedOn){
this.computedOn = computedOn;
ResIterator qualityGraphRes = dataset.getDefaultModel().listSubjectsWithProperty(RDF.type, DAQ.QualityGraph);
if (qualityGraphRes.hasNext()){
this.qualityGraph = qualityGraphRes.next();
this.metadata.add(dataset.getNamedModel(this.qualityGraph.getURI()));
this.metadataPresent = true;
} else {
this.qualityGraph = ResourceCommons.generateURI();
}
}
代码示例来源:origin: at.researchstudio.sat/won-core
if (!needIt.hasNext()) throw new IllegalArgumentException("at least one RDF node must be of type won:Need");
Resource needRes = needIt.next();
logger.debug("processing need resource {}", needRes.getURI());
代码示例来源:origin: at.researchstudio.sat/won-core
public static Resource findOneSubjectResource(Model model, Property property, RDFNode object) {
Resource resource = null;
ResIterator iter = model.listSubjectsWithProperty(property, object);
while (iter.hasNext()) {
resource = iter.next();
if (iter.hasNext()) {
throw new IncorrectPropertyCountException("expecting exactly one subject resource for property "
+ property.getURI() + " and object " + object.toString(), 1, 2);
}
}
if (resource == null) {
throw new IncorrectPropertyCountException("expecting exactly one subject resource for property "
+ property.getURI() + " and object " + object.toString(), 1, 0);
}
return resource;
}
代码示例来源:origin: org.apache.jena/jena-core
public void testListSubjectsNoRemove()
{
final Model m = ModelHelper.modelWithStatements(this,
"a P b; b Q c; c R a");
final ResIterator it = m.listSubjects();
it.next();
try
{
it.remove();
Assert.fail("listSubjects should not support .remove()");
}
catch (final UnsupportedOperationException e)
{
JenaTestBase.pass();
}
}
代码示例来源:origin: apache/jena
public void testListSubjectsNoRemove()
{
final Model m = ModelHelper.modelWithStatements(this,
"a P b; b Q c; c R a");
final ResIterator it = m.listSubjects();
it.next();
try
{
it.remove();
Assert.fail("listSubjects should not support .remove()");
}
catch (final UnsupportedOperationException e)
{
JenaTestBase.pass();
}
}
代码示例来源:origin: ontopia/ontopia
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);
}
}
}
}
内容来源于网络,如有侵权,请联系作者删除!