On 13/12/2016 10:11, Adam Kimball wrote:

Sure, thanks!

The Magic Property:

SELECT ?code

WHERE {

    ?arg1 ?rel_relation ?concept .

?rel_relation (rdfs:subPropertyOf)* content_asset_schema:relevancy_based_relation .

    ?concept ?has_code ?code .

    ?concept rdf:type/(rdfs:subClassOf)* concept_schema:HwcvConcept .

    ?has_code rdfs:subPropertyOf concept_schema:code_match .

}


The query below has the argument on the right hand side bound, but a variable on the left. So this query is executed in "the wrong order". As a result, it will first execute the lines

    ?arg1 ?rel_relation ?concept .

?rel_relation (rdfs:subPropertyOf)* content_asset_schema:relevancy_based_relation .


which, if ?arg1 is unbound, will produce millions of matches.

Could you try to change the body of the magic property to move the rows

?has_code rdfs:subPropertyOf concept_schema:code_match .

?concept ?has_code ?code

to the top of the WHERE clause? This should eliminate most matches right from the start and have much better query performance.

(This is just to test whether we are on the right track - we'd need to make further changes to make sure the query behaves efficiently if executed with ?arg1 bound but no ?code.

Holger


The output from the Sparql query

SELECT DISTINCT ?result ?label

WHERE {

    {

?result hw-magic-props:has_code <http://metadata.healthwise.org/umls/icd9cm_data#441.4> .

        ?result a ?type .

FILTER (?type IN (content_asset_schema:Care_Support, content_asset_schema:Decision_Point, content_asset_schema:Definition, content_asset_schema:Document, content_asset_schema:KB, content_asset_schema:MM_Doc, content_asset_schema:PI)) .

    } .

    BIND (ui:label(?result) AS ?label) .

}

ORDER BY (LCASE(?label))

-Adam

*From: *<[email protected]> on behalf of Holger Knublauch <[email protected]> *Reply-To: *"[email protected]" <[email protected]>
*Date: *Monday, December 12, 2016 at 4:17 PM
*To: *"[email protected]" <[email protected]>
*Subject: *Re: [topbraid-users] Magic Properties & Search (EVN)

Hi Adam,

could you share the definition of the magic property (anonymized TTL snippet is fine) with me?

Furthermore, could you copy and paste the SPARQL that is generated by the search form in a typical scenario? You can get this query in the gear context menu under the search form.

Thanks
Holger

On 13/12/2016 9:00, Adam Kimball wrote:

    Hi all,

    I'm building my first magic properties and trying to add them to
    our EVN search.  I have the properties functioning normally from
    sparql and they are showing up fine in the search panel.  But
    using these properties simply results in endless queries.  I'm
    hoping its something simple, like needing to explicitly bind ?this
    to ?arg1 or something.

    I have to say my mind is a tad turned around from the exercise
    though!  The use case is:

    :Document :usesCode :Code

    (the actual model has :Document->:Concept->:Code, thus the use of
    the magic property)

    I am using swa:Subjects in form.  Type-ahead is working for the codes.

    Any suggestions for me?

    Thanks!
    -adam

-- You received this message because you are subscribed to the Google
    Group "TopBraid Suite Users", the topics of which include the
    TopBraid Suite family of products and its base technologies such
    as SPARQLMotion, SPARQL Web Pages and SPIN.
    To post to this group, send email to
    [email protected]
    <mailto:[email protected]>
    ---
    You received this message because you are subscribed to the Google
    Groups "TopBraid Suite Users" group.
    To unsubscribe from this group and stop receiving emails from it,
    send an email to [email protected]
    <mailto:[email protected]>.
    For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Group "TopBraid Suite Users", the topics of which include the TopBraid Suite family of products and its base technologies such as SPARQLMotion, SPARQL Web Pages and SPIN.
To post to this group, send email to [email protected]
---
You received this message because you are subscribed to the Google Groups "TopBraid Suite Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected] <mailto:[email protected]>.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Group "TopBraid Suite Users", the topics of which include the TopBraid Suite family of products and its base technologies such as SPARQLMotion, SPARQL Web Pages and SPIN.
To post to this group, send email to [email protected]
---
You received this message because you are subscribed to the Google Groups "TopBraid Suite Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected] <mailto:[email protected]>.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Group "TopBraid 
Suite Users", the topics of which include the TopBraid Suite family of products and 
its base technologies such as SPARQLMotion, SPARQL Web Pages and SPIN.
To post to this group, send email to [email protected]
--- You received this message because you are subscribed to the Google Groups "TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to