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

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


  }

  public void testResourceAsLiteralThrows()
  {
    final Model m = ModelHelper.modelWithStatements(this, "");
    final Literal l = m.createLiteral("hello, world");
    try
    {
      l.asResource();
      Assert.fail("should not be able to do Literal.asResource()");
    }
View Full Code Here


              + classMapName));
    }

    // describe our URI space (all under /resource/
    dDesc.add(datasetIRI, VoID.uriSpace,
        dDesc.createLiteral(server.resourceBaseURI()));

    Model mapping = D2RServer.retrieveSystemLoader(getServletContext())
        .getMappingModel();

    Set<String> prefixes = new HashSet<String>();
View Full Code Here

                    String objstr = obj.getStringValue();
                    String lang = obj.getAttributeValue(XProcConstants.xml_lang);
                    String datatype = obj.getAttributeValue(_datatype);

                    if (lang != null) {
                        Literal literal = model.createLiteral(objstr, lang);
                        rsrc.addProperty(prop, literal);
                    } else if (datatype != null) {
                        Literal literal = model.createTypedLiteral(objstr, datatype);
                        rsrc.addProperty(prop, literal);
                    } else {
View Full Code Here

  }

  public void testResourceAsLiteralThrows()
  {
    final Model m = ModelHelper.modelWithStatements(this, "");
    final Literal l = m.createLiteral("hello, world");
    try
    {
      l.asResource();
      Assert.fail("should not be able to do Literal.asResource()");
    }
View Full Code Here

  }

  public void testRDFNodeAsLiteral()
  {
    final Model m = ModelHelper.modelWithStatements(this, "");
    final Literal l = m.createLiteral("hello, world");
    Assert.assertSame(l, ((RDFNode) l).asLiteral());
  }

  public void testRDFNodeAsResource()
  {
View Full Code Here

  {
    final List<String> history = new ArrayList<>();
    final Model m = ModelFactory.createDefaultModel();
    final RDFNode S = m.createResource();
    final RDFNode P = m.createProperty("eh:PP");
    final RDFNode O = m.createLiteral("LL");
    /* */
    final RDFVisitor rv = new RDFVisitor() {
      @Override
      public Object visitBlank( final Resource R, final AnonId id )
      {
View Full Code Here

            Node.createLiteral("Example", null, null)), prefixes));
  }
 
  public void testResourcePrettyPrinting() {
    Model m = ModelFactory.createDefaultModel();
    assertEquals("\"foo\"", PrettyPrinter.toString(m.createLiteral("foo")));
    assertEquals("<http://test/>", PrettyPrinter.toString(m.createResource("http://test/")));
  }
 
  public void testUsePrefixMappingWhenPrintingURIResources() {
    Model m = ModelFactory.createDefaultModel();
View Full Code Here

      int workpackageNumber = Integer.valueOf(task.getElementsByTagName("workpackageNumber").item(0).getFirstChild().getNodeValue());
      int taskNumber = Integer.valueOf(task.getElementsByTagName("taskNumber").item(0).getFirstChild().getNodeValue());     
     
      Resource jenaTask = model.createResource(gk+"t"+workpackageNumber+'-'+taskNumber);
      jenaTask.addProperty(RDF.type, model.createResource(fp+"Task"));     
      jenaTask.addProperty(DCTerms.identifier, model.createLiteral("T"+workpackageNumber+'.'+taskNumber));
      jenaTask.addProperty(workpackageProperty, model.createResource(gk+"wp"+workpackageNumber));
      jenaTask.addLiteral(taskNumberProperty,model.createTypedLiteral(taskNumber,XSD.nonNegativeInteger.getURI()));
     
      // title as rdfs:label
      jenaTask.addLiteral(RDFS.label,model.createLiteral(task.getElementsByTagName("title").item(0).getFirstChild().getNodeValue().trim(),"en"));
View Full Code Here

      jenaTask.addProperty(DCTerms.identifier, model.createLiteral("T"+workpackageNumber+'.'+taskNumber));
      jenaTask.addProperty(workpackageProperty, model.createResource(gk+"wp"+workpackageNumber));
      jenaTask.addLiteral(taskNumberProperty,model.createTypedLiteral(taskNumber,XSD.nonNegativeInteger.getURI()));
     
      // title as rdfs:label
      jenaTask.addLiteral(RDFS.label,model.createLiteral(task.getElementsByTagName("title").item(0).getFirstChild().getNodeValue().trim(),"en"));
      // description as rdfs:comment
      jenaTask.addLiteral(DCTerms.description, model.createLiteral(task.getElementsByTagName("description").item(0).getFirstChild().getNodeValue().trim(),"en"));

      // previous and next links
      if(taskNumber>1)
View Full Code Here

      jenaTask.addLiteral(taskNumberProperty,model.createTypedLiteral(taskNumber,XSD.nonNegativeInteger.getURI()));
     
      // title as rdfs:label
      jenaTask.addLiteral(RDFS.label,model.createLiteral(task.getElementsByTagName("title").item(0).getFirstChild().getNodeValue().trim(),"en"));
      // description as rdfs:comment
      jenaTask.addLiteral(DCTerms.description, model.createLiteral(task.getElementsByTagName("description").item(0).getFirstChild().getNodeValue().trim(),"en"));

      // previous and next links
      if(taskNumber>1)
      {
        Resource previousTask = model.createResource(gk+"t"+workpackageNumber+'-'+(taskNumber-1));
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.