Package com.hp.hpl.jena.rdf.model

Examples of com.hp.hpl.jena.rdf.model.ResIterator


    }
    Graph serviceConfig = store.getGraphOverTime(trustedSources).getGraph(
        new Date());
    Model serviceConfigModel = JenaUtil.getModelFromGraph(serviceConfig);
    serviceConfigModel.write(System.out);
    ResIterator servicesIter = serviceConfigModel.listSubjectsWithProperty(RDF.type, SERVICES.Service);
    while (servicesIter.hasNext()) {
      try {
        launchService(store, servicesIter.nextResource());
      } catch (Exception e) {
        log.error("Error launching service", e);
      }
    }
View Full Code Here


   * @return
   */
  private Resource getUserByUsername(String username) {
    Graph graph = configGOT.getGraph(new Date());
    Model model = JenaUtil.getModelFromGraph(graph);
    ResIterator subjectIter = model.listSubjectsWithProperty(
        ACCOUNTMANAGER.userName, username);
    if (!subjectIter.hasNext()) {
      return null;
    }
    Resource subject = subjectIter.nextResource();
    if (subjectIter.hasNext()) {
      throw new RuntimeException("Username ambiguos");
    }
    return subject;
  }
View Full Code Here

  private Resource getUserByUsernameInIdentityGOT(String username) {
    Graph graph = store.getGraphOverTime(Collections.singleton(identity))
        .getGraph(new Date());
    Model model = JenaUtil.getModelFromGraph(graph);
    ResIterator subjectIter = model.listSubjectsWithProperty(
        ACCOUNTMANAGER.userName, username);
    if (!subjectIter.hasNext()) {
      return null;
    }
    Resource subject = subjectIter.nextResource();
    if (subjectIter.hasNext()) {
      throw new RuntimeException("Username ambiguos");
    }
    return subject;
  }
View Full Code Here

      Graph currentLog, Date now) {
    Model configurationModel = JenaUtil
        .getModelFromGraph(currentConfiguration);
    Model logModel = JenaUtil.getModelFromGraph(currentLog);
    Set<Source> result = new HashSet<Source>();
    ResIterator sourceIter = configurationModel.listSubjectsWithProperty(
        RDF.type, AGGREGATOR.AggregatedSource);
    while (sourceIter.hasNext()) {
      Resource aggregatedSource = sourceIter.nextResource();
      Date lastAggregation = getLastAggregationDate((Resource) aggregatedSource
          .inModel(logModel));
      if (lastAggregation == null) {
        result.add(new SourceImpl(aggregatedSource.getURI()));
      } else {
View Full Code Here

   * @param node
   * @return the Date of the last AggragationAttempt or null if none exist
   */
  private static Date getLastAggregationDate(Resource aggregatedSource) {
    Model model = aggregatedSource.getModel();
    ResIterator downloadAttempts = model
        .listSubjectsWithProperty(AGGREGATOR.aggregatedSource, aggregatedSource);
    Date result = null;
    while (downloadAttempts.hasNext()) {
      Resource downloadAtttempt = downloadAttempts.nextResource();
      Date time;
      try {
        time = new W3CDateFormat().parse(downloadAtttempt.getProperty(
            AGGREGATOR.time).getString());
      } catch (ParseException e) {
View Full Code Here

    Set<String> result = new HashSet<String>();
    try {
      URL sourcesURL = new URL(remoteService, "/meta/sources");
      Model sourcesModel = ModelFactory.createDefaultModel();
      sourcesModel.read(sourcesURL.toString());
      ResIterator sourcesIter = sourcesModel.listSubjectsWithProperty(
          RDF.type, METAMODEL.Source);
      while (sourcesIter.hasNext()) {
        result.add(sourcesIter.nextResource().getURI());
      }
    } catch (MalformedURLException e) {
      throw new RuntimeException(e);
    }
    return result;
View Full Code Here

          }
        }
      }

      private void addURIsForType(Model model, OntClass type) {
        ResIterator subjectIter = model.listSubjectsWithProperty(
            RDF.type, type);
        // model.write(System.out);
        while (subjectIter.hasNext()) {
          Resource infoDiscoResource = subjectIter.nextResource();
          RDFNode infoBitNode = infoDiscoResource.getProperty(
              DISCOBITS.infoBit).getObject();
          if (infoBitNode instanceof Literal) {
            final Literal literaInfoBit = (Literal) infoBitNode;
            infoDiscoBitURIs.put(infoDiscoResource.getURI(),
View Full Code Here

        .getProperty(LdapMap.attribute).getLiteral().getString();
  }

  private Resource getSubject(Property property, RDFNode object)
  {
    ResIterator found = config.listSubjectsWithProperty(property, object);
    if (!found.hasNext())
      return null;
    Resource foundSubject = found.nextResource();
    found.close();
    return foundSubject;
  }
View Full Code Here

   * Initialise from config model. Generates the Col, Table, Database representation.
   * @throws ConfigException
   */
  private void initFromConfigModel() throws ConfigException
  {
    ResIterator ri = configModel.listSubjectsWithProperty(RDF.type, DbMap.Map);
   
    if (!ri.hasNext())
      throw new ConfigException("No map in config file");
   
    this.map = ri.nextResource();
    if (ri.hasNext())
      log.warn("There is more than one map in the config file");
   
    StmtIterator si = map.listProperties(DbMap.mapsClass);
    while (si.hasNext())
    {
View Full Code Here

   
    Database database = getDatabase(db);
       
    Table table = new Table(aClass, database);
    class2table.put(aClass, table);
    ResIterator ri = aClass.getModel().listSubjectsWithProperty(RDFS.domain, aClass);
    while (ri.hasNext())
    {
      Resource prop = ri.nextResource();
      Col col = new Col(prop, table);
      prop2col.put(prop, col);
    }
    StmtIterator si = aClass.listProperties(DbMap.primaryKey);
    while (si.hasNext())
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.rdf.model.ResIterator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.