conversations
listlengths 2
2
|
---|
[
{
"from": "human",
"value": "List all buildings."
},
{
"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}\n```"
}
] |
[
{
"from": "human",
"value": "List all roads."
},
{
"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 .\n}\n```"
}
] |
[
{
"from": "human",
"value": "List all addresses."
},
{
"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}\n```"
}
] |
[
{
"from": "human",
"value": "List all constructions."
},
{
"from": "gpt",
"value": "```sparql\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?construction\nWHERE {\n ?construction rdf:type :Construction .\n}\n```"
}
] |
[
{
"from": "human",
"value": "Find buildings with a number of units greater than 10."
},
{
"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 :hasNumberOfUnits ?units .\n FILTER(?units > 10)\n}\n```"
}
] |
[
{
"from": "human",
"value": "Find buildings with a number of units less than 5."
},
{
"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 :hasNumberOfUnits ?units .\n FILTER(?units < 5)\n}\n```"
}
] |
[
{
"from": "human",
"value": "Find buildings constructed after 2010."
},
{
"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 :hasConstructionYear ?year .\n FILTER(?year > 2010)\n}\n```"
}
] |
[
{
"from": "human",
"value": "Find roads constructed before 2000."
},
{
"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 ;\n :hasConstructionYear ?year .\n FILTER(?year < 2000)\n}\n```"
}
] |
[
{
"from": "human",
"value": "Retrieve the WKT geometry of all buildings."
},
{
"from": "gpt",
"value": "```sparql\nPREFIX : <http://example.org/ontology#>\nPREFIX geo: <http://www.opengis.net/ont/geosparql#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?building ?wkt\nWHERE {\n ?building rdf:type :Building ;\n :hasGeometry ?geom .\n ?geom geo:asWKT ?wkt .\n}\n```"
}
] |
[
{
"from": "human",
"value": "Retrieve the geometry of all roads."
},
{
"from": "gpt",
"value": "```sparql\nPREFIX : <http://example.org/ontology#>\nPREFIX geo: <http://www.opengis.net/ont/geosparql#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?road ?geom\nWHERE {\n ?road rdf:type :Road ;\n :hasGeometry ?geom .\n}\n```"
}
] |
[
{
"from": "human",
"value": "List buildings located on 'Main Street'."
},
{
"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 :hasAddress ?addr .\n ?addr :hasStreetName \"Main Street\" .\n}\n```"
}
] |
[
{
"from": "human",
"value": "Find the average number of units for buildings."
},
{
"from": "gpt",
"value": "```sparql\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT (AVG(?units) AS ?avgUnits)\nWHERE {\n ?building rdf:type :Building ;\n :hasNumberOfUnits ?units .\n}\n```"
}
] |
[
{
"from": "human",
"value": "Find the earliest construction year among roads."
},
{
"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 ?road rdf:type :Road ;\n :hasConstructionYear ?year .\n}\n```"
}
] |
[
{
"from": "human",
"value": "Find the latest construction year among buildings."
},
{
"from": "gpt",
"value": "```sparql\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT (MAX(?year) AS ?latest)\nWHERE {\n ?building rdf:type :Building ;\n :hasConstructionYear ?year .\n}\n```"
}
] |
[
{
"from": "human",
"value": "Find roads that do not have a construction year specified."
},
{
"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 .\n FILTER NOT EXISTS {\n ?road :hasConstructionYear ?year .\n }\n}\n```"
}
] |
[
{
"from": "human",
"value": "Find buildings that do not have a number of units specified."
},
{
"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 FILTER NOT EXISTS {\n ?building :hasNumberOfUnits ?units .\n }\n}\n```"
}
] |
[
{
"from": "human",
"value": "Find the count of all buildings."
},
{
"from": "gpt",
"value": "```sparql\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT (COUNT(?building) AS ?totalBuildings)\nWHERE {\n ?building rdf:type :Building .\n}\n```"
}
] |
[
{
"from": "human",
"value": "Find the total number of roads."
},
{
"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 ?totalRoads)\nWHERE {\n ?road rdf:type :Road .\n}\n```"
}
] |
[
{
"from": "human",
"value": "Find buildings with 'Civic Number' above 100."
},
{
"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 :hasAddress ?addr .\n ?addr :hasCivicNumber ?num .\n FILTER(?num > 100)\n}\n```"
}
] |
[
{
"from": "human",
"value": "Find addresses with no 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 NOT EXISTS {\n ?addr :hasCivicNumber ?num .\n }\n}\n```"
}
] |
[
{
"from": "human",
"value": "Find roads built between 1990 and 2000."
},
{
"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 ;\n :hasConstructionYear ?year .\n FILTER(?year >= 1990 && ?year <= 2000)\n}\n```"
}
] |
[
{
"from": "human",
"value": "Find roads built before 1980 or after 2020."
},
{
"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 ;\n :hasConstructionYear ?year .\n FILTER(?year < 1980 || ?year > 2020)\n}\n```"
}
] |
[
{
"from": "human",
"value": "Compute the average construction year for roads."
},
{
"from": "gpt",
"value": "```sparql\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT (AVG(?year) AS ?avgYear)\nWHERE {\n ?road rdf:type :Road ;\n :hasConstructionYear ?year .\n}\n```"
}
] |
[
{
"from": "human",
"value": "Compute the sum of all building units."
},
{
"from": "gpt",
"value": "```sparql\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT (SUM(?units) AS ?totalUnits)\nWHERE {\n ?b rdf:type :Building ;\n :hasNumberOfUnits ?units .\n}\n```"
}
] |
[
{
"from": "human",
"value": "List all buildings along with their address, if any."
},
{
"from": "gpt",
"value": "```sparql\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?building ?addr\nWHERE {\n ?building rdf:type :Building .\n OPTIONAL {\n ?building :hasAddress ?addr .\n }\n}\n```"
}
] |
[
{
"from": "human",
"value": "List all roads with optional geometry data."
},
{
"from": "gpt",
"value": "```sparql\nPREFIX : <http://example.org/ontology#>\nPREFIX geo: <http://www.opengis.net/ont/geosparql#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?road ?geom\nWHERE {\n ?road rdf:type :Road .\n OPTIONAL {\n ?road :hasGeometry ?geom .\n }\n}\n```"
}
] |
[
{
"from": "human",
"value": "Return the building, its street name, and 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 ?building ?street ?civic\nWHERE {\n ?building rdf:type :Building ;\n :hasAddress ?addr .\n ?addr :hasStreetName ?street ;\n :hasCivicNumber ?civic .\n}\n```"
}
] |
[
{
"from": "human",
"value": "Group buildings by construction year and count them."
},
{
"from": "gpt",
"value": "```sparql\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?year (COUNT(?building) AS ?count)\nWHERE {\n ?building rdf:type :Building ;\n :hasConstructionYear ?year .\n}\nGROUP BY ?year\n```"
}
] |
[
{
"from": "human",
"value": "List building and year, sorted by year ascending."
},
{
"from": "gpt",
"value": "```sparql\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?building ?year\nWHERE {\n ?building rdf:type :Building ;\n :hasConstructionYear ?year .\n}\nORDER BY ASC(?year)\n```"
}
] |
[
{
"from": "human",
"value": "List building and year, sorted by year descending."
},
{
"from": "gpt",
"value": "```sparql\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?building ?year\nWHERE {\n ?building rdf:type :Building ;\n :hasConstructionYear ?year .\n}\nORDER BY DESC(?year)\n```"
}
] |
[
{
"from": "human",
"value": "List the building and address, limit 5."
},
{
"from": "gpt",
"value": "```sparql\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?building ?addr\nWHERE {\n ?building rdf:type :Building .\n OPTIONAL {\n ?building :hasAddress ?addr .\n }\n}\nLIMIT 5\n```"
}
] |
[
{
"from": "human",
"value": "List the building and address, offset 10, limit 5."
},
{
"from": "gpt",
"value": "```sparql\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?building ?addr\nWHERE {\n ?building rdf:type :Building .\n OPTIONAL {\n ?building :hasAddress ?addr .\n }\n}\nOFFSET 10\nLIMIT 5\n```"
}
] |
[
{
"from": "human",
"value": "Find buildings that have addresses on either '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 ?building\nWHERE {\n ?building rdf:type :Building ;\n :hasAddress ?addr .\n ?addr :hasStreetName ?name .\n FILTER(?name = \"Main Street\" || ?name = \"High Street\")\n}\n```"
}
] |
[
{
"from": "human",
"value": "Find all geo:Feature instances that have a geometry."
},
{
"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 ?feature\nWHERE {\n ?feature rdf:type geo:Feature ;\n :hasGeometry ?geom .\n}\n```"
}
] |
[
{
"from": "human",
"value": "Find all constructions that are also buildings or roads."
},
{
"from": "gpt",
"value": "```sparql\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?c\nWHERE {\n ?c rdf:type :Construction .\n FILTER EXISTS { ?c rdf:type :Building }\n UNION\n FILTER EXISTS { ?c rdf:type :Road }\n}\n```"
}
] |
[
{
"from": "human",
"value": "Find roads that have geometry and addresses (if any)."
},
{
"from": "gpt",
"value": "```sparql\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?road ?geom ?addr\nWHERE {\n ?road rdf:type :Road ;\n :hasGeometry ?geom .\n OPTIONAL {\n ?road :hasAddress ?addr .\n }\n}\n```"
}
] |
[
{
"from": "human",
"value": "Find all distinct street names used by buildings."
},
{
"from": "gpt",
"value": "```sparql\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT DISTINCT ?street\nWHERE {\n ?b rdf:type :Building ;\n :hasAddress ?addr .\n ?addr :hasStreetName ?street .\n}\n```"
}
] |
[
{
"from": "human",
"value": "List the building and year, but only if year is known."
},
{
"from": "gpt",
"value": "```sparql\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?building ?year\nWHERE {\n ?building rdf:type :Building ;\n :hasConstructionYear ?year .\n}\n```"
}
] |
[
{
"from": "human",
"value": "Find buildings that were built before 1950 or after 2020."
},
{
"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 :hasConstructionYear ?year .\n FILTER(?year < 1950 || ?year > 2020)\n}\n```"
}
] |
[
{
"from": "human",
"value": "Select the building, civic number, and number of units for those with more than 3 units."
},
{
"from": "gpt",
"value": "```sparql\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?building ?civic ?units\nWHERE {\n ?building rdf:type :Building ;\n :hasAddress ?addr ;\n :hasNumberOfUnits ?units .\n ?addr :hasCivicNumber ?civic .\n FILTER(?units > 3)\n}\n```"
}
] |
[
{
"from": "human",
"value": "Count how many buildings have addresses on 'Main 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(?building) AS ?count)\nWHERE {\n ?building rdf:type :Building ;\n :hasAddress ?addr .\n ?addr :hasStreetName \"Main Street\" .\n}\n```"
}
] |
[
{
"from": "human",
"value": "Order buildings by their number of units descending."
},
{
"from": "gpt",
"value": "```sparql\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?building ?units\nWHERE {\n ?building rdf:type :Building ;\n :hasNumberOfUnits ?units .\n}\nORDER BY DESC(?units)\n```"
}
] |
[
{
"from": "human",
"value": "Order roads by their construction year ascending."
},
{
"from": "gpt",
"value": "```sparql\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?road ?year\nWHERE {\n ?road rdf:type :Road ;\n :hasConstructionYear ?year .\n}\nORDER BY ASC(?year)\n```"
}
] |
[
{
"from": "human",
"value": "Find addresses that have both street name and 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 :hasStreetName ?s ;\n :hasCivicNumber ?c .\n}\n```"
}
] |
[
{
"from": "human",
"value": "Find addresses with street name containing 'Street' (using regex)."
},
{
"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 :hasStreetName ?name .\n FILTER regex(?name, \"Street\", \"i\")\n}\n```"
}
] |
[
{
"from": "human",
"value": "Count how many addresses have a civic number less than 50."
},
{
"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 ;\n :hasCivicNumber ?num .\n FILTER(?num < 50)\n}\n```"
}
] |
[
{
"from": "human",
"value": "Find buildings that have both an address and geometry."
},
{
"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 :hasAddress ?addr ;\n :hasGeometry ?geom .\n}\n```"
}
] |
[
{
"from": "human",
"value": "Select buildings that have more than 1 unit and were built after 2015."
},
{
"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 :hasNumberOfUnits ?units ;\n :hasConstructionYear ?year .\n FILTER(?units > 1 && ?year > 2015)\n}\n```"
}
] |
[
{
"from": "human",
"value": "Find roads that do not have geometry."
},
{
"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 .\n FILTER NOT EXISTS {\n ?road :hasGeometry ?geom .\n }\n}\n```"
}
] |
[
{
"from": "human",
"value": "Find constructions that were built after 1999 and before 2010."
},
{
"from": "gpt",
"value": "```sparql\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?constr\nWHERE {\n ?constr rdf:type :Construction ;\n :hasConstructionYear ?year .\n FILTER(?year > 1999 && ?year < 2010)\n}\n```"
}
] |
[
{
"from": "human",
"value": "Get the number of addresses grouped by street name."
},
{
"from": "gpt",
"value": "```sparql\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?street (COUNT(?addr) AS ?count)\nWHERE {\n ?addr rdf:type :Address ;\n :hasStreetName ?street .\n}\nGROUP BY ?street\n```"
}
] |
[
{
"from": "human",
"value": "List roads along with their construction year and geometry if available."
},
{
"from": "gpt",
"value": "```sparql\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?road ?year ?geom\nWHERE {\n ?road rdf:type :Road .\n OPTIONAL {\n ?road :hasConstructionYear ?year .\n }\n OPTIONAL {\n ?road :hasGeometry ?geom .\n }\n}\n```"
}
] |
[
{
"from": "human",
"value": "Return the geometry WKT for roads built after 2018."
},
{
"from": "gpt",
"value": "```sparql\nPREFIX : <http://example.org/ontology#>\nPREFIX geo: <http://www.opengis.net/ont/geosparql#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?road ?wkt\nWHERE {\n ?road rdf:type :Road ;\n :hasConstructionYear ?year ;\n :hasGeometry ?geom .\n ?geom geo:asWKT ?wkt .\n FILTER(?year > 2018)\n}\n```"
}
] |
[
{
"from": "human",
"value": "Find all buildings that share the same street name as any road (assuming roads might have addresses too)."
},
{
"from": "gpt",
"value": "```sparql\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT DISTINCT ?building\nWHERE {\n ?road rdf:type :Road ;\n :hasAddress ?rAddr .\n ?rAddr :hasStreetName ?commonStreet .\n ?building rdf:type :Building ;\n :hasAddress ?bAddr .\n ?bAddr :hasStreetName ?commonStreet .\n}\n```"
}
] |
[
{
"from": "human",
"value": "Find roads within 500 meters of a building using geof:distance."
},
{
"from": "gpt",
"value": "```sparql\nPREFIX geo: <http://www.opengis.net/ont/geosparql#>\nPREFIX geof: <http://www.opengis.net/def/function/geosparql/>\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?road\nWHERE {\n :SomeBuilding :hasGeometry ?bGeom .\n ?road rdf:type :Road ;\n :hasGeometry ?rGeom .\n FILTER(\n geof:distance(\n ?bGeom,\n ?rGeom,\n <http://www.opengis.net/def/uom/OGC/1.0/metre>\n ) < 500\n )\n}\n```"
}
] |
[
{
"from": "human",
"value": "Find buildings within 200 meters of a given road."
},
{
"from": "gpt",
"value": "```sparql\nPREFIX geo: <http://www.opengis.net/ont/geosparql#>\nPREFIX geof: <http://www.opengis.net/def/function/geosparql/>\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?building\nWHERE {\n :SomeRoad :hasGeometry ?rGeom .\n ?building rdf:type :Building ;\n :hasGeometry ?bGeom .\n FILTER(\n geof:distance(\n ?rGeom,\n ?bGeom,\n <http://www.opengis.net/def/uom/OGC/1.0/metre>\n ) < 200\n )\n}\n```"
}
] |
[
{
"from": "human",
"value": "Calculate the average construction year for all construction."
},
{
"from": "gpt",
"value": "```sparql\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT (AVG(?year) AS ?avgYear)\nWHERE {\n ?c rdf:type :Construction ;\n :hasConstructionYear ?year .\n}\n```"
}
] |
[
{
"from": "human",
"value": "Find the minimum civic number across all addresses."
},
{
"from": "gpt",
"value": "```sparql\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT (MIN(?civic) AS ?minCivic)\nWHERE {\n ?addr rdf:type :Address ;\n :hasCivicNumber ?civic .\n}\n```"
}
] |
[
{
"from": "human",
"value": "Find addresses whose street name starts with 'A' (case insensitive)."
},
{
"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 :hasStreetName ?name .\n FILTER regex(?name, \"^a\", \"i\")\n}\n```"
}
] |
[
{
"from": "human",
"value": "List the building, street name, and geometry, if geometry exists."
},
{
"from": "gpt",
"value": "```sparql\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?building ?street ?geom\nWHERE {\n ?building rdf:type :Building ;\n :hasAddress ?addr .\n ?addr :hasStreetName ?street .\n OPTIONAL {\n ?building :hasGeometry ?geom .\n }\n}\n```"
}
] |
[
{
"from": "human",
"value": "List roads and group by construction year, returning the count in each group."
},
{
"from": "gpt",
"value": "```sparql\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?year (COUNT(?road) AS ?count)\nWHERE {\n ?road rdf:type :Road ;\n :hasConstructionYear ?year .\n}\nGROUP BY ?year\n```"
}
] |
[
{
"from": "human",
"value": "Find the earliest year among all Construction."
},
{
"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 ?c rdf:type :Construction ;\n :hasConstructionYear ?year .\n}\n```"
}
] |
[
{
"from": "human",
"value": "Find the total number of constructions that have geometry."
},
{
"from": "gpt",
"value": "```sparql\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT (COUNT(?c) AS ?count)\nWHERE {\n ?c rdf:type :Construction ;\n :hasGeometry ?geom .\n}\n```"
}
] |
[
{
"from": "human",
"value": "List addresses in ascending order by 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 ?num\nWHERE {\n ?addr rdf:type :Address ;\n :hasCivicNumber ?num .\n}\nORDER BY ASC(?num)\n```"
}
] |
[
{
"from": "human",
"value": "Select roads that have an address with civic number below 10."
},
{
"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 ;\n :hasAddress ?addr .\n ?addr :hasCivicNumber ?num .\n FILTER(?num < 10)\n}\n```"
}
] |
[
{
"from": "human",
"value": "Find buildings that do not 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 ?building\nWHERE {\n ?building rdf:type :Building ;\n :hasAddress ?addr .\n ?addr :hasStreetName ?street .\n FILTER(?street != \"Main Street\" && ?street != \"High Street\")\n}\n```"
}
] |
[
{
"from": "human",
"value": "Find buildings and roads that share the same 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 ?road ?year\nWHERE {\n ?building rdf:type :Building ;\n :hasConstructionYear ?year .\n ?road rdf:type :Road ;\n :hasConstructionYear ?year .\n}\n```"
}
] |
[
{
"from": "human",
"value": "Find addresses with street name in uppercase (using FILTER UCASE)."
},
{
"from": "gpt",
"value": "```sparql\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?addr ?name\nWHERE {\n ?addr rdf:type :Address ;\n :hasStreetName ?name .\n FILTER(?name = UCASE(?name))\n}\n```"
}
] |
[
{
"from": "human",
"value": "List buildings with addresses that have a non-integer civic number (if typed incorrectly)."
},
{
"from": "gpt",
"value": "```sparql\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\nPREFIX xsd: <http://www.w3.org/2001/XMLSchema#>\n\nSELECT ?building ?num\nWHERE {\n ?building rdf:type :Building ;\n :hasAddress ?addr .\n ?addr :hasCivicNumber ?num .\n FILTER(datatype(?num) != xsd:integer)\n}\n```"
}
] |
[
{
"from": "human",
"value": "List addresses that have missing or empty street name."
},
{
"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 NOT EXISTS {\n ?addr :hasStreetName ?name .\n }\n}\n```"
}
] |
[
{
"from": "human",
"value": "Find the building that has the highest number of units."
},
{
"from": "gpt",
"value": "```sparql\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?building ?units\nWHERE {\n ?building rdf:type :Building ;\n :hasNumberOfUnits ?units .\n}\nORDER BY DESC(?units)\nLIMIT 1\n```"
}
] |
[
{
"from": "human",
"value": "Find the building that has the smallest number of units."
},
{
"from": "gpt",
"value": "```sparql\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?building ?units\nWHERE {\n ?building rdf:type :Building ;\n :hasNumberOfUnits ?units .\n}\nORDER BY ASC(?units)\nLIMIT 1\n```"
}
] |
[
{
"from": "human",
"value": "Group buildings by street name and compute the average number of units."
},
{
"from": "gpt",
"value": "```sparql\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?street (AVG(?units) AS ?avgUnits)\nWHERE {\n ?b rdf:type :Building ;\n :hasAddress ?addr ;\n :hasNumberOfUnits ?units .\n ?addr :hasStreetName ?street .\n}\nGROUP BY ?street\n```"
}
] |
[
{
"from": "human",
"value": "List roads that have an address on 'Route 66'."
},
{
"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 ;\n :hasAddress ?addr .\n ?addr :hasStreetName \"Route 66\" .\n}\n```"
}
] |
[
{
"from": "human",
"value": "List roads that share the same street name as at least one building."
},
{
"from": "gpt",
"value": "```sparql\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT DISTINCT ?road\nWHERE {\n ?road rdf:type :Road ;\n :hasAddress ?rAddr .\n ?rAddr :hasStreetName ?street .\n ?b rdf:type :Building ;\n :hasAddress ?bAddr .\n ?bAddr :hasStreetName ?street .\n}\n```"
}
] |
[
{
"from": "human",
"value": "Return the geometry WKT for all constructions that have geometry."
},
{
"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 ?constr ?wkt\nWHERE {\n ?constr rdf:type :Construction ;\n :hasGeometry ?geom .\n ?geom geo:asWKT ?wkt .\n}\n```"
}
] |
[
{
"from": "human",
"value": "Find addresses with civic number in the range 1 to 20."
},
{
"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 :hasCivicNumber ?num .\n FILTER(?num >= 1 && ?num <= 20)\n}\n```"
}
] |
[
{
"from": "human",
"value": "Find buildings with more than 10 units, sorted by units descending."
},
{
"from": "gpt",
"value": "```sparql\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?building ?units\nWHERE {\n ?building rdf:type :Building ;\n :hasNumberOfUnits ?units .\n FILTER(?units > 10)\n}\nORDER BY DESC(?units)\n```"
}
] |
[
{
"from": "human",
"value": "Count how many roads do not have an address."
},
{
"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 FILTER NOT EXISTS {\n ?road :hasAddress ?addr .\n }\n}\n```"
}
] |
[
{
"from": "human",
"value": "Compute the average civic number for addresses that also have a street name."
},
{
"from": "gpt",
"value": "```sparql\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT (AVG(?civic) AS ?avgCivic)\nWHERE {\n ?addr rdf:type :Address ;\n :hasStreetName ?street ;\n :hasCivicNumber ?civic .\n}\n```"
}
] |
[
{
"from": "human",
"value": "Find the building(s) with the highest 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 ?year\nWHERE {\n ?building rdf:type :Building ;\n :hasConstructionYear ?year .\n}\nORDER BY DESC(?year)\nLIMIT 1\n```"
}
] |
[
{
"from": "human",
"value": "Find addresses that have a civic number of 0."
},
{
"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 :hasCivicNumber ?num .\n FILTER(?num = 0)\n}\n```"
}
] |
[
{
"from": "human",
"value": "List all buildings that have no geometry but do have a 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 ?year\nWHERE {\n ?building rdf:type :Building ;\n :hasConstructionYear ?year .\n FILTER NOT EXISTS {\n ?building :hasGeometry ?geom .\n }\n}\n```"
}
] |
[
{
"from": "human",
"value": "Find roads that have the same construction year as any building."
},
{
"from": "gpt",
"value": "```sparql\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?road ?year\nWHERE {\n ?road rdf:type :Road ;\n :hasConstructionYear ?year .\n FILTER EXISTS {\n ?b rdf:type :Building ;\n :hasConstructionYear ?year .\n }\n}\n```"
}
] |
[
{
"from": "human",
"value": "Group buildings by construction year and show the average number of units in each year group."
},
{
"from": "gpt",
"value": "```sparql\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?year (AVG(?units) AS ?avgUnits)\nWHERE {\n ?b rdf:type :Building ;\n :hasNumberOfUnits ?units ;\n :hasConstructionYear ?year .\n}\nGROUP BY ?year\n```"
}
] |
[
{
"from": "human",
"value": "Find buildings whose construction year is not specified."
},
{
"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 FILTER NOT EXISTS {\n ?building :hasConstructionYear ?year .\n }\n}\n```"
}
] |
[
{
"from": "human",
"value": "Compute the average geometry distance between a specific building and all roads (conceptual example)."
},
{
"from": "gpt",
"value": "```sparql\nPREFIX geo: <http://www.opengis.net/ont/geosparql#>\nPREFIX geof: <http://www.opengis.net/def/function/geosparql/>\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT (AVG(?dist) AS ?avgDist)\nWHERE {\n :SomeBuilding :hasGeometry ?bGeom .\n ?road rdf:type :Road ;\n :hasGeometry ?rGeom .\n BIND(\n geof:distance(\n ?bGeom,\n ?rGeom,\n <http://www.opengis.net/def/uom/OGC/1.0/metre>\n ) AS ?dist\n )\n}\n```"
}
] |
[
{
"from": "human",
"value": "List all addresses in descending order of their 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 ?civic\nWHERE {\n ?addr rdf:type :Address ;\n :hasCivicNumber ?civic .\n}\nORDER BY DESC(?civic)\n```"
}
] |
[
{
"from": "human",
"value": "Count how many buildings have a geometry in WKT format containing '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 (COUNT(?building) AS ?count)\nWHERE {\n ?building rdf:type :Building ;\n :hasGeometry ?geom .\n ?geom geo:asWKT ?wkt .\n FILTER regex(?wkt, \"POLYGON\", \"i\")\n}\n```"
}
] |
[
{
"from": "human",
"value": "List roads that have WKT geometry containing 'LINESTRING'."
},
{
"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 ;\n :hasGeometry ?geom .\n ?geom geo:asWKT ?wkt .\n FILTER regex(?wkt, \"LINESTRING\", \"i\")\n}\n```"
}
] |
[
{
"from": "human",
"value": "Find buildings that have the substring 'office' in their WKT geometry (hypothetical)."
},
{
"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 ?building ?wkt\nWHERE {\n ?building rdf:type :Building ;\n :hasGeometry ?geom .\n ?geom geo:asWKT ?wkt .\n FILTER regex(?wkt, \"office\", \"i\")\n}\n```"
}
] |
[
{
"from": "human",
"value": "Find roads that also appear as buildings (unlikely, but possible)."
},
{
"from": "gpt",
"value": "```sparql\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 .\n ?r rdf:type :Building .\n}\n```"
}
] |
[
{
"from": "human",
"value": "Find roads that are not typed as constructions (if data is inconsistent)."
},
{
"from": "gpt",
"value": "```sparql\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 .\n FILTER NOT EXISTS {\n ?r rdf:type :Construction .\n }\n}\n```"
}
] |
[
{
"from": "human",
"value": "Find addresses whose civic number is even (example of mod operation)."
},
{
"from": "gpt",
"value": "```sparql\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\nPREFIX fn: <http://www.w3.org/2005/xpath-functions#>\n\nSELECT ?addr\nWHERE {\n ?addr rdf:type :Address ;\n :hasCivicNumber ?num .\n FILTER((?num % 2) = 0)\n}\n```"
}
] |
[
{
"from": "human",
"value": "Find addresses whose civic number is odd."
},
{
"from": "gpt",
"value": "```sparql\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\nPREFIX fn: <http://www.w3.org/2005/xpath-functions#>\n\nSELECT ?addr\nWHERE {\n ?addr rdf:type :Address ;\n :hasCivicNumber ?num .\n FILTER((?num % 2) != 0)\n}\n```"
}
] |
[
{
"from": "human",
"value": "Find buildings that have the same number of units as their civic number (if that makes sense)."
},
{
"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 :hasNumberOfUnits ?units ;\n :hasAddress ?addr .\n ?addr :hasCivicNumber ?civic .\n FILTER(?units = ?civic)\n}\n```"
}
] |
[
{
"from": "human",
"value": "Select the geometry of roads that are typed incorrectly also as buildings."
},
{
"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\nWHERE {\n ?road rdf:type :Road , :Building ;\n :hasGeometry ?geom .\n}\n```"
}
] |
[
{
"from": "human",
"value": "Find the building(s) with addresses on 'Main Street' and 'High Street' simultaneously (if any)."
},
{
"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 ?building :hasAddress ?addr1 , ?addr2 .\n ?addr1 :hasStreetName \"Main Street\" .\n ?addr2 :hasStreetName \"High Street\" .\n}\n```"
}
] |
[
{
"from": "human",
"value": "Find all buildings that have more than one address."
},
{
"from": "gpt",
"value": "```sparql\nPREFIX : <http://example.org/ontology#>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\nSELECT ?building (COUNT(?addr) AS ?addrCount)\nWHERE {\n ?building rdf:type :Building ;\n :hasAddress ?addr .\n}\nGROUP BY ?building\nHAVING(COUNT(?addr) > 1)\n```"
}
] |
[
{
"from": "human",
"value": "Find addresses that are linked to more than one building."
},
{
"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(?building) AS ?bCount)\nWHERE {\n ?building rdf:type :Building ;\n :hasAddress ?addr .\n}\nGROUP BY ?addr\nHAVING(COUNT(?building) > 1)\n```"
}
] |
End of preview. Expand
in Dataset Viewer.
README.md exists but content is empty.
- Downloads last month
- 43