Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 9 additions & 36 deletions HandsOn/Group09/rdf/queries.sparql
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ WHERE {
?s ?p ?o .
}


# Número de elementos en clases
SELECT ?tipo (COUNT(?instancia) AS ?num)
WHERE {
Expand All @@ -21,6 +22,7 @@ WHERE {
GROUP BY ?tipo
ORDER BY DESC(?num)


# Verificar relaciones
SELECT ?linea ?estacion
WHERE {
Expand All @@ -30,6 +32,8 @@ WHERE {

LIMIT 10


# Información estaciones
SELECT ?estacion ?alcaldia ?tipo ?linea
WHERE {
?estacion a metro:Estacion ;
Expand All @@ -39,53 +43,22 @@ WHERE {
}
LIMIT 10

SELECT ?medicion ?anio ?mes ?afluencia ?estacion ?linea

# Información afluencias
SELECT ?medicion ?anio?afluencia ?estacion ?linea
WHERE {
?medicion a metro:MedicionAfluencia ;
metro:anioMedicion ?anio ;
metro:mesMedicion ?mes ;
metro:afluenciaMedicion ?afluencia ;
metro:deEstacion ?estacion ;
metro:deLinea ?linea .
}
LIMIT 10


# Verificar estaciones con mediciones
SELECT (COUNT(DISTINCT ?estacion) AS ?numEstacionesConAfluencia)
WHERE {
?m a metro:MedicionAfluencia ;
metro:deEstacion ?estacion .
}

# Verificar URIS
SELECT ?s ?p ?o
WHERE {
?s ?p ?o .
FILTER(isLiteral(?o))
FILTER(STRSTARTS(STR(?p), STR(metro:))) # propiedades de tu ontología
}
LIMIT 10


# --- CONSULTAS ADICIONALES ---


# Estaciones con línea y alcaldía
SELECT ?station ?label ?line ?alcaldia
WHERE {
?station a metro:Station ;
rdfs:label ?label ;
metro:belongsToLine ?line ;
metro:locatedIn ?alcaldia .
}
ORDER BY ?line ?label
LIMIT 50

# Estaciones por línea (número de estaciones por línea)
SELECT ?line (COUNT(DISTINCT ?station) AS ?numStations)
WHERE {
?station a metro:Station ;
metro:belongsToLine ?line .
}
GROUP BY ?line
ORDER BY ?line
}