Submissions for Polifonia Organs KG

Description

The ORGANS knowledge graph contains data on c. 2000 Dutch organs of historic importance. The data has been extracted from the Dutch ‘Organ Encylopaedia’. It contains information on organs, locations, builders, maintenance and modifications, and stop lists. The knowledge graph uses a temporary vocabulary that will be replaced by the Polifonia Ontology Network in the next version.

10 of 10 submissions
#94

Natural Language Question

Which organs are contained in this KG? List their names together with their URI.

Source

SPARQL Query

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX core:  <https://w3id.org/polifonia/ontology/core/>
PREFIX organs: <http://w3id.org/polifonia/resource/organs/>
PREFIX organ: <http://w3id.org/polifonia/ontology/organs/>

SELECT DISTINCT ?uri ?label
WHERE {
    ?uri a organ:Organ ;
    rdfs:label ?label .
}
#96

Natural Language Question

What is the oldest organ in the KG (i.e., with the earliest construction date)?

SPARQL Query

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX core:  <https://w3id.org/polifonia/ontology/core/>
PREFIX organ: <http://w3id.org/polifonia/ontology/organs/>

SELECT ?organ_uri ?organ_name ?construction_date ?year_str
WHERE {
  ?organ_uri core:describedBy [
    a organ:OrganProject ;
    core:definesTask [
      core:isClassifiedBy  organ:TaskTypeBuild
    ] ;
    core:hasTimedLocation [
      core:hasTimeInterval  [
        rdfs:label  ?year_str ;
        core:time   ?construction_date
      ]
    ]
  ] .
  
  OPTIONAL {
    ?organ_uri rdfs:label ?organ_name .
  }
}
ORDER BY ?construction_date
LIMIT 1
#97

Natural Language Question

How many organs were built in the 16th century?

SPARQL Query

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX core:  <https://w3id.org/polifonia/ontology/core/>
PREFIX organ: <http://w3id.org/polifonia/ontology/organs/>

SELECT (COUNT(*) AS ?count)
WHERE {
  ?organ_uri core:describedBy [
    a organ:OrganProject ;
    core:definesTask [
      core:isClassifiedBy  organ:TaskTypeBuild
    ] ;
    core:hasTimedLocation [
      core:hasTimeInterval  [
        rdfs:label  ?year_str ;
        core:time   ?construction_date
      ]
    ]
  ] .
  
  # Filter for 16th century (1500-1599)
  FILTER(?construction_date >= "1500"^^xsd:string && ?construction_date <= "1599"^^xsd:string)
}
#106

Natural Language Question

For any organ in the KG, return the number of parts it is composed of, together with its URI and name. Sort the results in descending order by number of components.

SPARQL Query

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX w3idPOO: <http://w3id.org/polifonia/ontology/organs/>
PREFIX w3idPOI: <http://w3id.org/polifonia/ontology/instrument/>
PREFIX w3idPOC: <https://w3id.org/polifonia/ontology/core/>

SELECT ?organ ?organLabel (COUNT(DISTINCT ?division) AS ?numberOfDivisions)
WHERE {
  # Find organs and their instrument wholes
  ?organ w3idPOC:includesWhole ?instrumentWhole .
  ?instrumentWhole a w3idPOI:InstrumentWhole .
  
  # Get organ label
  OPTIONAL { ?organ rdfs:label ?organLabel . }
  
  # Find divisions that are parts of the instrument whole
  ?instrumentWhole w3idPOC:hasPart ?division .
  ?division a w3idPOO:OrganDivision .
}
GROUP BY ?organ ?organLabel
ORDER BY DESC(?numberOfDivisions)
#107

Natural Language Question

What are the organs for which the KG contains an image?

SPARQL Query

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX organ: <http://w3id.org/polifonia/ontology/organs/>
PREFIX w3idPOC: <https://w3id.org/polifonia/ontology/core/>

SELECT DISTINCT ?organ ?organLabel ?pictureUrl
WHERE {
  # Find all organs that HAVE pictures
  ?organ a organ:Organ ;
         w3idPOC:hasPicture ?picture .
  
  # The picture must be a PictureDescription
  ?picture a w3idPOC:PictureDescription .
  
  # Get organ label
  OPTIONAL { ?organ rdfs:label ?organLabel . }
  
  # Get picture URL (required since we're filtering for organs with pictures)
  OPTIONAL { ?picture w3idPOC:url ?pictureUrl . }
  
  
}
ORDER BY ?organLabel
#111

Natural Language Question

Find the organ that existed at the given location at the given time

Source

