ArtResearch / artresearch.net

ArtResearch ResearchSpace application hosted at https://artresearch.net
5 stars 1 forks source link

SOLR simple search config without blazegraph #401

Open lklic opened 2 years ago

lklic commented 2 years ago

after some testing we have found that for the simple search facets the following query is being constructed:

PREFIX fr: <https://artresearch.net/resource/fr/>
PREFIX solr: <http://custom.solr/ontology#>
PREFIX crm: <http://www.cidoc-crm.org/cidoc-crm/>
SELECT ?value (COUNT(DISTINCT ?subject) AS ?count) WHERE {
  SERVICE <http://www.researchspace.org/resource/system/service/custom#solrworks> {
    ?solrApi solr:setQuery "maria";
      solr:setDefType "dismax";
      solr:setFilter "id";
      solr:setRowsNumber 1000 ;
      solr:hasResults ?subject.
  }
  ?subject fr:Work_depicted_by_Photo ?photograph.
  ?photograph crm:P129i_is_subject_of ?images.
  ?images crm:P2_has_type <http://vocab.getty.edu/aat/300078817>.
  ?subject fr:Work_created_from_Artist ?value.
}
GROUP BY ?value
ORDER BY (?value)
LIMIT 10001

The second part of the query that is outside of the service clause could be constructed in the following way to maintain all queries against the SOLR index:

PREFIX fr: <https://artresearch.net/resource/fr/>
PREFIX solr: <http://custom.solr/ontology#>
PREFIX crm: <http://www.cidoc-crm.org/cidoc-crm/>
SELECT ?value (COUNT(DISTINCT ?subject) AS ?count) WHERE {
  SERVICE <http://www.researchspace.org/resource/system/service/custom#solrworks> {
    ?solrApi solr:setQuery "botticelli";
      solr:setDefType "dismax";
      solr:setFilter "id";
      solr:setRowsNumber 1000 ;
      solr:hasResults ?subject.
      solr:artistURI ?artistURI.
  }

        BIND(?artistURI as $value).
}
GROUP BY ?value
ORDER BY (?value)
LIMIT 10001 

the 'BIND(?artist as ?value).` should be defined in the “relations” … … “query_pattern” string in the service descriptor for each field of the facet (in this case the creator /artist).

In order to do this: