Examples of createTypedLiteral()


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

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

       
        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
       
        TestSuite suite = ScriptTestSuiteFactory.make(testManifest) ;
        SimpleTestRunner.runSilent(suite) ;
View Full Code Here

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

       
        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
       
        TestSuite suite = FactoryTestRiot.make(testManifest, null, null) ;
        SimpleTestRunner.runSilent(suite) ;
View Full Code Here

Examples of org.apache.clerezza.rdf.core.LiteralFactory.createTypedLiteral()

    if (valIter.hasNext()) {
      triplesToBeRemoved.add(new TripleImpl(subject, predicate, valIter.next()));
    }
    contentGraph.removeAll(triplesToBeRemoved);
    contentGraph.add(new TripleImpl(subject, predicate,
        fac.createTypedLiteral(entry.getValue())));
  }

  private static String getLastSection(String s) {
    return s.substring(s.lastIndexOf('/', s.length()-2));
  }
View Full Code Here

Examples of org.apache.clerezza.rdf.core.LiteralFactory.createTypedLiteral()

    GraphNode result = new GraphNode(new BNode(), new SimpleMGraph());
    result.addProperty(RDF.type, TYPERENDERING.Exception);
    LiteralFactory factory = LiteralFactory.getInstance();
    result.addProperty(TYPERENDERING.errorSource, new UriRef(renderingSpecification.toString()));
    if (lineNumber != -1) {
      result.addProperty(TYPERENDERING.line, factory.createTypedLiteral(new Integer(lineNumber)));
    }
    if (columnNumber != -1) {
      result.addProperty(TYPERENDERING.column, factory.createTypedLiteral(Integer.valueOf(columnNumber)));
    }
    result.addProperty(TYPERENDERING.message, new PlainLiteralImpl(getMessage()));
View Full Code Here

Examples of org.apache.clerezza.rdf.core.LiteralFactory.createTypedLiteral()

    result.addProperty(TYPERENDERING.errorSource, new UriRef(renderingSpecification.toString()));
    if (lineNumber != -1) {
      result.addProperty(TYPERENDERING.line, factory.createTypedLiteral(new Integer(lineNumber)));
    }
    if (columnNumber != -1) {
      result.addProperty(TYPERENDERING.column, factory.createTypedLiteral(Integer.valueOf(columnNumber)));
    }
    result.addProperty(TYPERENDERING.message, new PlainLiteralImpl(getMessage()));
    return result;
  }
View Full Code Here

Examples of org.apache.clerezza.rdf.core.LiteralFactory.createTypedLiteral()

  @Test
  public void dateStorage() {
    MGraph graph = getEmptyMGraph();
    Date date = new Date(0);
    LiteralFactory literalFactory = LiteralFactory.getInstance();
    TypedLiteral dateLiteral = literalFactory.createTypedLiteral(date);
    Triple triple = new TripleImpl(new BNode(), new UriRef("http://example.com/property"), dateLiteral);
    graph.add(triple);
    Assert.assertTrue(graph.contains(triple));
  }
View Full Code Here

Examples of org.apache.clerezza.rdf.core.LiteralFactory.createTypedLiteral()

  @Test
  public void dateStorage2() {
    MGraph graph = getEmptyMGraph();
    Date date = new Date(0);
    LiteralFactory literalFactory = LiteralFactory.getInstance();
    TypedLiteral dateLiteral = literalFactory.createTypedLiteral(date);
    System.out.println(dateLiteral);
    UriRef property = new UriRef("http://example.com/property");
    Triple triple = new TripleImpl(new BNode(), property, dateLiteral);
    graph.add(triple);
View Full Code Here

Examples of org.apache.clerezza.rdf.core.LiteralFactory.createTypedLiteral()

                g.add(latitudes.next());
            }
            Iterator<Triple> longitutes = metadata.filter(uri, GEO_LONG, null);
            if (longitutes.hasNext()) {
                g.add(longitutes.next());
                g.add(new TripleImpl(uri, Properties.RDFS_LABEL, lf.createTypedLiteral(bestGuess.getLabel())));
            }
        }
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        serializer.serialize(out, g, SupportedFormat.RDF_JSON);
View Full Code Here

Examples of org.apache.clerezza.rdf.core.LiteralFactory.createTypedLiteral()

          UriRef textAnnotation = EnhancementEngineHelper.createTextEnhancement(ci, this);
          //add selected text as PlainLiteral in the language extracted from the text
          g.add(new TripleImpl(textAnnotation, ENHANCER_SELECTED_TEXT,  new PlainLiteralImpl(se.getSnippetStr(),lang)));
          g.add(new TripleImpl(textAnnotation, DC_TYPE, CeliConstants.SENTIMENT_EXPRESSION));
          if (se.getStartSnippet() != null && se.getEndSnippet() != null) {
            g.add(new TripleImpl(textAnnotation, ENHANCER_START, literalFactory.createTypedLiteral(se.getStartSnippet().intValue())));
            g.add(new TripleImpl(textAnnotation, ENHANCER_END, literalFactory.createTypedLiteral(se.getEndSnippet().intValue())));
            g.add(new TripleImpl(textAnnotation, ENHANCER_SELECTION_CONTEXT,
                  new PlainLiteralImpl(getSelectionContext(text, se.getSnippetStr(), se.getStartSnippet()), lang)));
            g.add(new TripleImpl(textAnnotation, CeliConstants.HAS_SENTIMENT_EXPRESSION_POLARITY, literalFactory.createTypedLiteral(se.getSentimentPolarityAsDoubleValue())));
          }
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.