Skip to content

Instantly share code, notes, and snippets.

@virtor
Last active August 29, 2015 14:17
Show Gist options
  • Save virtor/6e9659a2887d97ff963c to your computer and use it in GitHub Desktop.
Save virtor/6e9659a2887d97ff963c to your computer and use it in GitHub Desktop.
PREFIX acto: <http://vocab.linkeddata.es/datosabiertos/def/cultura-ocio/agenda#>\
PREFIX s: <http://schema.org/>\
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>\
PREFIX ns: <http://www.w3.org/2006/vcard/ns#>\
SELECT DISTINCT ?uri ?title ?startDate ?endDate ?startTime ?endTime ?horario ?tipo min(?latitud) as ?latitud min(?longitud) as ?longitud
WHERE { ?uri a acto:Evento.
OPTIONAL{ ?uri rdfs:label ?title}.
OPTIONAL {?uri s:subEvent ?subEvent.}
OPTIONAL {?subEvent s:startDate ?startDate.}
OPTIONAL {?subEvent s:endDate ?endDate.}
OPTIONAL {?subEvent s:startTime ?startTime.}
OPTIONAL {?subEvent s:endTime ?endTime.}
OPTIONAL {?subEvent s:openingHours ?horario.}
OPTIONAL {?uri skos:broader/skos:prefLabel ?tema.}
OPTIONAL {?uri ns:category/skos:prefLabel ?subtema.}
bind (CONCAT(?tema, " ", ?subtema) AS ?tipo).
?uri acto:diasParaTerminar ?diasParaTerminarstr.
OPTIONAL {?uri geo:geometry ?geo.
?geo geo:lat ?latitud.
?geo geo:long ?longitud.}
bind (coalesce(xsd:date(?startDate), now()) as ?startAsDate)
bind (xsd:int(?diasParaTerminarstr) as ?diasParaTerminar)
filter(?diasParaTerminar >= 0) .
filter(!strstarts(str(?tema), "Cursos") ).
}
GROUP BY ?diasParaTerminar ?uri ?title ?startDate ?endDate ?startTime ?endTime ?horario ?tipo
ORDER BY ASC(?diasParaTerminar)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment