conversations
listlengths
2
2
[ { "from": "human", "value": "Find roads that also have :hasNumberOfUnits property (if data is incorrect)." }, { "from": "gpt", "value": "```sparql\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?road ?units\nWHERE {\n ?road rdf:type :Road ;\n :hasNumberOfUnits ?units .\n}\n```" } ]
[ { "from": "human", "value": "Find all geometry WKT values that do not match a recognized type (e.g., not containing 'POINT', 'LINESTRING', or 'POLYGON')." }, { "from": "gpt", "value": "```sparql\nPREFIX geo: <http://www.opengis.net/ont/geosparql#>\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?geom ?wkt\nWHERE {\n ?feat :hasGeometry ?geom .\n ?geom geo:asWKT ?wkt .\n FILTER(\n !regex(?wkt, \"POINT|LINESTRING|POLYGON\", \"i\")\n )\n}\n```" } ]
[ { "from": "human", "value": "Compute the total number of constructions that have addresses on 'Main Street' or 'High Street'." }, { "from": "gpt", "value": "```sparql\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT (COUNT(DISTINCT ?c) AS ?count)\nWHERE {\n ?c rdf:type :Construction ;\n :hasAddress ?addr .\n ?addr :hasStreetName ?street .\n FILTER(?street = \"Main Street\" || ?street = \"High Street\")\n}\n```" } ]
[ { "from": "human", "value": "Find addresses that appear multiple times (linked to different resources)." }, { "from": "gpt", "value": "```sparql\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?addr (COUNT(DISTINCT ?resource) AS ?usageCount)\nWHERE {\n ?resource :hasAddress ?addr .\n}\nGROUP BY ?addr\nHAVING(COUNT(DISTINCT ?resource) > 1)\n```" } ]
[ { "from": "human", "value": "Find buildings that have geometry but no construction year." }, { "from": "gpt", "value": "```sparql\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?building\nWHERE {\n ?building rdf:type :Building ;\n :hasGeometry ?geom .\n FILTER NOT EXISTS {\n ?building :hasConstructionYear ?year .\n }\n}\n```" } ]
[ { "from": "human", "value": "Find all addresses, but return 'NO STREET' if :hasStreetName is missing." }, { "from": "gpt", "value": "```sparql\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?addr (COALESCE(?name, \"NO STREET\") AS ?street)\nWHERE {\n ?addr rdf:type :Address .\n OPTIONAL { ?addr :hasStreetName ?name . }\n}\n```" } ]
[ { "from": "human", "value": "List roads, their geometry, and WKT if present." }, { "from": "gpt", "value": "```sparql\nPREFIX geo: <http://www.opengis.net/ont/geosparql#>\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?road ?geom ?wkt\nWHERE {\n ?road rdf:type :Road .\n OPTIONAL {\n ?road :hasGeometry ?geom .\n OPTIONAL {\n ?geom geo:asWKT ?wkt .\n }\n }\n}\n```" } ]
[ { "from": "human", "value": "Find all geometry WKT strings that start with 'POLYGON'." }, { "from": "gpt", "value": "```sparql\nPREFIX geo: <http://www.opengis.net/ont/geosparql#>\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?geom ?wkt\nWHERE {\n ?feat :hasGeometry ?geom .\n ?geom geo:asWKT ?wkt .\n FILTER regex(?wkt, \"^POLYGON\", \"i\")\n}\n```" } ]
[ { "from": "human", "value": "Count roads that have a WKT geometry containing 'MULTI'." }, { "from": "gpt", "value": "```sparql\nPREFIX geo: <http://www.opengis.net/ont/geosparql#>\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT (COUNT(?road) AS ?count)\nWHERE {\n ?road rdf:type :Road ;\n :hasGeometry ?geom .\n ?geom geo:asWKT ?wkt .\n FILTER regex(?wkt, \"MULTI\", \"i\")\n}\n```" } ]
[ { "from": "human", "value": "Find the earliest construction year among buildings and roads together." }, { "from": "gpt", "value": "```sparql\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT (MIN(?year) AS ?earliest)\nWHERE {\n {\n ?x rdf:type :Building ;\n :hasConstructionYear ?year .\n } UNION {\n ?x rdf:type :Road ;\n :hasConstructionYear ?year .\n }\n}\n```" } ]
[ { "from": "human", "value": "Select all resources that are typed as both a Road and a Building." }, { "from": "gpt", "value": "```sparql\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?x\nWHERE {\n ?x rdf:type :Road , :Building .\n}\n```" } ]
[ { "from": "human", "value": "List addresses with civic numbers above average civic number overall." }, { "from": "gpt", "value": "```sparql\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?addr ?num\nWHERE {\n ?addr rdf:type :Address ;\n :hasCivicNumber ?num .\n FILTER(?num > {\n SELECT (AVG(?n) AS ?avgNum)\n WHERE {\n ?a rdf:type :Address ;\n :hasCivicNumber ?n .\n }\n })\n}\n```" } ]
[ { "from": "human", "value": "List all addresses typed also as :Construction but no geometry." }, { "from": "gpt", "value": "```sparql\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?addr\nWHERE {\n ?addr rdf:type :Address , :Construction .\n FILTER NOT EXISTS { ?addr :hasGeometry ?geom }\n}\n```" } ]
[ { "from": "human", "value": "Find buildings that share the same civic number as their year, with an address referencing it." }, { "from": "gpt", "value": "```sparql\nPREFIX : <http://example.org/ontology#>\nSELECT ?b\nWHERE {\n ?b a :Building ;\n :hasConstructionYear ?year ;\n :hasAddress ?addr .\n ?addr :hasCivicNumber ?num .\n FILTER(?num = ?year)\n}\n```" } ]
[ { "from": "human", "value": "Retrieve roads typed as geo:Feature but no :hasGeometry property." }, { "from": "gpt", "value": "```sparql\nPREFIX geo: <http://www.opengis.net/ont/geosparql#>\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?road\nWHERE {\n ?road rdf:type :Road , geo:Feature .\n FILTER NOT EXISTS { ?road :hasGeometry ?g }\n}\n```" } ]
[ { "from": "human", "value": "Count addresses that appear under two distinct buildings." }, { "from": "gpt", "value": "```sparql\nPREFIX : <http://example.org/ontology#>\nSELECT (COUNT(DISTINCT ?addr) AS ?count)\nWHERE {\n ?b1 :hasAddress ?addr ; a :Building .\n ?b2 :hasAddress ?addr ; a :Building .\n FILTER(?b1 != ?b2)\n}\n```" } ]
[ { "from": "human", "value": "List constructions with the year less than 100, possibly data errors." }, { "from": "gpt", "value": "```sparql\nPREFIX : <http://example.org/ontology#>\nSELECT ?c\nWHERE {\n ?c a :Construction ;\n :hasConstructionYear ?y .\n FILTER(?y < 100)\n}\n```" } ]
[ { "from": "human", "value": "Find buildings typed also as :Road or :Address, ignoring geometry or year." }, { "from": "gpt", "value": "```sparql\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?b\nWHERE {\n ?b rdf:type :Building .\n FILTER(EXISTS { ?b rdf:type :Road } || EXISTS { ?b rdf:type :Address })\n}\n```" } ]
[ { "from": "human", "value": "Retrieve addresses that have a geometry typed as wktLiteral, but no street name." }, { "from": "gpt", "value": "```sparql\nPREFIX geo: <http://www.opengis.net/ont/geosparql#>\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?addr\nWHERE {\n ?addr rdf:type :Address ;\n :hasGeometry ?g .\n ?g geo:asWKT ?wkt .\n FILTER NOT EXISTS { ?addr :hasStreetName ?s }\n}\n```" } ]
[ { "from": "human", "value": "Show roads that have a numeric street name matching their year plus 1." }, { "from": "gpt", "value": "```sparql\nPREFIX : <http://example.org/ontology#>\nSELECT ?r\nWHERE {\n ?r a :Road ;\n :hasConstructionYear ?year ;\n :hasAddress ?addr .\n ?addr :hasStreetName ?s .\n FILTER(STR(?year + 1) = ?s)\n}\n```" } ]
[ { "from": "human", "value": "Count buildings that have geometry referencing a 'BOX' literal in WKT." }, { "from": "gpt", "value": "```sparql\nPREFIX geo:<http://www.opengis.net/ont/geosparql#>\nPREFIX : <http://example.org/ontology#>\n\nSELECT (COUNT(?b) AS ?count)\nWHERE {\n ?b a :Building ;\n :hasGeometry ?g .\n ?g geo:asWKT ?wkt .\n FILTER regex(?wkt, \"BOX\", \"i\")\n}\n```" } ]
[ { "from": "human", "value": "Retrieve addresses typed incorrectly as :Road, referencing geometry with random text in WKT." }, { "from": "gpt", "value": "```sparql\nPREFIX geo:<http://www.opengis.net/ont/geosparql#>\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?addr\nWHERE {\n ?addr rdf:type :Address , :Road ;\n :hasGeometry ?g .\n ?g geo:asWKT ?wkt .\n FILTER regex(?wkt, \"RANDOM\", \"i\")\n}\n```" } ]
[ { "from": "human", "value": "Find buildings with addresses that have civic numbers above 200 and no geometry." }, { "from": "gpt", "value": "```sparql\nPREFIX :<http://example.org/ontology#>\nSELECT ?b\nWHERE {\n ?b a :Building ;\n :hasAddress ?addr .\n ?addr :hasCivicNumber ?num .\n FILTER(?num > 200)\n FILTER NOT EXISTS { ?addr :hasGeometry ?g }\n}\n```" } ]
[ { "from": "human", "value": "312) Show roads referencing geometry typed incorrectly as integer instead of wktLiteral." }, { "from": "gpt", "value": "```sparql\nPREFIX geo:<http://www.opengis.net/ont/geosparql#>\nPREFIX xsd:<http://www.w3.org/2001/XMLSchema#>\nPREFIX : <http://example.org/ontology#>\n\nSELECT ?r ?val\nWHERE {\n ?r a :Road ;\n :hasGeometry ?geom .\n ?geom geo:asWKT ?val .\n FILTER(datatype(?val) = xsd:integer)\n}\n```" } ]
[ { "from": "human", "value": "313) Count addresses typed also as :Building that have no street name or civic number." }, { "from": "gpt", "value": "```sparql\nPREFIX :<http://example.org/ontology#>\nPREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT (COUNT(?addr) AS ?count)\nWHERE {\n ?addr rdf:type :Address , :Building .\n FILTER NOT EXISTS { ?addr :hasStreetName ?s }\n FILTER NOT EXISTS { ?addr :hasCivicNumber ?n }\n}\n```" } ]
[ { "from": "human", "value": "314) List constructions with a geometry referencing 'MULTILINESTRING Z'." }, { "from": "gpt", "value": "```sparql\nPREFIX geo:<http://www.opengis.net/ont/geosparql#>\nPREFIX : <http://example.org/ontology#>\n\nSELECT ?c\nWHERE {\n ?c a :Construction ;\n :hasGeometry ?g .\n ?g geo:asWKT ?wkt .\n FILTER regex(?wkt, \"MULTILINESTRING Z\", \"i\")\n}\n```" } ]
[ { "from": "human", "value": "Retrieve buildings typed incorrectly also as vcard:Address, ignoring units/year." }, { "from": "gpt", "value": "```sparql\nPREFIX vcard:<http://www.w3.org/2006/vcard/ns#>\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?b\nWHERE {\n ?b rdf:type :Building , vcard:Address .\n}\n```" } ]
[ { "from": "human", "value": "Find roads that have addresses referencing multiple numeric street names." }, { "from": "gpt", "value": "```sparql\nPREFIX :<http://example.org/ontology#>\nSELECT ?road\nWHERE {\n ?road a :Road ;\n :hasAddress ?addr .\n ?addr :hasStreetName ?s .\n FILTER regex(?s, \"^[0-9]\")\n {\n SELECT ?addr (COUNT(?s) AS ?countS)\n WHERE {\n ?addr :hasStreetName ?s2 .\n FILTER regex(?s2, \"^[0-9]\")\n }\n GROUP BY ?addr\n HAVING(?countS > 1)\n }\n}\n```" } ]
[ { "from": "human", "value": "Show addresses that contain 'Drive' or 'Way' in the street name." }, { "from": "gpt", "value": "```sparql\nPREFIX :<http://example.org/ontology#>\nSELECT ?addr ?s\nWHERE {\n ?addr a :Address ;\n :hasStreetName ?s .\n FILTER regex(?s, \"(Drive|Way)\", \"i\")\n}\n```" } ]
[ { "from": "human", "value": "Count buildings that have geometry referencing more than one WKT (multiple geometry entries)." }, { "from": "gpt", "value": "```sparql\nPREFIX :<http://example.org/ontology#>\nPREFIX geo:<http://www.opengis.net/ont/geosparql#>\n\nSELECT (COUNT(?b) AS ?count)\nWHERE {\n {\n SELECT ?b (COUNT(?g) AS ?gCount)\n WHERE {\n ?b a :Building ;\n :hasGeometry ?g .\n }\n GROUP BY ?b\n HAVING(?gCount > 1)\n }\n}\n```" } ]
[ { "from": "human", "value": "Retrieve roads typed as :Construction that have year = 0." }, { "from": "gpt", "value": "```sparql\nPREFIX :<http://example.org/ontology#>\nPREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?road\nWHERE {\n ?road rdf:type :Road , :Construction ;\n :hasConstructionYear ?y .\n FILTER(?y = 0)\n}\n```" } ]
[ { "from": "human", "value": "Find buildings with addresses referencing geometry typed incorrectly as xsd:boolean." }, { "from": "gpt", "value": "```sparql\nPREFIX xsd:<http://www.w3.org/2001/XMLSchema#>\nPREFIX geo:<http://www.opengis.net/ont/geosparql#>\nPREFIX :<http://example.org/ontology#>\n\nSELECT ?b ?val\nWHERE {\n ?b a :Building ;\n :hasAddress ?addr .\n ?addr :hasGeometry ?g .\n ?g geo:asWKT ?val .\n FILTER(datatype(?val) = xsd:boolean)\n}\n```" } ]
[ { "from": "human", "value": "321) Show addresses typed incorrectly also as :GeoSPARQL Geometry but do have :hasStreetName." }, { "from": "gpt", "value": "```sparql\nPREFIX geo:<http://www.opengis.net/ont/geosparql#>\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?addr\nWHERE {\n ?addr rdf:type :Address , geo:Geometry ;\n :hasStreetName ?s .\n}\n```" } ]
[ { "from": "human", "value": "Count roads that have addresses referencing street names with trailing punctuation (regex)." }, { "from": "gpt", "value": "```sparql\nPREFIX :<http://example.org/ontology#>\nSELECT (COUNT(DISTINCT ?road) AS ?count)\nWHERE {\n ?road a :Road ;\n :hasAddress ?addr .\n ?addr :hasStreetName ?name .\n FILTER regex(?name, \"[^a-zA-Z0-9]$\", \"i\")\n}\n```" } ]
[ { "from": "human", "value": "Retrieve buildings typed also as :Address with no :hasGeometry." }, { "from": "gpt", "value": "```sparql\nPREFIX :<http://example.org/ontology#>\nPREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?b\nWHERE {\n ?b rdf:type :Building , :Address .\n FILTER NOT EXISTS { ?b :hasGeometry ?g }\n}\n```" } ]
[ { "from": "human", "value": "List constructions that have geometry referencing 'SURFACECURVE'." }, { "from": "gpt", "value": "```sparql\nPREFIX geo:<http://www.opengis.net/ont/geosparql#>\nPREFIX : <http://example.org/ontology#>\n\nSELECT ?c\nWHERE {\n ?c a :Construction ;\n :hasGeometry ?g .\n ?g geo:asWKT ?wkt .\n FILTER regex(?wkt, \"SURFACECURVE\", \"i\")\n}\n```" } ]
[ { "from": "human", "value": "325) Find addresses typed incorrectly also as vcard:Address that have numeric street name and civic number." }, { "from": "gpt", "value": "```sparql\nPREFIX vcard:<http://www.w3.org/2006/vcard/ns#>\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?addr\nWHERE {\n ?addr rdf:type :Address , vcard:Address ;\n :hasStreetName ?s ;\n :hasCivicNumber ?n .\n FILTER regex(?s, \"^[0-9]\")\n}\n```" } ]
[ { "from": "human", "value": "326) Show roads that have addresses typed also as :Construction, referencing geometry with 'Z'." }, { "from": "gpt", "value": "```sparql\nPREFIX geo:<http://www.opengis.net/ont/geosparql#>\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?road ?addr\nWHERE {\n ?road rdf:type :Road ;\n :hasAddress ?addr .\n ?addr rdf:type :Construction ;\n :hasGeometry ?g .\n ?g geo:asWKT ?wkt .\n FILTER regex(?wkt, \" Z\")\n}\n```" } ]
[ { "from": "human", "value": "327) Count buildings that have geometry referencing 'ArcString' in WKT (another extension)." }, { "from": "gpt", "value": "```sparql\nPREFIX geo:<http://www.opengis.net/ont/geosparql#>\nPREFIX : <http://example.org/ontology#>\n\nSELECT (COUNT(?b) AS ?count)\nWHERE {\n ?b a :Building ;\n :hasGeometry ?g .\n ?g geo:asWKT ?wkt .\n FILTER regex(?wkt, \"ARCSTRING\", \"i\")\n}\n```" } ]
[ { "from": "human", "value": "328) Retrieve addresses typed incorrectly also as :Road or :Building, ignoring geometry." }, { "from": "gpt", "value": "```sparql\nPREFIX :<http://example.org/ontology#>\nPREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?addr\nWHERE {\n ?addr rdf:type :Address .\n FILTER(EXISTS { ?addr rdf:type :Road } || EXISTS { ?addr rdf:type :Building })\n}\n```" } ]
[ { "from": "human", "value": "329) List constructions that share the same geometry WKT with a building but have a different year." }, { "from": "gpt", "value": "```sparql\nPREFIX geo:<http://www.opengis.net/ont/geosparql#>\nPREFIX : <http://example.org/ontology#>\n\nSELECT ?c ?b\nWHERE {\n ?c a :Construction ; :hasGeometry ?cg ; :hasConstructionYear ?cy .\n ?cg geo:asWKT ?cw .\n ?b a :Building ; :hasGeometry ?bg ; :hasConstructionYear ?by .\n ?bg geo:asWKT ?bw .\n FILTER(?cw = ?bw && ?cy != ?by)\n}\n```" } ]
[ { "from": "human", "value": "330) Find roads typed also as vcard:Address but have no addresses themselves." }, { "from": "gpt", "value": "```sparql\nPREFIX vcard:<http://www.w3.org/2006/vcard/ns#>\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?r\nWHERE {\n ?r rdf:type :Road , vcard:Address .\n FILTER NOT EXISTS { ?r :hasAddress ?addr }\n}\n```" } ]
[ { "from": "human", "value": "331) Show addresses that have geometry referencing 'UNKNOWN' SRID or shape." }, { "from": "gpt", "value": "```sparql\nPREFIX geo:<http://www.opengis.net/ont/geosparql#>\nPREFIX : <http://example.org/ontology#>\n\nSELECT ?addr\nWHERE {\n ?addr a :Address ;\n :hasGeometry ?geom .\n ?geom geo:asWKT ?wkt .\n FILTER regex(?wkt, \"UNKNOWN\", \"i\")\n}\n```" } ]
[ { "from": "human", "value": "332) Count buildings with addresses typed incorrectly also as :Geometry, referencing WKT that has '3.1415' (Pi?)." }, { "from": "gpt", "value": "```sparql\nPREFIX geo:<http://www.opengis.net/ont/geosparql#>\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT (COUNT(?b) AS ?count)\nWHERE {\n ?b a :Building ;\n :hasAddress ?addr .\n ?addr rdf:type :Geometry ;\n :hasGeometry ?g .\n ?g geo:asWKT ?wkt .\n FILTER contains(?wkt, \"3.1415\")\n}\n```" } ]
[ { "from": "human", "value": "333) Retrieve roads typed also as :Construction, but have geometry referencing negative lat/long in WKT." }, { "from": "gpt", "value": "```sparql\nPREFIX geo:<http://www.opengis.net/ont/geosparql#>\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?r\nWHERE {\n ?r rdf:type :Road , :Construction ;\n :hasGeometry ?g .\n ?g geo:asWKT ?wkt .\n FILTER regex(?wkt, \"-\\\\d+\\\\.\\\\d+ -\\\\d+\\\\.\")\n}\n```" } ]
[ { "from": "human", "value": "334) Show buildings that have 3 addresses, each referencing geometry with 'LINESTRING' or 'POLYGON'." }, { "from": "gpt", "value": "```sparql\nPREFIX geo:<http://www.opengis.net/ont/geosparql#>\nPREFIX : <http://example.org/ontology#>\n\nSELECT ?b\nWHERE {\n ?b a :Building ;\n :hasAddress ?a1, ?a2, ?a3 .\n ?a1 :hasGeometry ?g1 . ?g1 geo:asWKT ?w1 .\n ?a2 :hasGeometry ?g2 . ?g2 geo:asWKT ?w2 .\n ?a3 :hasGeometry ?g3 . ?g3 geo:asWKT ?w3 .\n FILTER((regex(?w1, \"LINESTRING|POLYGON\", \"i\")) &&\n (regex(?w2, \"LINESTRING|POLYGON\", \"i\")) &&\n (regex(?w3, \"LINESTRING|POLYGON\", \"i\")))\n}\n```" } ]
[ { "from": "human", "value": "335) Find addresses typed as :Building or :Road but lacking any geometry or civic number." }, { "from": "gpt", "value": "```sparql\nPREFIX :<http://example.org/ontology#>\nPREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?addr\nWHERE {\n ?addr rdf:type :Address .\n FILTER(EXISTS { ?addr rdf:type :Building } || EXISTS { ?addr rdf:type :Road })\n FILTER NOT EXISTS { ?addr :hasGeometry ?g }\n FILTER NOT EXISTS { ?addr :hasCivicNumber ?n }\n}\n```" } ]
[ { "from": "human", "value": "336) Compute average year among roads that have addresses with 'Street' in the name." }, { "from": "gpt", "value": "```sparql\nPREFIX :<http://example.org/ontology#>\nSELECT (AVG(?y) AS ?avgYear)\nWHERE {\n ?r a :Road ;\n :hasConstructionYear ?y ;\n :hasAddress ?addr .\n ?addr :hasStreetName ?name .\n FILTER regex(?name, \"Street\", \"i\")\n}\n```" } ]
[ { "from": "human", "value": "337) List constructions that have geometry referencing 'COMPONENTS' in WKT (unusual extension)." }, { "from": "gpt", "value": "```sparql\nPREFIX geo:<http://www.opengis.net/ont/geosparql#>\nPREFIX : <http://example.org/ontology#>\n\nSELECT ?c\nWHERE {\n ?c a :Construction ;\n :hasGeometry ?g .\n ?g geo:asWKT ?wkt .\n FILTER regex(?wkt, \"COMPONENTS\", \"i\")\n}\n```" } ]
[ { "from": "human", "value": "338) Find buildings typed also as vcard:Address, referencing addresses that are typed as roads (complete confusion)." }, { "from": "gpt", "value": "```sparql\nPREFIX vcard:<http://www.w3.org/2006/vcard/ns#>\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?b ?addr\nWHERE {\n ?b rdf:type :Building , vcard:Address ;\n :hasAddress ?addr .\n ?addr rdf:type :Road .\n}\n```" } ]
[ { "from": "human", "value": "339) Count how many addresses do not link to any building, road, or construction." }, { "from": "gpt", "value": "```sparql\nPREFIX :<http://example.org/ontology#>\nSELECT (COUNT(?addr) AS ?count)\nWHERE {\n ?addr a :Address .\n FILTER NOT EXISTS { ?b a :Building ; :hasAddress ?addr }\n FILTER NOT EXISTS { ?r a :Road ; :hasAddress ?addr }\n FILTER NOT EXISTS { ?c a :Construction ; :hasAddress ?addr }\n}\n```" } ]
[ { "from": "human", "value": "Find buildings typed also as geo:Feature with no addresses and year > 3000." }, { "from": "gpt", "value": "```sparql\nPREFIX geo:<http://www.opengis.net/ont/geosparql#>\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?b\nWHERE {\n ?b rdf:type :Building , geo:Feature ;\n :hasConstructionYear ?y .\n FILTER(?y > 3000)\n FILTER NOT EXISTS { ?b :hasAddress ?addr }\n}\n```" } ]
[ { "from": "human", "value": "343) List roads that have addresses referencing geometry with 'LOWER' or 'UPPER' expansions." }, { "from": "gpt", "value": "```sparql\nPREFIX geo:<http://www.opengis.net/ont/geosparql#>\nPREFIX : <http://example.org/ontology#>\n\nSELECT ?road\nWHERE {\n ?road a :Road ;\n :hasAddress ?addr .\n ?addr :hasGeometry ?g .\n ?g geo:asWKT ?wkt .\n FILTER regex(?wkt, \"(LOWER|UPPER)\", \"i\")\n}\n```" } ]
[ { "from": "human", "value": "344) Compute the sum of all building units typed incorrectly as string." }, { "from": "gpt", "value": "```sparql\nPREFIX xsd:<http://www.w3.org/2001/XMLSchema#>\nPREFIX : <http://example.org/ontology#>\n\nSELECT (SUM(xsd:integer(?val)) AS ?total)\nWHERE {\n ?b a :Building ;\n :hasNumberOfUnits ?val .\n FILTER(datatype(?val) = xsd:string)\n}\n```" } ]
[ { "from": "human", "value": "345) Show constructions that have geometry referencing 'BEZIER' (uncommon geometry)." }, { "from": "gpt", "value": "```sparql\nPREFIX geo:<http://www.opengis.net/ont/geosparql#>\nPREFIX : <http://example.org/ontology#>\n\nSELECT ?c\nWHERE {\n ?c a :Construction ;\n :hasGeometry ?g .\n ?g geo:asWKT ?wkt .\n FILTER regex(?wkt, \"BEZIER\", \"i\")\n}\n```" } ]
[ { "from": "human", "value": "346) Find addresses typed incorrectly as :Building or :Construction that have negative civic numbers." }, { "from": "gpt", "value": "```sparql\nPREFIX :<http://example.org/ontology#>\nPREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?addr ?num\nWHERE {\n ?addr rdf:type :Address .\n FILTER(EXISTS { ?addr rdf:type :Building } || EXISTS { ?addr rdf:type :Construction })\n ?addr :hasCivicNumber ?num .\n FILTER(?num < 0)\n}\n```" } ]
[ { "from": "human", "value": "347) Count roads that have addresses with geometry referencing 'ROTATED' or 'SCALED' (GIS transformations?)." }, { "from": "gpt", "value": "```sparql\nPREFIX geo:<http://www.opengis.net/ont/geosparql#>\nPREFIX : <http://example.org/ontology#>\nSELECT (COUNT(?road) AS ?count)\nWHERE {\n ?road a :Road ;\n :hasAddress ?addr .\n ?addr :hasGeometry ?g .\n ?g geo:asWKT ?wkt .\n FILTER regex(?wkt, \"(ROTATED|SCALED)\", \"i\")\n}\n```" } ]
[ { "from": "human", "value": "348) Retrieve buildings with addresses typed incorrectly as vcard:Address but missing street name." }, { "from": "gpt", "value": "```sparql\nPREFIX vcard:<http://www.w3.org/2006/vcard/ns#>\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?b\nWHERE {\n ?b a :Building ;\n :hasAddress ?addr .\n ?addr rdf:type vcard:Address .\n FILTER NOT EXISTS { ?addr :hasStreetName ?n }\n}\n```" } ]
[ { "from": "human", "value": "349) Show roads that have geometry referencing 'SIGN' or 'SYMBOL' in WKT (extreme case)." }, { "from": "gpt", "value": "```sparql\nPREFIX geo:<http://www.opengis.net/ont/geosparql#>\nPREFIX : <http://example.org/ontology#>\n\nSELECT ?r\nWHERE {\n ?r a :Road ;\n :hasGeometry ?g .\n ?g geo:asWKT ?wkt .\n FILTER regex(?wkt, \"(SIGN|SYMBOL)\", \"i\")\n}\n```" } ]
[ { "from": "human", "value": "350) List addresses typed incorrectly also as :Road that have an integer as street name (data confusion)." }, { "from": "gpt", "value": "```sparql\nPREFIX xsd:<http://www.w3.org/2001/XMLSchema#>\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?addr ?s\nWHERE {\n ?addr rdf:type :Address , :Road ;\n :hasStreetName ?s .\n FILTER(datatype(?s) = xsd:integer)\n}\n```" } ]
[ { "from": "human", "value": "351) Find buildings typed as geo:Feature with addresses referencing geometry containing '2.71828' (Euler's number?)." }, { "from": "gpt", "value": "```sparql\nPREFIX geo:<http://www.opengis.net/ont/geosparql#>\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?b\nWHERE {\n ?b rdf:type :Building , geo:Feature ;\n :hasAddress ?addr .\n ?addr :hasGeometry ?g .\n ?g geo:asWKT ?wkt .\n FILTER contains(?wkt, \"2.71828\")\n}\n```" } ]
[ { "from": "human", "value": "352) Count roads that have a year typed as xsd:string but numeric addresses." }, { "from": "gpt", "value": "```sparql\nPREFIX xsd:<http://www.w3.org/2001/XMLSchema#>\nPREFIX : <http://example.org/ontology#>\nSELECT (COUNT(?road) AS ?count)\nWHERE {\n ?road a :Road ;\n :hasConstructionYear ?y ;\n :hasAddress ?addr .\n FILTER(datatype(?y) = xsd:string)\n ?addr :hasCivicNumber ?num .\n FILTER(datatype(?num) = xsd:integer)\n}\n```" } ]
[ { "from": "human", "value": "353) Retrieve addresses typed incorrectly also as :Construction but do have a geometry referencing 'POINT M'." }, { "from": "gpt", "value": "```sparql\nPREFIX geo:<http://www.opengis.net/ont/geosparql#>\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?addr\nWHERE {\n ?addr rdf:type :Address , :Construction ;\n :hasGeometry ?g .\n ?g geo:asWKT ?wkt .\n FILTER regex(?wkt, \"POINT M\", \"i\")\n}\n```" } ]
[ { "from": "human", "value": "354) Show buildings with geometry referencing 'solid' (case-insensitive) but typed incorrectly as xsd:string for year." }, { "from": "gpt", "value": "```sparql\nPREFIX xsd:<http://www.w3.org/2001/XMLSchema#>\nPREFIX geo:<http://www.opengis.net/ont/geosparql#>\nPREFIX : <http://example.org/ontology#>\nSELECT ?b\nWHERE {\n ?b a :Building ;\n :hasConstructionYear ?y ;\n :hasGeometry ?g .\n ?g geo:asWKT ?wkt .\n FILTER regex(?wkt, \"solid\", \"i\")\n FILTER(datatype(?y) = xsd:string)\n}\n```" } ]
[ { "from": "human", "value": "355) Find roads typed as vcard:Address with addresses referencing multiple street names." }, { "from": "gpt", "value": "```sparql\nPREFIX vcard:<http://www.w3.org/2006/vcard/ns#>\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?r\nWHERE {\n ?r rdf:type :Road , vcard:Address ;\n :hasAddress ?addr .\n {\n SELECT ?addr (COUNT(?s) AS ?countNames)\n WHERE {\n ?addr :hasStreetName ?s .\n }\n GROUP BY ?addr\n HAVING(?countNames > 1)\n }\n}\n```" } ]
[ { "from": "human", "value": "356) Count addresses typed also as :Building that have geometry referencing 'vertical' (some extension)." }, { "from": "gpt", "value": "```sparql\nPREFIX geo:<http://www.opengis.net/ont/geosparql#>\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT (COUNT(?addr) AS ?count)\nWHERE {\n ?addr rdf:type :Address , :Building ;\n :hasGeometry ?g .\n ?g geo:asWKT ?wkt .\n FILTER regex(?wkt, \"vertical\", \"i\")\n}\n```" } ]
[ { "from": "human", "value": "357) Retrieve buildings that have addresses with street name 'Unnamed Road'." }, { "from": "gpt", "value": "```sparql\nPREFIX :<http://example.org/ontology#>\nSELECT ?b\nWHERE {\n ?b a :Building ;\n :hasAddress ?addr .\n ?addr :hasStreetName \"Unnamed Road\" .\n}\n```" } ]
[ { "from": "human", "value": "358) Show roads typed incorrectly also as :Geometry that have no geometry WKT." }, { "from": "gpt", "value": "```sparql\nPREFIX geo:<http://www.opengis.net/ont/geosparql#>\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?r\nWHERE {\n ?r rdf:type :Road , geo:Geometry .\n FILTER NOT EXISTS {\n ?r geo:asWKT ?wkt .\n }\n}\n```" } ]
[ { "from": "human", "value": "359) Find addresses that have civic number 9999 but typed incorrectly as xsd:string." }, { "from": "gpt", "value": "```sparql\nPREFIX xsd:<http://www.w3.org/2001/XMLSchema#>\nPREFIX : <http://example.org/ontology#>\n\nSELECT ?addr ?val\nWHERE {\n ?addr a :Address ;\n :hasCivicNumber ?val .\n FILTER(datatype(?val) = xsd:string && ?val = \"9999\")\n}\n```" } ]
[ { "from": "human", "value": "List buildings typed also as :Address that have geometry referencing 'ELLIPSE' or 'CURVE'." }, { "from": "gpt", "value": "```sparql\nPREFIX geo:<http://www.opengis.net/ont/geosparql#>\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?b\nWHERE {\n ?b rdf:type :Building , :Address ;\n :hasGeometry ?g .\n ?g geo:asWKT ?wkt .\n FILTER regex(?wkt, \"(ELLIPSE|CURVE)\", \"i\")\n}\n```" } ]
[ { "from": "human", "value": "Count roads that have addresses typed incorrectly also as :Building, but no geometry for either." }, { "from": "gpt", "value": "```sparql\nPREFIX :<http://example.org/ontology#>\nPREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT (COUNT(?road) AS ?count)\nWHERE {\n ?road rdf:type :Road ;\n :hasAddress ?addr .\n ?addr rdf:type :Building .\n FILTER NOT EXISTS { ?road :hasGeometry ?rg }\n FILTER NOT EXISTS { ?addr :hasGeometry ?ag }\n}\n```" } ]
[ { "from": "human", "value": "362) Retrieve buildings referencing geometry that includes 'ARC ZM' for 4D arcs." }, { "from": "gpt", "value": "```sparql\nPREFIX geo:<http://www.opengis.net/ont/geosparql#>\nPREFIX : <http://example.org/ontology#>\nSELECT ?b\nWHERE {\n ?b a :Building ;\n :hasGeometry ?g .\n ?g geo:asWKT ?wkt .\n FILTER regex(?wkt, \"ARC ZM\", \"i\")\n}\n```" } ]
[ { "from": "human", "value": "363) Show addresses typed also as vcard:Address that do not appear in any building or road." }, { "from": "gpt", "value": "```sparql\nPREFIX vcard:<http://www.w3.org/2006/vcard/ns#>\nPREFIX : <http://example.org/ontology#>\n\nSELECT ?addr\nWHERE {\n ?addr a :Address , vcard:Address .\n FILTER NOT EXISTS { ?b a :Building ; :hasAddress ?addr }\n FILTER NOT EXISTS { ?r a :Road ; :hasAddress ?addr }\n}\n```" } ]
[ { "from": "human", "value": "364) Find buildings typed incorrectly also as :Geometry that have a year above 9999 (nonsensical)." }, { "from": "gpt", "value": "```sparql\nPREFIX geo:<http://www.opengis.net/ont/geosparql#>\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?b\nWHERE {\n ?b rdf:type :Building , geo:Geometry ;\n :hasConstructionYear ?y .\n FILTER(?y > 9999)\n}\n```" } ]
[ { "from": "human", "value": "365) List roads referencing geometry with 'TRIANGLE M' or 'TIN M' in WKT." }, { "from": "gpt", "value": "```sparql\nPREFIX geo:<http://www.opengis.net/ont/geosparql#>\nPREFIX : <http://example.org/ontology#>\n\nSELECT ?r\nWHERE {\n ?r a :Road ;\n :hasGeometry ?g .\n ?g geo:asWKT ?wkt .\n FILTER regex(?wkt, \"(TRIANGLE M|TIN M)\", \"i\")\n}\n```" } ]
[ { "from": "human", "value": "366) Compute average year of buildings that do not have addresses or geometry." }, { "from": "gpt", "value": "```sparql\nPREFIX :<http://example.org/ontology#>\nSELECT (AVG(?y) AS ?avgYear)\nWHERE {\n ?b a :Building ;\n :hasConstructionYear ?y .\n FILTER NOT EXISTS { ?b :hasAddress ?addr }\n FILTER NOT EXISTS { ?b :hasGeometry ?geom }\n}\n```" } ]
[ { "from": "human", "value": "367) Retrieve addresses typed incorrectly also as :Road that have geometry referencing 'TrIm' (case-insensitive partial?)." }, { "from": "gpt", "value": "```sparql\nPREFIX geo:<http://www.opengis.net/ont/geosparql#>\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?addr\nWHERE {\n ?addr rdf:type :Address , :Road ;\n :hasGeometry ?g .\n ?g geo:asWKT ?wkt .\n FILTER regex(?wkt, \"TrIm\", \"i\")\n}\n```" } ]
[ { "from": "human", "value": "368) Show buildings with addresses on 'Old Street' or 'New Street', ignoring geometry/year." }, { "from": "gpt", "value": "```sparql\nPREFIX :<http://example.org/ontology#>\nSELECT ?b\nWHERE {\n ?b a :Building ;\n :hasAddress ?addr .\n ?addr :hasStreetName ?sn .\n FILTER(?sn IN (\"Old Street\", \"New Street\"))\n}\n```" } ]
[ { "from": "human", "value": "369) Count roads typed also as vcard:Address that have addresses referencing geometry with 'PATH'." }, { "from": "gpt", "value": "```sparql\nPREFIX vcard:<http://www.w3.org/2006/vcard/ns#>\nPREFIX geo:<http://www.opengis.net/ont/geosparql#>\nPREFIX : <http://example.org/ontology#>\n\nSELECT (COUNT(?r) AS ?count)\nWHERE {\n ?r a :Road , vcard:Address ;\n :hasAddress ?addr .\n ?addr :hasGeometry ?g .\n ?g geo:asWKT ?wkt .\n FILTER regex(?wkt, \"PATH\", \"i\")\n}\n```" } ]
[ { "from": "human", "value": "370) Retrieve buildings typed also as :Construction that have geometry referencing 'polygon' but typed incorrectly as xsd:string." }, { "from": "gpt", "value": "```sparql\nPREFIX xsd:<http://www.w3.org/2001/XMLSchema#>\nPREFIX geo:<http://www.opengis.net/ont/geosparql#>\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?b\nWHERE {\n ?b rdf:type :Building , :Construction ;\n :hasGeometry ?g .\n ?g geo:asWKT ?val .\n FILTER(regex(?val, \"polygon\", \"i\") && datatype(?val) = xsd:string)\n}\n```" } ]