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

Examples of com.hp.hpl.jena.rdf.model.Model.createStatement()


        DOCUMENT.content, model.createResource(contentURI));
    while (contentURIMatching.hasNext()) {
      Resource current = contentURIMatching.nextResource();
      if (current.hasProperty(DOCUMENT.contentType, contentType)) {
        if (target.hasProperty(DOCUMENT.variant, current)) {
          model.remove(model.createStatement(target, DOCUMENT.variant,
            current));
        } else {
          log.info(target+" has no property variant with value "+current+" but the following");
          StmtIterator stmts = target.listProperties();
          while (stmts.hasNext()) {
View Full Code Here


    Cookie cookie = new Cookie("temp_user", temporarySubject.getURI());
    cookie.setPath("/");
    setHeader(HeaderName.SET_COOKIE, cookie);
    Model model = temporarySubject.getModel();
    AddAction action = new AddAction();
    action.add(model.createStatement(temporarySubject, RDF.type, TEMPSUBJECT.TemporarySubject));
    action.add(model.createStatement(temporarySubject, DC.date, new W3CDateFormat().format(new Date())));
    ActionHandler.getActionHandler(model).addAction(action);
  }

}
View Full Code Here

    cookie.setPath("/");
    setHeader(HeaderName.SET_COOKIE, cookie);
    Model model = temporarySubject.getModel();
    AddAction action = new AddAction();
    action.add(model.createStatement(temporarySubject, RDF.type, TEMPSUBJECT.TemporarySubject));
    action.add(model.createStatement(temporarySubject, DC.date, new W3CDateFormat().format(new Date())));
    ActionHandler.getActionHandler(model).addAction(action);
  }

}
View Full Code Here

    }
    ResIterator previousStmtIter = model.listSubjectsWithProperty(
        KNOBOT.nextRelation, relation);
    if (previousStmtIter.hasNext()) {
      Resource previous = previousStmtIter.nextResource();
      model.remove(model.createStatement(previous, KNOBOT.nextRelation,
          relation));
      if (nextRelation != null) {
        previous.addProperty(KNOBOT.nextRelation, nextRelation);
      }
    } else {
View Full Code Here

      if (!sourceResIter.hasNext()) {
        throw new RuntimeException(
            "no nextRelation or firstRelation property points to the relation to be removed");
      }
      Resource source = sourceResIter.nextResource();
      model.remove(model.createStatement(source, KNOBOT.firstRelation,
          relation));
      if (nextRelation != null) {
        source.addProperty(KNOBOT.firstRelation, nextRelation);
      }
    }
View Full Code Here

              pageUrl);
        }

        // only add statements with some objects
        if (obj != null) {
          stmt = metadata.createStatement(subj, pred, obj);
          metadata.add(stmt);
        }
      } catch (Exception e) {
        // something went wrong, oops - lets better remove the offending
        // statement
View Full Code Here

        Model base = ModelFactory.createDefaultModel();
        Resource r = base.createResource(egNS + "r");
        Property p = base.createProperty(egNS + "p");
        Property q = base.createProperty(egNS + "q");
        Literal l = base.createLiteral("foo");
        Statement asserted = base.createStatement(r, p, l);
        r.addProperty(p, l);
       
        List<Rule> rules = Rule.parseRules("(?r eg:p ?v) -> (?v eg:q ?r).");
        GenericRuleReasoner reasoner = new GenericRuleReasoner(rules);
        InfModel inf = ModelFactory.createInfModel(reasoner, base);
View Full Code Here

            while (si.hasNext()) {
                Statement s = si.nextStatement();
                runningCount += 1;
                si.remove();
//                System.out.println("Rewrite " + s + " base on " + newR);
                additions.add(additions.createStatement(newR, s.getPredicate(), s.getObject()));
            }
            assertEquals( "on iteration " + count + " with " + bNode.asNode().getBlankNodeLabel(), originalCount, runningCount );
            incoming.add(additions);
            Resource ian = incoming.getResource("http://www.hp.com/people/Ian_Dickinson");
            assertTrue("Smush failed on iteration " + count, ian.hasProperty(name));
View Full Code Here

        Model model= ModelFactory.createModelForGraph(getGraph()) ;
        Resource per1 = model.createResource("urn:x:global#per1");
        Resource per2 = model.createResource("urn:x:global#per2");
        Property pred1 = model.createProperty("http://example/ns#prop1");
        Property pred2 = model.createProperty("http://example/ns#prop2") ;
        Statement s1 = model.createStatement(per1, pred1, per2);
        Statement s2 = model.createStatement(per2, pred2, per2);
       
        s1.createReifiedStatement();
        s2.createReifiedStatement();
       
View Full Code Here

        Resource per1 = model.createResource("urn:x:global#per1");
        Resource per2 = model.createResource("urn:x:global#per2");
        Property pred1 = model.createProperty("http://example/ns#prop1");
        Property pred2 = model.createProperty("http://example/ns#prop2") ;
        Statement s1 = model.createStatement(per1, pred1, per2);
        Statement s2 = model.createStatement(per2, pred2, per2);
       
        s1.createReifiedStatement();
        s2.createReifiedStatement();
       
        assertEquals(2, model.listReifiedStatements().toList().size());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.