Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1 - Retorne todos os indivíduos do tema (Astronauta)
- PREFIX dbo: <http://dbpedia.org/ontology/>
- SELECT DISTINCT ?Astronaut ?Astronaut_Label WHERE {
- ?Astronaut rdf:type dbo:Astronaut.
- ?Astronaut rdfs:label ?Astronaut_Label
- FILTER((LANGMATCHES(LANG(?Astronaut_Label), "en")) && (LANGMATCHES(LANG(?Astronaut_Label), "en")))
- }
- 2 - Retorne o número de indivíduos do tema (Astronauta)
- PREFIX dbo: <http://dbpedia.org/ontology/>
- SELECT COUNT(*) {
- SELECT DISTINCT ?Astronaut ?Astronaut_Label WHERE {
- ?Astronaut rdf:type dbo:Astronaut.
- ?Astronaut rdfs:label ?Astronaut_Label
- FILTER((LANGMATCHES(LANG(?Astronaut_Label), "en")) && (LANGMATCHES(LANG(?Astronaut_Label), "en")))
- }
- }
- 3 - Retorne o nome de indivíduos do tema que tenham alguma característica específica (Nascido nos Estados Unidos)
- PREFIX dbo: <http://dbpedia.org/ontology/>
- PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
- SELECT DISTINCT ?Astronaut ?Astronaut_Label ?Country ?Country_Label
- WHERE {
- ?Astronaut a dbo:Astronaut.
- ?Astronaut rdfs:label ?Astronaut_Label.
- ?Astronaut dbo:birthPlace ?Country.
- ?Country a dbo:Country.
- ?Country rdfs:label ?Country_Label.
- FILTER((LANGMATCHES(LANG(?Astronaut_Label), "en")) && (LANGMATCHES(LANG(?Astronaut_Label), "en")))
- FILTER((LANGMATCHES(LANG(?Country_Label), "en")) && (LANGMATCHES(LANG(?Country_Label), "en")) && ((STR(?Country_Label)) = "United States"))
- }
- 4 - Retorne o nome de indivíduos do tema que tenham duas caraterísticas específicas ao mesmo tempo (Nascido nos Estados Unidos && Estado Oklahoma)
- PREFIX dbo: <http://dbpedia.org/ontology/>
- PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
- SELECT DISTINCT
- ?astronaut ?astronaut_Label ?country ?country_Label ?city ?city_Label
- WHERE{
- ?astronaut a dbo:Astronaut.
- ?astronaut rdfs:label ?astronaut_Label.
- ?astronaut dbo:birthPlace ?country.
- ?astronaut dbo:birthPlace ?city.
- ?country a dbo:Country.
- ?country rdfs:label ?country_Label.
- ?city a dbo:City.
- ?city rdfs:label ?city_Label.
- FILTER((LANGMATCHES(LANG(?astronaut_Label), "en")) && (LANGMATCHES(LANG(?astronaut_Label), "en")))
- FILTER((LANGMATCHES(LANG(?country_Label), "en")) && (LANGMATCHES(LANG(?country_Label), "en")) && ((STR(?country_Label)) = "United States"))
- FILTER((LANGMATCHES(LANG(?city_Label), "en")) && (LANGMATCHES(LANG(?city_Label), "en")) && (REGEX(?city_Label, "Oklahoma", "i")))
- }
- 5 - Retorne o nome de indivíduos do tema que tenha uma característica ououtra característica específica (Nascido na Russia OU Ano Nascimento > 1960)
- **NÃO FOI POSSÍVEL FILTRAR A DATA PARA (en) POR ISSO RESULTADOS REPETIDOS**
- PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
- PREFIX dbo: <http://dbpedia.org/ontology/>
- PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
- SELECT DISTINCT ?astronaut_Label ?astronaut_birth_date ?country_Label
- WHERE {
- ?astronaut a dbo:Astronaut.
- ?astronaut rdfs:label ?astronaut_Label.
- ?astronaut dbo:birthDate ?astronaut_birth_date.
- ?astronaut dbo:birthPlace ?country.
- ?country a dbo:Country.
- ?country rdfs:label ?country_Label.
- FILTER((LANGMATCHES(LANG(?astronaut_Label), "en")) && (LANGMATCHES(LANG(?astronaut_Label), "en")))
- FILTER(((xsd:dateTime(?astronaut_birth_date)) > "1960-01-01T23:59:59-03:00"^^xsd:dateTime) || (LANGMATCHES(LANG(?country_Label), "en")) && ((STR(?country_Label)) = "Russia"))
- }
- 6 - Retorne o nome de indivíduos do tema que cruze dados com outra entidade (Astronaut/Contry)
- PREFIX dbo: <http://dbpedia.org/ontology/>
- PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
- SELECT DISTINCT ?astronaut ?astronaut_Label ?country ?country_Label
- WHERE {
- ?astronaut a dbo:Astronaut.
- ?astronaut rdfs:label ?astronaut_Label.
- ?astronaut dbo:birthPlace ?country.
- ?country a dbo:Country.
- ?country rdfs:label ?country_Label.
- FILTER((LANGMATCHES(LANG(?astronaut_Label), "en")) && (LANGMATCHES(LANG(?astronaut_Label), "en")))
- FILTER((LANGMATCHES(LANG(?country_Label), "en")) && (LANGMATCHES(LANG(?country_Label), "en")) && ((STR(?country_Label)) = "China"))
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement