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

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


                RDFNode x = rb.get("title") ;
               
                // Check the type of the result value
                if ( x instanceof Literal )
                {
                    Literal titleStr = (Literal)x  ;
                    System.out.println("    "+titleStr) ;
                }
                else
                    System.out.println("Strange - not a literal: "+x) ;
                   
View Full Code Here


                RDFNode x = rb.get("title") ;
               
                // Check the type of the result value
                if ( x.isLiteral() )
                {
                    Literal titleStr = (Literal)x  ;
                    System.out.println("    "+titleStr) ;
                }
                else
                    System.out.println("Strange - not a literal: "+x) ;
                   
View Full Code Here

                RDFNode x = rb.get("title") ;
               
                // Check the type of the result value
                if ( x instanceof Literal )
                {
                    Literal titleStr = (Literal)x  ;
                    System.out.println("    "+titleStr) ;
                }
                else
                    System.out.println("Strange - not a literal: "+x) ;
                   
View Full Code Here

       
        Resource r1 = ResourceFactory.createResource("http://example/r1") ;
        Resource r2 = ResourceFactory.createResource("http://example/r2") ;
        Resource r3 = ResourceFactory.createResource("http://example/r3") ;
        Resource r4 = ResourceFactory.createResource("http://example/r4") ;
        Literal  lit1 = ResourceFactory.createPlainLiteral("doc") ;
       
        // ---- Index based on some external content.  Teh content can be any string of words.
       
        larqBuilder.index(r1, new StringReader("document")) ;   // Just to show a Stringreader is possible
        larqBuilder.index(r2, "document") ;
