我现在正在为我的学习项目工作,需要一些帮助。
基本上,我需要将以下RDF转换为Java类的表示形式。我将RDF读入模型,但从那里开始便卡住了。
StringReader in = new StringReader(resultTemp);
Model model = ModelFactory.createDefaultModel();
model.read(in, null, "TURTLE");
我尝试使用函数listSubjectsWithProperty(Property arg0, RDFNode arg1)和StmtIterator进行工作,但我无法理解它。
希望能得到一些帮助。
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...`
你好,我需要遍历这些块中的每一个:
<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 .
有没有迭代器或其他方法可以实现这个功能?
s:label
,有些没有,这会有影响吗? - Joshua Taylor