Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Marmotta Wiki" for 
change notification.

The "MARMOTTA-584/UserDocumentation" page has been changed by Francisco Sumba:
https://wiki.apache.org/marmotta/MARMOTTA-584/UserDocumentation?action=diff&rev1=5&rev2=6

  
  Here is the explanation of the whole functions implemented on 
[[https://www.google-melange.com/gsoc/project/details/google/gsoc2015/fernandobac03/5707702298738688|Google
 Summer of Code]], inspired by 
[[https://issues.apache.org/jira/browse/MARMOTTA-584|MARMOTTA-584]]. 
  
- For each sample query you could use the RDF files attached 
[[attachment:provinciasEspaña.rdf]], [[attachment:riosEspaña.rdf]] and import 
in your [[http://marmotta.apache.org | Apache Marmotta]]. The files contains 
all the provinces and rivers of Spain.
+ For each sample query you could use the RDF files attached 
[[attachment:provinciasEspaña.rdf]], [[attachment:municipiosEspaña.rdf]], 
[[attachment:riosEspaña.rdf]] and import in your [[http://marmotta.apache.org | 
Apache Marmotta]]. The files contains all the provinces, towns and rivers of 
Spain.
  
  {{{#!wiki note
  '''Import files and execute queries in [[http://marmotta.apache.org | Apache 
Marmotta]]'''
@@ -17, +17 @@

  == Boolean Functions ==
  
  === Contains ===
+ Returns true if and only if no points of B lie in the exterior of A, and at 
least one point of the interior of B lies in the interior of A.
+ 
+ '''Syntax:''' ''geof:sfContains(geomA, geomB)''
+ 
+ '''Sample Query'''
+ {{{
+ PREFIX geoes: <http://geo.marmotta.es/ontology#>
+ PREFIX geo: <http://www.opengis.net/ont/geosparql#>
+ PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
+ 
+ SELECT DISTINCT ?labelMunicipios 
+ WHERE {  
+   ?class a <http://geo.marmotta.es/ontology#provincia>.
+   ?class rdfs:label "Madrid"@es.
+   ?class geoes:hasExactGeometry ?geo.
+   ?geo geo:asWKT ?wkt.
+   
+   ?class2 a <http://geo.marmotta.es/ontology#municipio>.
+   ?class2 rdfs:label ?labelMunicipios.
+   ?class2 geoes:hasExactGeometry ?geo2.
+   ?geo2 geo:asWKT ?wkt2.
+   
+   FILTER (geof:sfContains(?wkt, ?wkt2))
+ } 
+ ORDER BY ?labelMunicipios
+ LIMIT 10
+ }}}
+ 
+ As result of this query we get the first ten towns that contains the Madrid 
province.
+ 
+ || '''''labelMunicipios''''' ||
+ || Ajalvir @es ||
+ || Alcalá de Henares @es ||
+ || Alcobendas @es ||
+ || Alcorcón @es ||
+ || Algete @es ||
+ || Alpedrete @es ||
+ || Anchuelo @es ||
+ || Arganda del Rey @es ||
+ || Arroyomolinos @es ||
+ || Becerril de la Sierra @es ||
+ 
  === Crosses ===
+ Returns TRUE if the supplied geometries have some, but not all, interior 
points in common.
+ 
+ '''Syntax:''' ''geof:sfCrosses(geom1, geom2)''
+ 
+ '''Sample Query'''
+ {{{
+ PREFIX geoes: <http://geo.marmotta.es/ontology#>
+ PREFIX geo: <http://www.opengis.net/ont/geosparql#>
+ PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
+ 
+ SELECT DISTINCT ?labelRios 
+ WHERE {  
+   ?class a <http://geo.marmotta.es/ontology#provincia>.
+   ?class rdfs:label "Madrid"@es.
+   ?class geoes:hasExactGeometry ?geo.
+   ?geo geo:asWKT ?wkt.
+   
+   ?class2 a <http://geo.marmotta.es/ontology#rio>.
+   ?class2 rdfs:label ?labelRios.
+   ?class2 geoes:hasExactGeometry ?geo2.
+   ?geo2 geo:asWKT ?wkt2.
+   
+   FILTER (geof:sfCrosses(?wkt, ?wkt2))      
+ }
+ }}}
+ 
+ As result of this query we get all the rivers that crosses with Madrid 
province.
+ 
+ || '''''labelRios''''' ||
+ || Río Tajuña @es ||
+ || Río Henares @es ||
+ || Río Alberche @es ||
+ || Río Algodor @es ||
+ || Río Tajo @es ||
+ || Río Guadarrama @es ||
+ || Río Jarama @es ||
+ 
  === Disjoint ===
+ Returns TRUE if the Geometries do not "spatially intersect" - if they do not 
share any space together.
+ 
+ '''Syntax:''' ''geof:sfDisjoint(geom1, geom2)''
+ 
+ '''Sample Query'''
+ {{{
+ PREFIX geoes: <http://geo.marmotta.es/ontology#>
+ PREFIX geo: <http://www.opengis.net/ont/geosparql#>
+ PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
+ 
+ SELECT DISTINCT ?labelRios 
+ WHERE {  
+   ?class a <http://geo.marmotta.es/ontology#provincia>.
+   ?class rdfs:label "Barcelona"@es.
+   ?class geoes:hasExactGeometry ?geo.
+   ?geo geo:asWKT ?wkt.
+   
+   ?class2 a <http://geo.marmotta.es/ontology#rio>.
+   ?class2 rdfs:label ?labelRios.
+   ?class2 geoes:hasExactGeometry ?geo2.
+   ?geo2 geo:asWKT ?wkt2.
+   
+   FILTER (geof:sfDisjoint(?wkt, ?wkt2))      
+ }
+ ORDER BY ?labelRios
+ LIMIT 10
+ }}}
+ 
+ As result of this query we get the first ten rivers that disjoint the 
Barcelona province.
+ 
+ || '''''labelRios''''' ||
+ || Rivera de Chanza @es ||
+ || Rivera de Huelva @es ||
+ || Río Abanades @es ||
+ || Río Adaja @es ||
+ || Río Aguas Vivas @es ||
+ || Río Alagón @es ||
+ || Río Alberche @es ||
+ || Río Alcanadre @es ||
+ || Río Algodor @es ||
+ || Río Alhama @es ||
+ 
  === Equals ===
+ Returns true if the given geometries represent the same geometry. 
Directionality is ignored.
+ 
+ '''Syntax:''' ''geof:sfEquals(geom1, geom2)''
+ 
+ '''Sample Query'''
+ {{{
+ PREFIX geoes: <http://geo.marmotta.es/ontology#>
+ PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
+ PREFIX geo: <http://www.opengis.net/ont/geosparql#>
+ 
+ SELECT *  WHERE {
+   ?subject ?property <http://geo.marmotta.es/ontology#municipio>.
+   ?subject rdfs:label "Madrid"@es.
+   ?subject geoes:hasExactGeometry ?geo.
+   ?geo geo:asWKT ?wkt.
+   
+   ?subject2 a <http://geo.marmotta.es/ontology#municipio>.
+   ?subject2 rdfs:label "Madrid"@es.
+   ?subject2 geoes:hasExactGeometry ?geo2.
+   ?geo2 geo:asWKT ?wkt2. 
+   
+   FILTER (geof:sfEquals (?wkt, ?wkt2)) 
+ }
+ }}}
+ 
+ Obviously the both towns are equals.
+ 
  === Intersects ===
  Returns ''TRUE'' if the Geometries "spatially intersect in 2D" - (share any 
portion of space) and FALSE if they don't (they are Disjoint).
  
@@ -48, +196 @@

  }}}}
  
  As result of this query we get all the rivers that intersects with Madrid 
province.
- 
  
  || '''''labelRios''''' ||
  || Río Manzanares @es ||
@@ -61, +208 @@

  || Río Jarama @es ||
  
  === Overlaps ===
+ Returns TRUE if the Geometries share space, are of the same dimension, but 
are not completely contained by each other.
+ 
+ '''Syntax:''' ''geof:sfOverlaps(geom1, geom2)''
+ 
+ '''Sample Query'''
+ {{{
+ PREFIX geoes: <http://geo.marmotta.es/ontology#>
+ PREFIX geo: <http://www.opengis.net/ont/geosparql#>
+ PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
+ 
+ SELECT DISTINCT ?labelMunicipios 
+ WHERE {  
+   ?class a <http://geo.marmotta.es/ontology#provincia>.
+   ?class rdfs:label "Madrid"@es.
+   ?class geoes:hasExactGeometry ?geo.
+   ?geo geo:asWKT ?wkt.
+   
+   ?class2 a <http://geo.marmotta.es/ontology#municipio>.
+   ?class2 rdfs:label ?labelMunicipios.
+   ?class2 geoes:hasExactGeometry ?geo2.
+   ?geo2 geo:asWKT ?wkt2.
+   
+   FILTER (geof:sfOverlaps(?wkt, ?wkt2))      
+ }
+ ORDER BY ?labelMunicipios
+ LIMIT 10
+ }}}
+ 
+ As result of this query we get the first ten towns that overlaps the Madrid 
province.
+ 
+ || '''''labelMunicipios''''' ||
+ || Acebeda (La) @es ||
+ || Alameda del Valle @es ||
+ || Aldea del Fresno @es ||
+ || Aldea en Cabo @es ||
+ || Aldealengua de Pedraza @es ||
+ || Almoguera @es ||
+ || Almorox @es ||
+ || Ambite @es ||
+ || Aranjuez @es ||
+ || Arcones @es ||
+ 
  === Relate ===
+ Returns true if the spatial relationship between geom1 and geom2 corresponds 
to one with acceptable values for the specified pattern-matrix. Otherwise, this 
function returns false. Pattern-matrix represents a 
[[https://en.wikipedia.org/wiki/DE-9IM|DE-9IM]] intersection pattern consisting 
of T (true) and F (false) values. The spatial reference system for geom1 is 
used for spatial calculations.
+ 
+ '''Syntax:''' ''geof:relate(geom1, geom2, pattern-matrix)''
+ 
+ '''Sample Query'''
+ {{{
+ PREFIX geoes: <http://geo.marmotta.es/ontology#>
+ PREFIX geo: <http://www.opengis.net/ont/geosparql#>
+ PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
+ 
+ SELECT DISTINCT ?labelRios 
+ WHERE {  
+   ?class a <http://geo.marmotta.es/ontology#provincia>.
+   ?class rdfs:label "Madrid"@es.
+   ?class geoes:hasExactGeometry ?geo.
+   ?geo geo:asWKT ?wkt.
+   
+   ?class2 a <http://geo.marmotta.es/ontology#rio>.
+   ?class2 rdfs:label ?labelRios.
+   ?class2 geoes:hasExactGeometry ?geo2.
+   ?geo2 geo:asWKT ?wkt2.
+   
+   FILTER (geof:relate(?wkt, ?wkt2, 'T********'))      
+ }
+ }}}
+ 
+ As result of this query we get the rivers that intersects the Madrid 
province. This ''T********'' pattern-matrix means intersection.
+ 
+ || '''''labelRios''''' ||
+ || Río Manzanares @es ||
+ || Río Tajuña @es ||
+ || Río Henares @es ||
+ || Río Alberche @es ||
+ || Río Algodor @es ||
+ || Río Tajo @es ||
+ || Río Guadarrama @es ||
+ || Río Jarama @es ||
+ 
  === Touches ===
  === Within ===
  

Reply via email to