SPARQL Query

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX core:  <https://w3id.org/polifonia/ontology/core/>
PREFIX ins:   <http://w3id.org/polifonia/ontology/instrument/>
PREFIX xsd:   <http://www.w3.org/2001/XMLSchema#>

SELECT DISTINCT ?organ ?label ?chosenYear ?city ?lat ?long
WHERE {

  # Candidate snapshot for an organ at time ?t (<= query year)
  ?organ core:includesWhole [
    a ins:InstrumentWhole ;
    core:hasTimedLocation [
      core:hasTimeInterval [ core:time ?t ] ;
      core:hasLocation ?location
    ]
  ] .

  FILTER(xsd:integer(?t) <= ?yearQuery)
  BIND(xsd:integer(?t) AS ?chosenYear)

  # Ensure there is no later snapshot for the same organ that is still <= query year
  FILTER NOT EXISTS {
    ?organ core:includesWhole [
      a ins:InstrumentWhole ;
      core:hasTimedLocation [
        core:hasTimeInterval [ core:time ?tLater ] ;
        core:hasLocation ?locLater
      ]
    ] .
    FILTER(xsd:integer(?tLater) <= ?yearQuery)
    FILTER(xsd:integer(?tLater) > xsd:integer(?t))
  }

  # Organ label
  OPTIONAL { ?organ rdfs:label ?label }

  # Location metadata
  OPTIONAL { ?location core:hasAddress [ core:hasCity ?city ] }
  OPTIONAL { ?location core:latitude ?lat ; core:longitude ?long }

  # City OR bbox (if cityQuery is empty string, it effectively disables the city arm)
  FILTER(
    (
      STRLEN(STR(?cityQuery)) > 0
      && BOUND(?city)
      && LCASE(STR(?city)) = LCASE(STR(?cityQuery))
    )
    ||
    (
      BOUND(?lat) && BOUND(?long)
      && xsd:decimal(STR(?lat))  >= xsd:decimal(STR(?minLat))
      && xsd:decimal(STR(?lat))  <= xsd:decimal(STR(?maxLat))
      && xsd:decimal(STR(?long)) >= xsd:decimal(STR(?minLong))
      && xsd:decimal(STR(?long)) <= xsd:decimal(STR(?maxLong))
    )
  )

  # Parameters
  VALUES (?yearQuery ?cityQuery ?minLat ?maxLat ?minLong ?maxLong) {
    (1850 "Utrecht" 52.03 52.15 5.05 5.20)
  }
}
#112

Natural Language Question

Find similar organs based on builder or location (city)

Source

SPARQL Query

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX core:  <https://w3id.org/polifonia/ontology/core/>
PREFIX organs: <http://w3id.org/polifonia/resource/organs/>
PREFIX organ: <http://w3id.org/polifonia/ontology/organs/>
PREFIX ins: <http://w3id.org/polifonia/ontology/instrument/>

SELECT DISTINCT ?organ_iri ?label
WHERE {
    { #same location (city)
        ?organ_query_iri core:includesWhole [
            a ins:InstrumentWhole ;
            core:hasTimedLocation [
                a core:TimedLocation ;
                core:hasLocation [
                    core:hasAddress [
                        core:hasCity ?city
                    ]
                ]
            ]
        ] .
    
    ?organ_iri rdfs:label ?label ;
        core:includesWhole [
            a ins:InstrumentWhole ;
            core:hasTimedLocation [
                a core:TimedLocation ;
                core:hasLocation [
                    core:hasAddress [
                        core:hasCity ?city
                    ]
                ]
            ]
        ] .
    }
    UNION
    { #same builder (stated name)
        ?organ_query_iri core:describedBy [
            a organ:OrganProject ;
            core:definesTask [
                rdf:type core:Task ;
                core:isClassifiedBy  organ:TaskTypeBuild
            ] ;
            core:hasProjectist [
                core:hasRole organ:Builder ;
                core:involvesAgent [
                    core:hasName [
                        core:name ?builder_name
                    ]
                ]
            ]
        ] .

        ?organ_iri rdfs:label ?label ;
            core:describedBy [
                a organ:OrganProject ;
                core:definesTask [
                    rdf:type core:Task ;
                    core:isClassifiedBy  organ:TaskTypeBuild
                ] ;
                core:hasProjectist [
                    core:hasRole organ:Builder ;
                    core:involvesAgent [
                        core:hasName [
                            core:name ?builder_name
                        ]
                    ]
                ]
            ] .        
    }
    UNION { #same builder (disambiguated name)
        ?organ_query_iri core:describedBy [
            a organ:OrganProject ;
            core:definesTask [
                rdf:type core:Task ;
                core:isClassifiedBy  organ:TaskTypeBuild
            ] ;
            core:hasProjectist [
                core:hasRole organ:Builder ;
                core:involvesAgent [
                    core:hasName ?disamb_builder_name
                ]
            ]
        ] .

        ?disamb_builder_name a core:DisambiguatedName .

        ?organ_iri rdfs:label ?label ;
            core:describedBy [
                a organ:OrganProject ;
                core:definesTask [
                    rdf:type core:Task ;
                    core:isClassifiedBy  organ:TaskTypeBuild
                ] ;
                core:hasProjectist [
                    core:hasRole organ:Builder ;
                    core:involvesAgent [
                        core:hasName ?disamb_builder_name
                    ]
                ]
            ] . 
    }

    VALUES ?organ_query_iri {
        organs:Part12_063UtrechtMaria
        organs:OI-ee4e8485b89314b0555e15c5b0b7181c
        organs:FR-59350-LILLE-TEMPLE1-X
    }
}
#113

Natural Language Question

Return the latest location information of an organ

Source

SPARQL Query

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX core:  <https://w3id.org/polifonia/ontology/core/>
PREFIX organs: <http://w3id.org/polifonia/resource/organs/>
PREFIX organ: <http://w3id.org/polifonia/ontology/organs/>
PREFIX ins: <http://w3id.org/polifonia/ontology/instrument/>

SELECT DISTINCT ?time ?name ?fulladdress ?city ?latitude ?longitude
WHERE {

    ?organ_query_iri core:includesWhole [
        a ins:InstrumentWhole ;
        core:hasTimedLocation [
            a core:TimedLocation ;
            core:hasLocation ?location ;
            core:hasTimeInterval [
                core:time ?time
            ]
        ]
    ] .

    OPTIONAL { 
        ?location core:latitude ?latitude ;
            core:longitude ?longitude .
    }

    OPTIONAL {
        ?location core:name ?name .
    }

    OPTIONAL {
        ?location core:hasAddress ?address .
        OPTIONAL {
            ?address core:fullAddress ?fulladdress .
        }

        OPTIONAL {
            ?address core:hasCity ?city .
        }
    }

    VALUES ?organ_query_iri {
        organs:Part12_062RhenenGereformeerde
    }
} ORDER BY DESC(?time) LIMIT 1
#114

Natural Language Question

When was this organ built?

Source

SPARQL Query

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX core:  <https://w3id.org/polifonia/ontology/core/>
PREFIX organs: <http://w3id.org/polifonia/resource/organs/>
PREFIX organ: <http://w3id.org/polifonia/ontology/organs/>
PREFIX ins: <http://w3id.org/polifonia/ontology/instrument/>

SELECT DISTINCT ?organ_query_iri ?year_date ?year_str
WHERE {

    ?organ_query_iri core:describedBy [
        a organ:OrganProject ;
        core:definesTask [
            core:isClassifiedBy  organ:TaskTypeBuild
        ] ;
        core:hasTimedLocation [
            core:hasTimeInterval  [
                rdfs:label  ?year_str ;
                core:time   ?year_date
            ]
        ]
    ] .
    
    VALUES ?organ_query_iri {
        organs:Part12_063UtrechtMaria
        organs:Part01_071NOORD_project005
        organs:OI-ee4e8485b89314b0555e15c5b0b7181c
        organs:OI-9cdd45d61395b751d4453436ce49d0db
        organs:FR-28227-MAINT-STPIER1-T
        organs:FR-33314-PAUIL-STMART1-X
        organs:FR-37231-SSRAC-STPATE1-X
    }
}
#115

Natural Language Question

Return website links associated with the given organs, if present.

Source

SPARQL Query

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX core:  <https://w3id.org/polifonia/ontology/core/>
PREFIX organs: <http://w3id.org/polifonia/resource/organs/>
PREFIX organ: <http://w3id.org/polifonia/ontology/organs/>

SELECT DISTINCT ?external_url
WHERE {
    ?organ_query_iri a organ:Organ ;
    core:description ?external_url .

    VALUES ?organ_query_iri {
        organs:Part15_021AlphenaandenRijn
        organs:OI-ee4e8485b89314b0555e15c5b0b7181c
        organs:FR-67462-SELES-STFOYY1-X
    }
}
Odoma and Graphia logos

Quagga has been developed by Odoma ↗ for Graphia ↗

Funded by the European Union (grant ID: 1O1188018 ↗)

Contact Github FAQ