java - Reading URIs with spaces in Turtle using Jena? -


i'm trying read rdf turtle file (shown below), i'm having 2 problems. first, there problem whitespace in rdf or turtle? somtimes, have problem reading uris l ike <i/o performance>. problem disappears when remove spaces, giving <ioperformance>. in file below, have problem <standard(m1) - small(default)>. here code loading file , listing subject, predicate, , object of each triple.

  stmtiterator iter = model.liststatements();     while (iter.hasnext()) {         statement stmt = iter.nextstatement();         resource subject = stmt.getsubject(); // sujeito          property predicate = stmt.getpredicate(); // predicado          rdfnode object = stmt.getobject(); // objeto          system.out.println((subject.getlocalname());         system.out.println((predicate.getlocalname().tostring());           system.out.println(stringutils.substringbetween(object.tostring(),"", "^"));     } 
@prefix dc:      <http://purl.org/dc/elements/1.1/> . @prefix legal:   <http://www.linked-usdl.org/ns/usdl-legal#> . @prefix foaf:    <http://xmlns.com/foaf/0.1/> . @prefix vann:    <http://purl.org/vocab/vann/> . @prefix org:     <http://www.w3.org/ns/org#> . @prefix rdfs:    <http://www.w3.org/2000/01/rdf-schema#> . @prefix price:   <http://www.linked-usdl.org/ns/usdl-price#> . @prefix usdl:    <http://www.linked-usdl.org/ns/usdl#> . @prefix xsd:     <http://www.w3.org/2001/xmlschema#> . @prefix owl:     <http://www.w3.org/2002/07/owl#> . @prefix rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix dei:     <http://dei.uc.pt/rdf/dei#> . @prefix gr:      <http://purl.org/goodrelations/v1#> . @prefix skos:    <http://www.w3.org/2004/02/skos/core#> .  <standard(m1) - small(default)>       rdfs:cpu "1 ec2 compute unit"^^xsd:string ;       rdfs:cost "0.08"^^xsd:float ;       rdfs:ebs-optimizedavailable               "false"^^xsd:boolean ;       rdfs:ioperformance "moderate"^^xsd:string ;       rdfs:os "linux/unix"^^xsd:string ;       rdfs:platform "32-bit"^^xsd:string ;       rdfs:ram "1.7"^^xsd:float ;       rdfs:storage "160"^^xsd:float . 

<standard(m1) - small(default)> not legal uri.

  1. it has spaces in it.
  2. it's relative uri (relative file read from) makes hard guess full, absolute uri.

either add @base or use prefixed name.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -