I am working on a project for my studies right now and I need some help.
Basically, I need to convert the following RDF to representations of a Java class. I read the RDF to a model and from there I am stuck.
StringReader in = new StringReader(resultTemp);
Model model = ModelFactory.createDefaultModel();
model.read(in, null, "TURTLE");
I tried working with the function listSubjectsWithProperty(Property arg0, RDFNode arg1) and the StmtIterator but I just can't figure it out. I would greatly appreciate some help.
RDF:
@prefix d: <http://www.w3.org/2001/XMLSchema#> .
@prefix p: <http://parking.kmi.open.ac.uk/ontologies/parking#> .
@prefix s: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix g: <http://www.w3.org/2003/01/geo/wgs84_pos#> .
@prefix o: <http://linkedgeodata.org/ontology/> .
<http://parking.kmi.open.ac.uk/data/parks/4751.3> a o:Parking ;
g:lat "50.8509406"^^d:double ;
g:long "-0.983707"^^d:double ;
p:binaryAvailability "true"^^d:boolean .
<http://parking.kmi.open.ac.uk/data/parks/4934.6> a o:Parking ;
g:lat "50.8737457"^^d:double ;
g:long "-0.9731118"^^d:double ;
p:binaryAvailability "true"^^d:boolean .
<http://parking.kmi.open.ac.uk/data/parks/4934.8> a o:Parking ;
g:lat "50.873617"^^d:double ;
g:long "-0.9722267"^^d:double ;
p:binaryAvailability "true"^^d:boolean .
<http://parking.kmi.open.ac.uk/data/parks/4934.3> a o:Parking ;
g:lat "50.8696495"^^d:double ;
g:long "-0.9767757"^^d:double ;
p:binaryAvailability "true"^^d:boolean .
<http://parking.kmi.open.ac.uk/data/parks/4934.2> a o:Parking ;
g:lat "50.8698594"^^d:double ;
g:long "-0.9775482"^^d:double ;
p:binaryAvailability "true"^^d:boolean .
<http://parking.kmi.open.ac.uk/data/parks/4934.1> a o:Parking ;
g:lat "50.8704349"^^d:double ;
g:long "-0.9774731"^^d:double ;
p:binaryAvailability "true"^^d:boolean .
<http://parking.kmi.open.ac.uk/data/parks/4934.7> a o:Parking ;
g:lat "50.8732887"^^d:double ;
g:long "-0.9725968"^^d:double ;
p:binaryAvailability "true"^^d:boolean .
<http://parking.kmi.open.ac.uk/data/parks/28356.7> a o:Parking ;
g:lat "50.997992"^^d:double ;
g:long "-0.926222"^^d:double ;
p:binaryAvailability "true"^^d:boolean .
<http://parking.kmi.open.ac.uk/data/parks/40865.5> a o:Parking ;
g:lat "50.995467"^^d:double ;
g:long "-1.036603"^^d:double ;
s:label "Workhouse Lane" ;
p:binaryAvailability "true"^^d:boolean .
<http://parking.kmi.open.ac.uk/data/parks/7185.1> a o:Parking ;
g:lat "50.9885711"^^d:double ;
g:long "-1.0811721"^^d:double ;
p:binaryAvailability "true"^^d:boolean .
<http://parking.kmi.open.ac.uk/data/parks/33791.10> a o:Parking ;
g:lat "50.887628"^^d:double ;
g:long "-0.929626"^^d:double ;
s:label "Locked at 17:30" ;
p:binaryAvailability "true"^^d:boolean .
<http://parking.kmi.open.ac.uk/data/parks/20810.1> a o:Parking ;
g:lat "50.891515"^^d:double ;
g:long "-0.964029"^^d:double ;
p:binaryAvailability "true"^^d:boolean .
<http://parking.kmi.open.ac.uk/data/parks/33791.11> a o:Parking ;
g:lat "50.894162"^^d:double ;
g:long "-0.927854"^^d:double ;
s:label "Locked at 17:30" ;
p:binaryAvailability "true"^^d:boolean .
<http://parking.kmi.open.ac.uk/data/parks/41308.7> a o:Parking ;
g:lat "50.848336"^^d:double ;
g:long "-0.937472"^^d:double ;
p:binaryAvailability "true"^^d:boolean .
<http://parking.kmi.open.ac.uk/data/parks/41308.6> a o:Parking ;
g:lat "50.849124"^^d:double ;
g:long "-0.937969"^^d:double ;
p:binaryAvailability "true"^^d:boolean .
<http://parking.kmi.open.ac.uk/data/parks/38470.10> a o:Parking ;
g:lat "50.849454"^^d:double ;
g:long "-0.939969"^^d:double ;
p:binaryAvailability "true"^^d:boolean .
<http://parking.kmi.open.ac.uk/data/parks/33030.4> a o:Parking ;
g:lat "50.850708"^^d:double ;
g:long "-0.913150"^^d:double ;
p:binaryAvailability "true"^^d:boolean .
<http://parking.kmi.open.ac.uk/data/parks/33030.3> a o:Parking ;
g:lat "50.850421"^^d:double ;
g:long "-0.914416"^^d:double ;
p:binaryAvailability "true"^^d:boolean .
<http://parking.kmi.open.ac.uk/data/parks/41378.7> a o:Parking ;
g:lat "50.851734"^^d:double ;
g:long "-0.949425"^^d:double ;
p:binaryAvailability "true"^^d:boolean .
<http://parking.kmi.open.ac.uk/data/parks/23937.9> a o:Parking ;
g:lat "50.854045"^^d:double ;
g:long "-0.979164"^^d:double ;
p:binaryAvailability "true"^^d:boolean .
<http://parking.kmi.open.ac.uk/data/parks/23834.6> a o:Parking ;
g:lat "50.849214"^^d:double ;
g:long "-0.987087"^^d:double ;
p:binaryAvailability "true"^^d:boolean .
<http://parking.kmi.open.ac.uk/data/parks/23937.8> a o:Parking ;
g:lat "50.847012"^^d:double ;
g:long "-0.986388"^^d:double ;
p:binaryAvailability "true"^^d:boolean .
<http://parking.kmi.open.ac.uk/data/parks/23937.7> a o:Parking ;
g:lat "50.845044"^^d:double ;
g:long "-0.989708"^^d:double ;
p:binaryAvailability "true"^^d:boolean .
<http://parking.kmi.open.ac.uk/data/parks/23937.12> a o:Parking ;
g:lat "50.844084"^^d:double ;
g:long "-1.008944"^^d:double ;
p:binaryAvailability "true"^^d:boolean .
<http://parking.kmi.open.ac.uk/data/parks/30510.6> a o:Parking ;
g:lat "50.821892"^^d:double ;
g:long "-0.983163"^^d:double ;
p:binaryAvailability "true"^^d:boolean .
<http://parking.kmi.open.ac.uk/data/parks/30554.10> a o:Parking ;
g:lat "50.822039"^^d:double ;
g:long "-0.982497"^^d:double ;
p:binaryAvailability "true"^^d:boolean .
<http://parking.kmi.open.ac.uk/data/parks/25125.2> a o:Parking ;
g:lat "50.825640"^^d:double ;
g:long "-1.078993"^^d:double ;
p:binaryAvailability "true"^^d:boolean .
<http://parking.kmi.open.ac.uk/data/parks/25125.1> a o:Parking ;
g:lat "50.824621"^^d:double ;
g:long "-1.082243"^^d:double ;
p:binaryAvailability "true"^^d:boolean .
<http://parking.kmi.open.ac.uk/data/parks/25125> a o:Parking ;
g:lat "50.824789"^^d:double ;
g:long "-1.083873"^^d:double ;
p:binaryAvailability "true"^^d:boolean .
<http://parking.kmi.open.ac.uk/data/parks/7345.6> a o:Parking ;
g:lat "50.8249235"^^d:double ;
g:long "-1.0734443"^^d:double ;
s:label "Cycle-World" ;
p:binaryAvailability "true"^^d:boolean .
<http://parking.kmi.open.ac.uk/data/parks/21282> a o:Parking ;
g:lat "50.836295"^^d:double ;
g:long "-1.071699"^^d:double ;
p:binaryAvailability "true"^^d:boolean .
<http://parking.kmi.open.ac.uk/data/parks/25113.1> a o:Parking ;
g:lat "50.829433"^^d:double ;
g:long "-1.065990"^^d:double ;
p:binaryAvailability "true"^^d:boolean .
<http://parking.kmi.open.ac.uk/data/parks/25125.5> a o:Parking ;
g:lat "50.834706"^^d:double ;
g:long "-1.074678"^^d:double ;
p:binaryAvailability "true"^^d:boolean .
<http://parking.kmi.open.ac.uk/data/parks/29282.1> a o:Parking ;
g:lat "50.836060"^^d:double ;
g:long "-1.075153"^^d:double ;
p:binaryAvailability "true"^^d:boolean .
<http://parking.kmi.open.ac.uk/data/parks/41323.3> a o:Parking ;
g:lat "50.853264"^^d:double ;
g:long "-0.990290"^^d:double ;
p:binaryAvailability "true"^^d:boole...`
Hi there, I need to iterate over every one of theses blocks:
<http://parking.kmi.open.ac.uk/data/parks/4751.3> a o:Parking ;
g:lat "50.8509406"^^d:double ;
g:long "-0.983707"^^d:double ;
p:binaryAvailability "true"^^d:boolean .
Is there some iterator or other method which allows me to do so?
s:label
and some of them don't? – Unpractical