View Full Code Here

      NamedNode component = new NamedNodeImpl(assertedComponent.getURI());
      componentTypeMap.put(component, type);
      SourceComponent sourceComponent = new SourceComponent(source, component);
      {
        //adding assertion
        Literal assertionTimeLit = assertion.getProperty(
            METAMODEL.assertionTime).getLiteral();
        Date assertionTime = ((XSDDateTime) assertionTimeLit.getValue())
        .asCalendar().getTime();
        RelevantMoment relevantMoment = getRelevantMoment(assertionTime);
        relevantMoment.assertions.add(sourceComponent);
        putToValueSet(whatWhenMap, sourceComponent, relevantMoment);
        putToValueSet(whoWhat, source, relevantMoment);
      }
      if (assertion.hasProperty(METAMODEL.revocationTime)) {
        Literal revocationTimeLit = assertion.getProperty(
            METAMODEL.revocationTime).getLiteral();
        Date revocationTime = ((XSDDateTime) revocationTimeLit.getValue())
        .asCalendar().getTime();
        RelevantMoment relevantMoment = getRelevantMoment(revocationTime);
        relevantMoment.revocations.add(sourceComponent);
        putToValueSet(whatWhenMap, sourceComponent, relevantMoment);
        putToValueSet(whoWhat, source, relevantMoment);
View Full Code Here

    Resource assertion = metaModel.createResource();
    assertion.addProperty(METAMODEL.asserter, metaModel
        .createResource(source.getURIRef()));
    Calendar calendar = Calendar.getInstance();
    calendar.setTime(moment);
    Literal momentLit = metaModel.createTypedLiteral(new XSDDateTime(
        calendar));
    /*
     * Literal momentLit = metaModel.createTypedLiteral( new
     * MillisDateFormat().format(moment), XSDDatatype.XSDdateTime);
     */
 
View Full Code Here

      Resource sourceRes = metaModel.createResource(source.getURIRef());
      ResIterator assertions = metaModel.listSubjectsWithProperty(
          METAMODEL.asserter, sourceRes);
      while (assertions.hasNext()) {
        Resource assertion = assertions.nextResource();
        Literal assertionTimeLit = assertion.getProperty(
            METAMODEL.assertionTime).getLiteral();
        Resource assertedComponent = assertion.getProperty(
            METAMODEL.assertedComponent).getResource();
        if (!assertedComponent.hasProperty(RDF.type, type)) {
          continue;
        }

        Date assertionTime;
        assertionTime = ((XSDDateTime) assertionTimeLit.getValue())
            .asCalendar().getTime();
        /*
         * try { assertionTime = new MillisDateFormat()
         * .parse(assertionTimeLit.getLexicalForm()); } catch
         * (ParseException e) { throw new RuntimeException(e); }
         */
        if (moment.before(assertionTime)) {
          continue;
        }
        Statement revocationTimeStmt = assertion
            .getProperty(METAMODEL.revocationTime);
        if (revocationTimeStmt != null) {
          Literal revocationTimeLit = revocationTimeStmt.getLiteral();
          Date revocationTime = ((XSDDateTime) revocationTimeLit
              .getValue()).asCalendar().getTime();
          // not before rather than after as in the moment of
          // revocation it is revoked
          if (!moment.before(revocationTime)) {
            continue;
View Full Code Here

    if (revokingComponentRes == null) {
      throw new StoreException("Assertion not found");
    }
    Calendar calendar = Calendar.getInstance();
    calendar.setTime(moment);
    Literal momentLit = metaModel.createTypedLiteral(new XSDDateTime(
        calendar));
    /*
     * Literal momentLit = metaModel.createTypedLiteral( new
     * MillisDateFormat().format(moment), XSDDatatype.XSDdateTime);
     */
 
View Full Code Here

    while (assertionsOfComponent.hasNext()) {
      Resource assertion = assertionsOfComponent.nextResource();
      if (!assertion.hasProperty(METAMODEL.asserter, sourceRes)) {
        continue;
      }
      Literal assertionTimeLit = assertion.getProperty(
          METAMODEL.assertionTime).getLiteral();
      Date assertionTime;
      assertionTime = ((XSDDateTime) assertionTimeLit.getValue())
          .asCalendar().getTime();

      if (moment.before(assertionTime)) {
        continue;
      }
      Statement revocationTimeStmt = assertion
          .getProperty(METAMODEL.revocationTime);
      if (revocationTimeStmt != null) {
        Literal revocationTimeLit = revocationTimeStmt.getLiteral();
        Date revocationTime = ((XSDDateTime) revocationTimeLit
            .getValue()).asCalendar().getTime();

        // not before rather than after as in the moment of
        // revocation it is revoked
        if (!moment.before(revocationTime)) {
View Full Code Here

      Resource sourceRes = metaModel.createResource(source.getURIRef());
      ResIterator assertions = metaModel.listSubjectsWithProperty(
          METAMODEL.asserter, sourceRes);
      while (assertions.hasNext()) {
        Resource assertion = assertions.nextResource();
        Literal assertionTimeLit = assertion.getProperty(
            METAMODEL.assertionTime).getLiteral();
        Date assertionTime;
        try {
          assertionTime = ((XSDDateTime) assertionTimeLit.getValue())
              .asCalendar().getTime();
          /*
           * assertionTime = new MillisDateFormat()
           * .parse(assertionTimeLit.getLexicalForm());
           */
        } catch (/* Parse */Exception e) {
          throw new RuntimeException(e);
        }
        if (forward) {
          if (assertionTime.after(moment)) {
            resultDateSet.add(assertionTime);
          }
        } else {
          if (!assertionTime.after(moment)) {
            resultDateSet.add(assertionTime);
          }
        }
        Statement revocationTimeStmt = assertion
            .getProperty(METAMODEL.revocationTime);
        if (revocationTimeStmt != null) {
          Literal revocationTimeLit = revocationTimeStmt.getLiteral();
          Date revocationTime;
          revocationTime = ((XSDDateTime) revocationTimeLit
              .getValue()).asCalendar().getTime();
          /*
           * try { revocationTime = new MillisDateFormat()
           * .parse(revocationTimeLit.getLexicalForm()); } catch
           * (ParseException e) { throw new RuntimeException(e); }
View Full Code Here

TOP

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

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.