private List<VCard> parseAddressBook(Resource selfResource, SolidUtilities utilities) throws IOException { String peopleUri = selfResource.getProperty(NAME_EMAIL_INDEX_PROPERTY).getResource().getURI(); Model peopleModel = utilities.getModel(peopleUri); List<VCard> vcards = new ArrayList<>(); ResIterator subjects = peopleModel.listSubjects(); while (subjects.hasNext()) { Resource subject = subjects.nextResource(); Model personModel = utilities.getModel(subject.getURI()); Resource personResource = SolidUtilities.getResource(subject.getURI(), personModel); if (personResource == null) { throw new IllegalStateException(subject.getURI() + " not found in " + subject.toString()); } vcards.add(parsePerson(personResource)); } return vcards; }
@Override public boolean hasNext() { if (modelListSubjects().hasNext()) codeCoverage[7]++; return false; } }, backStop };
@Override public boolean hasNext() { if (modelListSubjects().hasNext()) codeCoverage[7]++; return false; } }, backStop };
/** * 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; }
/** * 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; } }
/** * 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; }
private static Resource[] subjectsTypes(Model model) { Set<Resource> types = new HashSet<>(); ResIterator rs = model.listSubjects(); while (rs.hasNext()) { Resource r = rs.nextResource(); Statement s = type(r); if (s != null) { types.add(s.getObject().asResource()); } } return types.toArray(new Resource[0]); }
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; }
protected void writeRDFStatements( Model model, PrintWriter writer ) { ResIterator rIter = model.listSubjects(); while (rIter.hasNext()) writeRDFStatements( model, rIter.nextResource(), writer ); }
protected void writeRDFStatements( Model model, PrintWriter writer ) { ResIterator rIter = model.listSubjects(); while (rIter.hasNext()) writeRDFStatements( model, rIter.nextResource(), writer ); }
private Set<String> findRootIdentifiers(Model model, TypeConfig targetName) { Set<String> identifiers = new HashSet<>(); Model currentmodel = ModelFactory.createDefaultModel(); Resource res = currentmodel.createResource(targetName.getId()); Property property = currentmodel.createProperty(RDF_TYPE); ResIterator iterator = model.listResourcesWithProperty(property, res); while (iterator.hasNext()) { identifiers.add(iterator.nextResource().toString()); } return identifiers; }
private Set<String> findRootIdentifiers(Model model, TypeConfig targetName) { Set<String> identifiers = new HashSet<>(); Model currentmodel = ModelFactory.createDefaultModel(); Resource res = currentmodel.createResource(targetName.getId()); Property property = currentmodel.createProperty(RDF_TYPE); ResIterator iterator = model.listResourcesWithProperty(property, res); while (iterator.hasNext()) { identifiers.add(iterator.nextResource().toString()); } return identifiers; }
/** * Get the won node URI from a {@link Dataset} * * @param ds Dataset which holds won node information * @return */ private String getWonNodeUriFromDataset(Dataset ds) { if (ds.listNames().hasNext()) { Model model = ds.getNamedModel(ds.listNames().next()); if (model.listSubjectsWithProperty(WON.HAS_URI_PATTERN_SPECIFICATION).hasNext()) { return model.listSubjectsWithProperty(WON.HAS_URI_PATTERN_SPECIFICATION).nextResource().toString(); } } return null; }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }
private Individual getCountry(String countryCode) { ResIterator hasCountryCode = getCountries().listSubjectsWithProperty(Geonames.countryCode, countryCode); if (hasCountryCode.hasNext()) { return getCountries().getIndividual(hasCountryCode.next().getURI()); } return null; }
/** * Report of functor literals leaking out of inference graphs and raising CCE * in iterators. */ public void testFunctorCCE() { Model base = ModelFactory.createDefaultModel(); base.read("file:testing/reasoners/bugs/cceTest.owl"); InfModel test = ModelFactory.createInfModel(ReasonerRegistry.getOWLReasoner(), base); // boolean b = anyInstancesOfNothing(test); ResIterator rIter = test.listSubjects(); while (rIter.hasNext()) { // Resource res = rIter.nextResource(); } }