Magic Properties & Search (EVN)

11 views
Skip to first unread message

Adam Kimball

unread,
Dec 12, 2016, 6:00:01 PM12/12/16
to TopBraid Suite Users
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

Holger Knublauch

unread,
Dec 12, 2016, 6:18:08 PM12/12/16
to topbrai...@googlegroups.com
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
--
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 topbrai...@googlegroups.com
---
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 topbraid-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Adam Kimball

unread,
Dec 12, 2016, 7:11:11 PM12/12/16
to topbrai...@googlegroups.com

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 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

Holger Knublauch

unread,
Dec 12, 2016, 7:15:51 PM12/12/16
to topbrai...@googlegroups.com


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

Adam Kimball

unread,
Dec 12, 2016, 7:28:34 PM12/12/16
to topbrai...@googlegroups.com

Indeed, that led to a result in very little time. Thanks.  What do we need to do to improve it from here?


-Adam


From: topbrai...@googlegroups.com <topbrai...@googlegroups.com> on behalf of Holger Knublauch <hol...@topquadrant.com>
Sent: Monday, December 12, 2016 5:15:45 PM
To: topbrai...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages