earthcube / earthcube_utilities

crawl and assert data-repository metadata for search
0 stars 0 forks source link

Sparql query will old query perform? #168

Closed valentinedwv closed 14 hours ago

valentinedwv commented 3 months ago

Wil the old query perform if we limit the value to dataset?

https://raw.githubusercontent.com/earthcube/facetsearch/3ec9644e0cbe4376575a2b70cf276d9c6f452225/client/src/sparql_blaze/sparql_query.txt

original query: 2 minutes. Warmed up 20 seconds

modified below: 13 seconds added:

            values ?sosType {
               sschema:Dataset
 #              schema:DataCatalog
            }
            ?subj a ?sosType .
PREFIX bds: <http://www.bigdata.com/rdf/search#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix schema: <http://schema.org/>
prefix sschema: <https://schema.org/>
SELECT distinct ?subj ?g ?resourceType ?name ?description  ?pubname
    (GROUP_CONCAT(DISTINCT ?placename; SEPARATOR=", ") AS ?placenames)
        (GROUP_CONCAT(DISTINCT ?kwu; SEPARATOR=", ") AS ?kw)
        ?datep  (GROUP_CONCAT(DISTINCT ?url; SEPARATOR=", ") AS ?disurl) (MAX(?score1) as ?score)
       (MAX(?lat) as ?maxlat) (Min(?lat) as ?minlat) (MAX(?lon) as ?maxlon) (Min(?lon) as ?minlon)
        WHERE {
            ?lit bds:search "water" .
            ?lit bds:matchAllTerms false .
            ?lit bds:relevance ?score1 .
            ?subj ?p ?lit .
            filter( ?score1 > 0.14).
          graph ?g {
            values ?sosType {
               sschema:Dataset
 #              schema:DataCatalog
            }
            ?subj a ?sosType .
             ?subj schema:name|sschema:name ?name .
             ?subj schema:description|sschema:description ?description .
            Minus {?subj a sschema:ResearchProject } .
            Minus {?subj a schema:ResearchProject } .
            Minus {?subj a schema:Person } .
            Minus {?subj a sschema:Person } .
             }
            BIND (IF (exists {?subj a schema:Dataset .} ||exists{?subj a sschema:Dataset .} , "data", "tool")
                AS ?resourceType).
            optional {?subj schema:distribution/schema:url|schema:subjectOf/schema:url ?url .}
            OPTIONAL {?subj schema:datePublished|sschema:datePublished ?date_p .}
            OPTIONAL {?subj schema:publisher/schema:name|sschema:publisher/sschema:name|sschema:sdPublisher|schema:provider/schema:name ?pub_name .}
            OPTIONAL {?subj schema:spatialCoverage/schema:name|sschema:spatialCoverage/sschema:name ?place_name .}
            OPTIONAL {?subj schema:keywords|sschema:keywords ?kwu .}
            BIND ( IF ( BOUND(?date_p), ?date_p, "No datePublished") as ?datep ) .
            BIND ( IF ( BOUND(?pub_name), ?pub_name, "No Publisher") as ?pubname ) .
            BIND ( IF ( BOUND(?place_name), ?place_name, "No spatialCoverage") as ?placename ) .
        }
        GROUP BY ?subj ?pubname ?placenames ?kw ?datep ?disurl ?score ?name ?description  ?resourceType ?g ?minlat ?maxlat ?minlon ?maxlon
        ORDER BY DESC(?score)
LIMIT 1000
OFFSET 0
valentinedwv commented 3 months ago

Running with search data.

Answer is nope