Uploaded image for project: 'Apache Jena'
  1. Apache Jena
  2. JENA-2134

Model loads incorrectly from ttl file

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Information Provided
    • Jena 4.1.0
    • None
    • Jena
    • None
    • Windows, WSL2, Maven, Java 14.0.2

    Description

      I downloaded knowledge from an RDF4J data store in triple format. I stored the content in a file called example.ttl.

      When I try to load the file, the composite resources do not get generated, resulting in some triples not being added to the model.

      The code I run is:

      Model model = ModelFactory.createDefaultModel();
      model.read("example.ttl"); 
      

      The output is:

      null inXSDDateTimeStamp "2020-05-21T06:00:00Z^^http://www.w3.org/2001/XMLSchema#dateTime" .
      null inXSDDateTimeStamp "2020-05-21T21:00:00Z^^http://www.w3.org/2001/XMLSchema#dateTime" .
      null year "2020^^http://www.w3.org/2001/XMLSchema#integer" .
      null second "0.0^^http://www.w3.org/2001/XMLSchema#decimal" .
      null month "5^^http://www.w3.org/2001/XMLSchema#integer" .
      null minute "51^^http://www.w3.org/2001/XMLSchema#integer" .
      null hour "10^^http://www.w3.org/2001/XMLSchema#integer" .
      null day "21^^http://www.w3.org/2001/XMLSchema#integer" .
      null inXSDDateTimeStamp "2020-05-21T10:51:00.000Z^^http://www.w3.org/2001/XMLSchema#dateTime" .
      null inDateTime deab4047bb2762830ec586ecdbb6ebf7 .
      sim timeslotDuration "60000^^http://www.w3.org/2001/XMLSchema#integer" .
      sim sunsetTime de28266990fc799c9dde46e9a902ff55 .
      sim sunriseTime ccdbc2858add8f74d995dffcdcec5a22 .
      sim iterations "1440^^http://www.w3.org/2001/XMLSchema#integer" .
      sim initialTime "2020-05-21T08:00:00Z^^http://www.w3.org/2001/XMLSchema#dateTime" .
      sim currentTime 1806f92a70aa91903b714f6ba5bdb68f .
      sim currentIteration "171^^http://www.w3.org/2001/XMLSchema#integer" .

      Note the null subjects.

      The code I used to generate the output is below:

       

      Iterator<Statement> iterator = model.listStatements();
      
      while (iterator.hasNext()) {
          Statement stmt = iterator.next();
          Resource subject = stmt.getSubject();
          Property predicate = stmt.getPredicate();
          RDFNode object = stmt.getObject(); 
          System.out.print(subject.getLocalName());
          System.out.print(" " + predicate.getLocalName() + " ");
          if (object instanceof Resource) {
              System.out.print(object.toString());
          } else {
              // object is a literal
              System.out.print(" \"" + object.toString() + "\"");
          } 
          System.out.println(" .");
      } 

       

      Attachments

        1. example.ttl
          0.9 kB
          Rem Collier

        Activity

          People

            Unassigned Unassigned
            remcollier Rem Collier
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: