Skip to content

Multi word text searches cause error in find_nanopubs_with_text #2

@raar1

Description

@raar1

Hi Tobias,

It seems that search terms with more than one word are causing find_nanopubs_with_text to error out. For example, if you try typing "homo sapiens" into the text field on Tapas ( http://grlc.nanopubs.lod.labs.vu.nl/tapas/tapas.html?op=/find_nanopubs_with_text ) then you get the following error dump:

Virtuoso 37000 Error XM029: Free-text expression, line 1: syntax error at sapiens


SPARQL query:
define sql:big-data-const 0 #+ summary: Find nanopublications that contain the given text
#+ method: GET
#+ pagination: 1000
#+ endpoint_in_url: False

prefix np: <http://www.nanopub.org/nschema#>
prefix npa: <http://purl.org/nanopub/admin/>
prefix dct: <http://purl.org/dc/terms/>
prefix luc: <http://www.ontotext.com/owlim/lucene#>   # for GraphDB
#prefix bif: <http://www.openlinksw.com/schemas/bif#>  # for Virtuoso

select ?np ?graphpred ?subj ?pred ?v ?date ?pubkey where {
  graph npa:graph {
    ?np npa:hasHeadGraph ?h .
    ?np npa:creationDay ?__day_iri .
    ?np npa:creationMonth ?__month_iri .
    ?np npa:creationYear ?__year_iri .
    ?np dct:created ?date .
  }
  graph ?h {
    ?np ?__graphpred_iri ?g .
    bind(?__graphpred_iri as ?graphpred)
  }
  graph ?g {
    { ?subj ?pred ?v . ?v luc:npIdx "homo sapiens" . }
    union
    { ?subj ?pred ?v .  ?v <bif:contains> "homo sapiens" . }
  }
  optional {
    graph npa:graph {
      ?np npa:hasValidSignatureForPublicKey ?pubkey .
    }
    # This duplication is a workaround for a Virtuoso bug (otherwise <bif:contains> above overgenerates):
    graph npa:graph {
      ?np npa:hasValidSignatureForPublicKey ?pubkey .
    }
  }
}
 LIMIT 1000 OFFSET 0

However, if you just enter 'homo' then it works as normal. Any way we can fix this query to allow multi-word searches?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions