KnowWhereGraph / kwg-faceted-search

Knowledge Explorer: The search interface to KnowWhereGraph
http://stko-kwg.geog.ucsb.edu
3 stars 0 forks source link

Queries according to facets #154

Closed seilagonzalez closed 2 years ago

seilagonzalez commented 2 years ago

Analysis of all queries

Explanation of different interaction with facetedsearch

seilagonzalez commented 2 years ago

for url for hazard: http://localhost:3000/#/result_search?tab=hazard&pp=20 Remove OC

counter query

select (count(*) as ?count) { select distinct ?entity ?label ?type ?typeLabel where {
        ?entity rdf:type ?type; 
            rdfs:label ?label.     
        ?type rdfs:subClassOf ?superClass;
            rdfs:label ?typeLabel.
        values ?superClass {kwg-ont:Hazard kwg-ont:Fire} #Temporary limiter
        values ?type {kwg-ont:EarthquakeEvent kwg-ont:Hurricane kwg-ont:Wildfire kwg-ont:WildlandFireUse kwg-ont:PrescribedFire kwg-ont:UnknownFire} }
}

query for results:

select distinct ?entity ?label ?type ?typeLabel ?placeLabel ?place ?startTimeLabel ?endTimeLabel ?wkt where {
        ?entity rdf:type ?type; 
            rdfs:label ?label.
         ?type rdfs:subClassOf ?superClass;
            rdfs:label ?typeLabel.
        values ?superClass {kwg-ont:Hazard kwg-ont:Fire} #Temporary limiter
        values ?type {kwg-ont:EarthquakeEvent kwg-ont:Hurricane kwg-ont:Wildfire kwg-ont:WildlandFireUse kwg-ont:PrescribedFire kwg-ont:UnknownFire} #Temporary limiter

           optional
            {
                ?entity kwg-ont:locatedIn ?place.
                ?place rdfs:label ?placeLabel.
            }
            optional
            {
                ?entity kwg-ont:hasImpact|sosa:isFeatureOfInterestOf ?observationCollection.
                ?observationCollection sosa:phenomenonTime ?time.
                ?time time:hasBeginning/time:inXSDDateTime|time:inXSDDate ?startTimeLabel;
                      time:hasEnd/time:inXSDDateTime|time:inXSDDate ?endTimeLabel.
            }
            optional
            {
                ?entity geo:hasGeometry/geo:asWKT ?wkt.
            }

    } LIMIT 20 OFFSET 0
seilagonzalez commented 2 years ago

Earthquakes:

Counter:

        ?entity rdf:type ?type; 
            rdfs:label ?label.
        ?type rdfs:subClassOf ?superClass;
            rdfs:label ?typeLabel.
        values ?superClass {kwg-ont:Hazard kwg-ont:Fire} #Temporary limiter
        values ?type {kwg-ont:EarthquakeEvent}

    }}

results:

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX kwg-ont: <http://stko-kwg.geog.ucsb.edu/lod/ontology/>
PREFIX sosa: <http://www.w3.org/ns/sosa/>
PREFIX time: <http://www.w3.org/2006/time#>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
select distinct ?entity ?label ?type ?typeLabel ?placeLabel ?place ?startTimeLabel ?endTimeLabel ?wkt where {
        ?entity rdf:type ?type; 
            rdfs:label ?label.
         ?type rdfs:subClassOf ?superClass;
            rdfs:label ?typeLabel.
        values ?superClass {kwg-ont:Hazard kwg-ont:Fire} #Temporary limiter
        values ?type {kwg-ont:EarthquakeEvent} #Temporary limiter

           optional
            {
                ?entity kwg-ont:locatedIn ?place.
                ?place rdfs:label ?placeLabel.
            }
            optional
            {
                ?entity kwg-ont:hasImpact|sosa:isFeatureOfInterestOf ?observationCollection.
                ?observationCollection sosa:phenomenonTime ?time.
                ?time time:hasBeginning/time:inXSDDateTime|time:inXSDDate ?startTimeLabel;
                      time:hasEnd/time:inXSDDateTime|time:inXSDDate ?endTimeLabel.
            }
            optional
            {
                ?entity geo:hasGeometry/geo:asWKT ?wkt.
            }

    } LIMIT 20 OFFSET 0
