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

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


  {
    final Model m = ModelHelper.modelWithStatements(this, "");
    Assert.assertEquals(true, m.createResource("eh:/foo").isURIResource());
    Assert.assertEquals(false, m.createResource().isURIResource());
    Assert.assertEquals(false, m.createTypedLiteral(17).isURIResource());
    Assert.assertEquals(false, m.createTypedLiteral("hello")
        .isURIResource());
  }

  public void testLiteralAsResourceThrows()
  {
View Full Code Here


    {
        Model m  = root.getModel() ;
        // Assume one result set per file.
        for ( int index = 1 ; ; index++ )
        {
            Literal ind = m.createTypedLiteral(index) ;
            StmtIterator sIter = m.listStatements(null, ResultSetGraphVocab.index, ind) ;
            if ( ! sIter.hasNext() )
                break ;
            Statement s = sIter.nextStatement() ;
            if ( sIter.hasNext() )
View Full Code Here

     * @throws SQLException
     */
    @Test
    public void test_column_type_detection_datetimes_01() throws SQLException {
        Model m = ModelFactory.createDefaultModel();
        testColumnTypeDetection("x", m.createTypedLiteral(Calendar.getInstance()).asNode(), true, Types.TIMESTAMP, Timestamp.class.getCanonicalName());
    }
   
    /**
     * Tests that xsd:date is typed as Date
     * @throws SQLException
View Full Code Here

        if (createDefaultGraph) {
            numGraphs--;
            Model def = ModelFactory.createDefaultModel();
            for (int i = 1; i <= triplesPerGraph; i++) {
                def.add(def.createStatement(def.createResource("http://default/subject/" + i),
                        def.createProperty("http://default/predicate"), def.createTypedLiteral(i)));
            }
            ds.setDefaultModel(def);
        }

        for (int g = 1; g < numGraphs; g++) {
View Full Code Here

        for (int g = 1; g < numGraphs; g++) {
            Model named = ModelFactory.createDefaultModel();
            for (int i = 1; i <= triplesPerGraph; i++) {
                named.add(named.createStatement(named.createResource("http://named/subject/" + i),
                        named.createProperty("http://named/predicate"), named.createTypedLiteral(i)));
            }
            ds.addNamedModel("http://named/" + g, named);
        }

        return ds;
View Full Code Here

       
        Resource release = model.createResource(DOAP.Version) ;
        system.addProperty(DOAP.release, release) ;
       
        Node today_node = NodeFactoryExtra.todayAsDate() ;
        Literal today = model.createTypedLiteral(today_node.getLiteralLexicalForm(), today_node.getLiteralDatatype()) ;
        release.addProperty(DOAP.created, today) ;
        release.addProperty(DOAP.name, releaseName) ;      // Again
    }
}
View Full Code Here

    if (attachment.getType() != null) {
      attachmentItem.addProperty(ATTACH.type, attachment.getType()
          .toString());
    }
    if (attachment.getWidth() > 0) {
      attachmentItem.addProperty(ATTACH.width, model.createTypedLiteral(attachment.getWidth()));
    }
    if (attachment.getHeight() > 0) {
      attachmentItem.addProperty(ATTACH.height, model.createTypedLiteral(attachment.getHeight()));
    }
    if (attachment.isInline()) {
View Full Code Here

    }
    if (attachment.getWidth() > 0) {
      attachmentItem.addProperty(ATTACH.width, model.createTypedLiteral(attachment.getWidth()));
    }
    if (attachment.getHeight() > 0) {
      attachmentItem.addProperty(ATTACH.height, model.createTypedLiteral(attachment.getHeight()));
    }
    if (attachment.isInline()) {
      attachmentItem.addProperty(RDF.type, ATTACH.InlineAttachment);
    }
    if (attachment.isSummaryView()) {
View Full Code Here

      Resource documentVariant = model
          .createResource(DOCUMENT.DocumentVariant);
      resource.addProperty(DOCUMENT.variant, documentVariant);
      documentVariant.addProperty(DOCUMENT.contentType, mimeType.toString());
      documentVariant.addProperty(DOCUMENT.content, contentResource);
      documentVariant.addProperty(DOCUMENT.contentLength, model
          .createTypedLiteral(fileContent.length));
      Literal createdLit = model.createTypedLiteral(new W3CDateFormat()
          .format(new Date()), XSDDatatype.XSDdateTime);

      documentVariant.addProperty(DCTerms.created, createdLit);
View Full Code Here

      resource.addProperty(DOCUMENT.variant, documentVariant);
      documentVariant.addProperty(DOCUMENT.contentType, mimeType.toString());
      documentVariant.addProperty(DOCUMENT.content, contentResource);
      documentVariant.addProperty(DOCUMENT.contentLength, model
          .createTypedLiteral(fileContent.length));
      Literal createdLit = model.createTypedLiteral(new W3CDateFormat()
          .format(new Date()), XSDDatatype.XSDdateTime);

      documentVariant.addProperty(DCTerms.created, createdLit);
      if ((language != null) && (!language.equals("independent"))) {
        documentVariant.addProperty(DC.language, language);
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.