Package org.wymiwyg.commons.util.text

Examples of org.wymiwyg.commons.util.text.W3CDateFormat


    model.enterCriticalSection(ModelLock.WRITE);
    try {
      comment = relation.getProperty(KNOBOT.target).getResource();
      if (!comment.hasProperty(DC.date)) {
        Literal currentDate = importing.createTypedLiteral(
            new W3CDateFormat().format(new Date()),
            XSDDatatype.XSDdateTime);
        comment.addProperty(DC.date, currentDate);
      }
      Statement makerStmt = comment.getProperty(FOAF.maker);
      if (makerStmt != null) {
        Resource maker = makerStmt.getResource();
        Statement mboxStmt = maker.getProperty(FOAF.mbox);
        if (mboxStmt != null) {
          Resource mbox = mboxStmt.getResource();
          Resource user = VirtuserHandler.getSubject();
          ;
          ResIterator existingAgents = model
              .listSubjectsWithProperty(FOAF.mbox, mbox);
          if (existingAgents.hasNext()) {
            Resource agent = existingAgents.nextResource();
            if (agent.hasProperty(AUTHORIZATION.pass_sha1sum)
                && !agent.equals(user)) {
              throw new AccessControlException(
                  "Posting comment with exiting users mailbox");
            }
            // remove statements othe than mbox:
            Collection removingStmt = new ArrayList();
            StmtIterator makerProperties = maker.listProperties();
            while (makerProperties.hasNext()) {
              Statement current = (Statement) makerProperties
                  .nextStatement();
              if (current.getPredicate().equals(FOAF.mbox)
                  && current.getObject().equals(mbox)) {
                continue;
              }
              if (current.getPredicate().equals(FOAF.name)) {
                RDFNode currentNameObject = current.getObject();
                if (!agent.hasProperty(FOAF.name,
                    currentNameObject)) {
                  comment.addProperty(DC.creator,
                      currentNameObject);
                }
              }

              removingStmt.add(current);
            }
            makerProperties.close();
            for (Iterator iter = removingStmt.iterator(); iter
                .hasNext();) {
              Statement current = (Statement) iter.next();
              current.remove();
            }
          }
          if (existingAgents.hasNext()) {
            log.warn("duplicate agent with " + mbox);
          }
          existingAgents.close();
        }
      }
      relation.addProperty(KNOBOT.strength, model.createTypedLiteral(1f));
      relation.addProperty(KNOBOT.childStrength, model.createTypedLiteral(0.5f));
      Literal effectiveDateLiteral = model.createTypedLiteral(
          new W3CDateFormat().format(new Date()),
          XSDDatatype.XSDdateTime);
      relation.addProperty(KNOBOT.effectiveDate, effectiveDateLiteral);
      relation.addProperty(KNOBOT.strengthReduction, model.createTypedLiteral(DefaultValuesHandler
          .getDefaultStrengthReduction(model)));
      Statement titleStatement = comment.getProperty(RSS.title);
View Full Code Here


    Model model = ModelFactory.createDefaultModel();
    Resource result = model.createResource(KNOBOT.Relation);
    result.addProperty(KNOBOT.source, getSource());
    result.addProperty(KNOBOT.target, getTarget());
    result.addProperty(KNOBOT.strength, model.createTypedLiteral(getCurrentStrength()));
    Literal effectiveDateLiteral = model.createTypedLiteral(new W3CDateFormat()
                .format(new Date()), XSDDatatype.XSDdateTime);
    result.addProperty(KNOBOT.effectiveDate, effectiveDateLiteral);
    //result.addProperty(KNOBOT.effectiveDate, System.currentTimeMillis()); //!!getEffectiveDate());
    result.addProperty(KNOBOT.strengthReduction, model.createTypedLiteral(getStrengthReduction()));
    //if (getComparativeStrength() > getStrength()) {
View Full Code Here

          model.createTypedLiteral(Float
                    .parseFloat(childStrengthReduction)));
        }
        newRelation.addProperty(KNOBOT.source, source);
        newRelation.addProperty(KNOBOT.target, target);
        Literal effectiveDateLiteral = model.createTypedLiteral(new W3CDateFormat()
                .format(new Date()), XSDDatatype.XSDdateTime);
        newRelation.addProperty(KNOBOT.effectiveDate, effectiveDateLiteral);
        if (inline) {
            newRelation.addProperty(RDF.type, KNOBOT.InlineRelation);
        }
View Full Code Here

TOP

Related Classes of org.wymiwyg.commons.util.text.W3CDateFormat

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.