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

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


    if (trustedSources.contains(defaultConfigSource)) {
      ensureDefaultConfigLoaded(store);
    }
    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


          Resource user = getUserByUsernameInIdentityGOT(loginData.userName);
          FCAGraph revokeGraphTmp = null;
          if (user != null) {
            log
                .info("Username already exist, removing previous password");
            Model revokeModel = ModelFactory.createDefaultModel();
            revokeModel.add(user
                .listProperties(ACCOUNTMANAGER.passwordSha1));
            revokeModel.add(user.listProperties(FOAF.mbox_sha1sum));
            revokeModel.add(user
                .listProperties(ACCOUNTMANAGER.userName));
            revokeGraphTmp = new FCAGraphImpl(revokeModel);
            // store.revokeGraph(identity, new
            // FCAGraphImpl(revokeModel), now);
          }
View Full Code Here

  /**
   * @param store
   *
   */
  private void ensureDefaultConfigLoaded(Store store) {
    Model cannedDefaultConfigModel = ModelFactory.createDefaultModel();
    URL cannedDefaultConfigURL = getClass()
        .getResource("defaultconfig.rdf");
    String cannedDefaultConfigURLString = cannedDefaultConfigURL.toString();
    try {
      InputStream cannedDefaultConfigInputStream = cannedDefaultConfigURL
          .openStream();
      cannedDefaultConfigModel.read(cannedDefaultConfigInputStream,
          cannedDefaultConfigURLString);
      cannedDefaultConfigInputStream.close();
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
    Resource cannedDefaultConfigResource = cannedDefaultConfigModel
        .getResource(cannedDefaultConfigURLString+"#");
    Statement cannedVersionDateStmt = cannedDefaultConfigResource
        .getRequiredProperty(DC.date);
    final Date cannedVersionDate = ((XSDDateTime) cannedVersionDateStmt
        .getLiteral().getValue()).asCalendar().getTime();
View Full Code Here

   * @param username
   * @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();
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();
View Full Code Here

    resultBuffer.append("/user/");
    resultBuffer.append(userName);
    // resultBuffer.append('#');
    String result = resultBuffer.toString();
    Model creationModel = ModelFactory.createDefaultModel();
    creationModel.createResource(result).addProperty(RDFS.comment,
        "login Link sent at " + new Date());
    store.assertGraph(new SourceImpl(result), new FCAGraphImpl(
        creationModel));
    return result;
  }
View Full Code Here

   * @param now
   * @return
   */
  private static Set<Source> getDueSources(Graph currentConfiguration,
      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();
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;
View Full Code Here

    } catch (MalformedURLException e) {
      throw new RuntimeException(e);
    }
    Date now = new Date();

    Model logEntryModel = ModelFactory.createDefaultModel();
    Resource downloadAttempt = logEntryModel
        .createResource(AGGREGATOR.DownloadAttempt);
    downloadAttempt.addProperty(AGGREGATOR.time, new W3CDateFormat()
        .format(now), XSDDatatype.XSDdateTime);
    downloadAttempt.addProperty(AGGREGATOR.aggregatedSource, logEntryModel
        .createResource(aggregatedSource.getURIRef()));
    downloadAttempt.addProperty(AGGREGATOR.aggregator, logEntryModel
        .createResource(identity.getURIRef()));
    Graph logEntryGraph = JenaUtil.getGraphFromModel(logEntryModel, true);
    final StringWriter aggregationWarningWriter = new StringWriter();
    final StringWriter aggregationErrorWriter = new StringWriter();
    try {
      Model model = ModelFactory.createDefaultModel();
      // model.read(url.toString());
      JenaReader jenaReader = new JenaReader();
      jenaReader.setErrorHandler(new RDFErrorHandler() {

        public void error(Exception e) {
View Full Code Here

  /**
   * @param moleculeStore
   * @param string
   */
  private void addData(MoleculeStore moleculeStore, String modelName) {
    Model model = ModelFactory.createDefaultModel();
    model.read(StoreTest.class.getResource(modelName).toString());
    Graph graph = JenaUtil.getGraphFromModel(model , true);
    ModelReferencingDecomposition modelReferencingDecomposition = new ModelReferencingDecompositionImpl(graph);
    ReferenceGroundedDecomposition dec = new ReferenceGroundedDecompositionImpl(modelReferencingDecomposition);
    for (FunctionallyGroundedNode fgNode : dec.getFunctionallyGroundedNodes()) {
      moleculeStore.addFunctionallyGroundedNode(fgNode);
View Full Code Here

TOP

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

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.