|
<!-- Extract bounding box coordinates from a 'SO:spatialCoverage' property. --> |
|
<bean id="schema_org_geoShape_box_south" class="org.dataone.cn.indexer.annotation.SparqlField"> |
|
<constructor-arg name="name" value="southBoundCoord" /> |
|
<constructor-arg name="query"> |
|
<value> |
|
<![CDATA[ |
|
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> |
|
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> |
|
PREFIX SO: <http://schema.org/> |
|
|
|
SELECT ?southBoundCoord |
|
WHERE { |
|
?datasetId rdf:type SO:Dataset . |
|
?datasetId SO:spatialCoverage ?spatial . |
|
?spatial rdf:type SO:Place . |
|
?spatial SO:geo ?geo . |
|
?geo rdf:type SO:GeoShape . |
|
?geo SO:box ?box . |
|
# Extract south coord, replacing commas and multiple whitespaces to single whitespaces |
|
# to simplify parsing |
|
bind(strbefore(replace(str(?box), "\\s*,\\s*|\\s{2,}", " "), " ") as ?southBoundCoord) |
|
} |
|
limit 1 |
|
]]> |
|
</value> |
|
</constructor-arg> |
|
<property name="converter" ref="solrLatitudeConverter" /> |
|
</bean> |
|
|
|
<!-- Extract bounding box coordinates from a 'SO:spatialCoverage' property. --> |
|
<bean id="schema_org_geoShape_box_west" class="org.dataone.cn.indexer.annotation.SparqlField"> |
|
<constructor-arg name="name" value="westBoundCoord" /> |
|
<constructor-arg name="query"> |
|
<value> |
|
<![CDATA[ |
|
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> |
|
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> |
|
PREFIX SO: <http://schema.org/> |
|
|
|
SELECT ?westBoundCoord |
|
WHERE { |
|
?datasetId rdf:type SO:Dataset . |
|
?datasetId SO:spatialCoverage ?spatial . |
|
?spatial rdf:type SO:Place . |
|
?spatial SO:geo ?geo . |
|
?geo rdf:type SO:GeoShape . |
|
?geo SO:box ?box . |
|
bind(strbefore(replace(str(?box), "\\s*,\\s*|\\s{2,}", " "), " ") as ?southBoundCoord) |
|
bind(strafter(replace(str(?box), "\\s*,\\s*|\\s{2,}", " "), " ") as ?rest) |
|
bind(strbefore(str(?rest), " ") as ?westBoundCoord) |
|
} |
|
limit 1 |
|
]]> |
|
</value> |
|
</constructor-arg> |
|
<property name="converter" ref="solrLongitudeConverter" /> |
|
</bean> |
|
|
|
<!-- Extract bounding box coordinates from a 'SO:spatialCoverage' property. --> |
|
<bean id="schema_org_geoShape_box_north" class="org.dataone.cn.indexer.annotation.SparqlField"> |
|
<constructor-arg name="name" value="northBoundCoord" /> |
|
<constructor-arg name="query"> |
|
<value> |
|
<![CDATA[ |
|
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> |
|
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> |
|
PREFIX SO: <http://schema.org/> |
|
|
|
SELECT ?northBoundCoord |
|
WHERE { |
|
?datasetId rdf:type SO:Dataset . |
|
?datasetId SO:spatialCoverage ?spatial . |
|
?spatial rdf:type SO:Place . |
|
?spatial SO:geo ?geo . |
|
?geo rdf:type SO:GeoShape . |
|
?geo SO:box ?box . |
|
bind(strbefore(replace(str(?box), "\\s*,\\s*|\\s{2,}", " "), " ") as ?southBoundCoord) |
|
bind(strafter(replace(str(?box), "\\s*,\\s*|\\s{2,}", " "), " ") as ?rest) |
|
bind(strbefore(str(?rest), " ") as ?westBoundCoord) |
|
bind(strafter(str(?rest), " ") as ?rest2) |
|
bind(strbefore(str(?rest2), " ") as ?northBoundCoord) |
|
} |
|
limit 1 |
|
]]> |
|
</value> |
|
</constructor-arg> |
|
<property name="converter" ref="solrLatitudeConverter" /> |
|
</bean> |
|
|
|
<!-- Extract bounding box coordinates from a 'SO:spatialCoverage' property. --> |
|
<bean id="schema_org_geoShape_box_east" class="org.dataone.cn.indexer.annotation.SparqlField"> |
|
<constructor-arg name="name" value="eastBoundCoord" /> |
|
<constructor-arg name="query"> |
|
<value> |
|
<![CDATA[ |
|
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> |
|
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> |
|
PREFIX SO: <http://schema.org/> |
|
|
|
SELECT ?eastBoundCoord |
|
WHERE { |
|
?datasetId rdf:type SO:Dataset . |
|
?datasetId SO:spatialCoverage ?spatial . |
|
?spatial rdf:type SO:Place . |
|
?spatial SO:geo ?geo . |
|
?geo rdf:type SO:GeoShape . |
|
?geo SO:box ?box . |
|
bind(strbefore(replace(str(?box), "\\s*,\\s*|\\s{2,}", " "), " ") as ?southBoundCoord) |
|
bind(strafter(replace(str(?box), "\\s*,\\s*|\\s{2,}", " "), " ") as ?rest) |
|
bind(strbefore(str(?rest), " ") as ?westBoundCoord) |
|
bind(strafter(str(?rest), " ") as ?rest2) |
|
bind(strbefore(str(?rest2), " ") as ?northBoundCoord) |
|
bind(strafter(str(?rest2), " ") as ?eastBoundCoord) |
|
} |
|
limit 1 |
|
]]> |
|
</value> |
|
</constructor-arg> |
|
<property name="converter" ref="solrLongitudeConverter" /> |
|
</bean> |
The existing methods of extracting of geographical information from schema.org documents does not meet the standards of the SOSO guidelines on describing Spatial Coverage. The beans that do this work are highlighted below. At the moment, it seems like we only support
spatialCoveragesections similar to the following:dataone-indexer/src/main/resources/application-context-schema-org.xml
Lines 458 to 577 in 1ad4183
Since we claim to support all of the representations of schema.org outlined in the SOSO guidelines, we need to be able to support a broader range of
spatialCoverageinformation as outlined in that document. For example, the following is a valid representation from a dataset with a point location, which I think should also be fairly straightforward to support:I have no experience with SPARQL apart from looking through the resource document referenced above so would be coming at this from square zero...if someone else has some idea of what they're doing, I would appreciate some guidance :)