seilagonzalez commented 2 years ago

Earthquake with magnitude greater than 5 url: http://localhost:3000/#/result_search?tab=hazard&pp=20&hazard=EarthquakeEvent&mag-min=5 counter:

select (count(*) as ?count) where {
select distinct ?entity ?label ?type ?typeLabel ?placeLabel ?place ?startTimeLabel ?endTimeLabel ?wkt where {
        ?entity rdf:type ?type; 
            rdfs:label ?label.
         ?type rdfs:subClassOf ?superClass;
            rdfs:label ?typeLabel.
        values ?superClass {kwg-ont:Hazard kwg-ont:Fire} #Temporary limiter
        values ?type {kwg-ont:EarthquakeEvent} #Temporary limiter

    ?entity             kwg-ont:hasImpact|sosa:isFeatureOfInterestOf ?observationCollection.

        ?observationCollection sosa:hasMember ?magnitudeObj.
            ?magnitudeObj sosa:observedProperty kwgr:earthquakeObservableProperty.mag.
            ?magnitudeObj sosa:hasSimpleResult ?magnitude FILTER (xsd:decimal(STR(?magnitude)) > 6).

} }

results:

select distinct ?entity ?label ?type ?typeLabel ?placeLabel ?place ?startTimeLabel ?endTimeLabel ?wkt where {
        ?entity rdf:type ?type; 
            rdfs:label ?label.
         ?type rdfs:subClassOf ?superClass;
            rdfs:label ?typeLabel.
        values ?superClass {kwg-ont:Hazard kwg-ont:Fire} #Temporary limiter
        values ?type {kwg-ont:EarthquakeEvent} #Temporary limiter

           optional
            {
                ?entity kwg-ont:locatedIn ?place.
                ?place rdfs:label ?placeLabel.
            }
            optional
            {
                ?entity kwg-ont:hasImpact|sosa:isFeatureOfInterestOf ?observationCollection.
                ?observationCollection sosa:phenomenonTime ?time.
                ?time time:hasBeginning/time:inXSDDateTime|time:inXSDDate ?startTimeLabel;
                      time:hasEnd/time:inXSDDateTime|time:inXSDDate ?endTimeLabel.
            }
            optional
            {
                ?entity geo:hasGeometry/geo:asWKT ?wkt.
            }
    ?entity             kwg-ont:hasImpact|sosa:isFeatureOfInterestOf ?observationCollection.

        ?observationCollection sosa:hasMember ?magnitudeObj.
            ?magnitudeObj sosa:observedProperty kwgr:earthquakeObservableProperty.mag.
            ?magnitudeObj sosa:hasSimpleResult ?magnitude FILTER (xsd:decimal(STR(?magnitude)) > 6).

} limit 20 offset 0
seilagonzalez commented 2 years ago

Wildfire with zipcode

query results:

select distinct ?entity ?label ?type ?typeLabel where {
        ?entity rdf:type ?type;
            rdfs:label ?label.
          ?type rdfs:subClassOf ?superClass;
            rdfs:label ?typeLabel.
        values ?superClass {kwg-ont:Hazard kwg-ont:Fire} #Temporary limiter
        values ?type {kwg-ont:Wildfire}

        ?entity ?es ?s2Cell .
        ?s2Cell rdf:type kwg-ont:KWGCellLevel13 .
        values ?places {kwgr:zipcode.93101}
       ?s2Cell ?sp ?places .
    }
ThomasThelen commented 2 years ago

The graph has changed structure since so I'm going to close this issue