customized seach function

44 views
Skip to first unread message

Shreelakshmi G.M

unread,
Mar 21, 2016, 5:39:11 AM3/21/16
to TopBraid Suite Users
I would like to create customized form where there would be search functionality which is just a keyword search i.e it may search either a class or a property or an instance.
Autocomplete did not work as it can be either for class or for instance. whatever we give in arg:type that will be searched. owl:Thing is for instances and owl:Class is for class. Let me know what should be the arg:type to search all these.

-Shreelakshmi

Holger Knublauch

unread,
Mar 21, 2016, 5:53:00 AM3/21/16
to topbrai...@googlegroups.com
Have you tried rdfs:Resource? (This assumes you are operating on a graph that has all imports including the system triples - using _withImports=true on the servlet or ui:graphWithImports(?graph) on the graph would do this.

Holger
--
You received this message because you are subscribed to the Google Group "TopBraid Suite Users", the topics of which include Enterprise Vocabulary Network (EVN), Reference Data Manager (RDM), TopBraid Composer, TopBraid Live, TopBraid Insight, 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.

Shreelakshmi G.M

unread,
Mar 21, 2016, 6:04:21 AM3/21/16
to TopBraid Suite Users
Yes. i am embedding the SWA components in html, and I am following the example that is there in TBC.
In html page I have this swa.queryGraphURI = "http://rdfex.org/withImports?uri=http://www.kanoe.org/ontology/myGraph";


You received this message because you are subscribed to a topic in the Google Groups "TopBraid Suite Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/topbraid-users/YckJr7AkueY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to topbraid-user...@googlegroups.com.

Shreelakshmi G.M

unread,
Mar 21, 2016, 6:05:48 AM3/21/16
to TopBraid Suite Users
Also I have tried using rdfs:Resource and it does not show any result.

Irene Polikoff

unread,
Mar 21, 2016, 11:11:36 AM3/21/16
to topbrai...@googlegroups.com
Have you tried rdfs:Resource as the arg:type?

Sent from my iPhone

Irene Polikoff

unread,
Mar 21, 2016, 11:15:58 AM3/21/16
to topbrai...@googlegroups.com
If you change the argument to be owl:Thing or owl:Class you get the results, but if you use rdfs:Resource you don't. Is this correct?

Sent from my iPhone

Holger Knublauch

unread,
Mar 21, 2016, 7:35:16 PM3/21/16
to topbrai...@googlegroups.com
I have just tried that, using swadoc:AutoCompleteExample:

<swa:AutoComplete arg:id="property" arg:type="rdfs:Resource"/>

and it appears to work fine for me - all resources show up. Are you sure that all instances in your data have rdfs:labels etc?

Holger

Shreelakshmi G.M

unread,
Mar 22, 2016, 1:30:13 AM3/22/16
to TopBraid Suite Users
@Irene Polikoff : yes with owl:Class I get all the classes and with owl:Thing I get all instances. I need both classes and instances in a single Autocomplete tag.

@Holger Knublauch: yes all the instances have rdfs:label in the RDF file I am using and the file is bult using TBC itself.

this is the snippet for one of the instance in the RDF file :

<prefixA:classA rdf:ID="instanceA">
    <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">instanceA</rdfs:label>
  </prefixA:classA>

Shreelakshmi G.M

unread,
Mar 22, 2016, 5:59:08 AM3/22/16
to TopBraid Suite Users
To make it simple, I just created a RDF file with single owl class in it, even that class is also not listed by rdfs:Resource argument.

 <owl:Class rdf:ID="t">
    <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
    >t</rdfs:label>
  </owl:Class>

This is the snippet for class in RDF file.

Shreelakshmi G.M

unread,
Mar 23, 2016, 7:11:50 AM3/23/16
to TopBraid Suite Users
I could recognize the where the problem is. If I use .ttl serialization, I can use rdfs:Resource to list all resources but the same cannot be done using RDF/XML serialization.
Is there any solution for this as I have already built an ontology in RDF/XML which I need to use. 

Irene Polikoff

unread,
Mar 23, 2016, 9:17:41 AM3/23/16
to topbrai...@googlegroups.com
This sounds peculiar. By the time you are running your code, everything should already be de-serialised. 

Can you successfully open your RDF/XML file in TBC?

Irene Polikoff

Shreelakshmi G.M

unread,
Mar 23, 2016, 9:42:51 AM3/23/16
to TopBraid Suite Users

Yes, it opens. Actually, I created RDF/XML file in TBC itself. To test I created one .rdf file and one .ttl file with 2 classes and some instances. Then I tried using rdfs: Resource. It works with .ttl and not with .rdf.

Irene Polikoff

unread,
Mar 23, 2016, 9:46:49 AM3/23/16
to topbrai...@googlegroups.com
OK, we will investigate.

As an aside, you can save your RDF/XML file in Turtle by using Export > TopBraid Composer > Export/Merge/Convert RDF Graphs.

Irene Polikoff

Shreelakshmi G.M

unread,
Mar 23, 2016, 10:01:23 AM3/23/16
to TopBraid Suite Users

Thanks Irene I will try saving RDF to turtle and check.

Holger Knublauch

unread,
Mar 23, 2016, 7:03:45 PM3/23/16
to topbrai...@googlegroups.com
This is really weird. The serialization really should not make a difference. The only explanation I have would be that the owl: namespace is somehow pointing at something else than we believe. If you can't get it to work, please send a minimal but complete set of RDF files for us to reproduce the problem. We are otherwise speculating on an incomplete picture.

Holger

Shreelakshmi G.M

unread,
Mar 24, 2016, 2:40:56 AM3/24/16
to TopBraid Suite Users
To test I just created a simple RDF file TBC. I am attaching the file along.

I am using rdfs:Resource as below :

<swa:BorderLayout arg:southSize="150" arg:style="width: 400px; height: 400px">
    <swa:Window arg:id="searchFormWindow" arg:layoutPanel="center" arg:title="Search Form">
        <swa:FormSearchGadget arg:classSelectedEvent="org.example.classSelected" ui:args="*"/>
        <div>
            <h3>Please select a property</h3>
            <div>
                <span>Property: </span>
                <swa:AutoComplete arg:id="property" arg:type="rdfs:Resource"/>
                <br/>
                <br/>
                <button onclick="alert('Selected: ' + $('#property').val())">Show Selection</button>
            </div>
        </div>
    </swa:Window>
    <swa:Window arg:id="searchGridWindow" arg:layoutPanel="south" arg:title="Search Results">
        <swa:GridSearchResultsGadget arg:resourceSelectedEvent="org.example.resourceSelected"/>
    </swa:Window>
</swa:BorderLayout>

In the html page I have this :



testRDF.rdf

Shreelakshmi G.M

unread,
Mar 24, 2016, 2:43:55 AM3/24/16
to TopBraid Suite Users
Sorry, there was a mistake,

In html page, it is

Holger Knublauch

unread,
Mar 24, 2016, 3:46:49 AM3/24/16
to topbrai...@googlegroups.com
Ok, thanks for sending me the necessary files off-list. Going back into the list for the resolution.

Yes, there is a problem here: when you use rdfs:Resource as the main class, you will
- get thousands of matches that you don't really want (all system resources)
- run into a bug unless you also import skos:prefLabel (we'll fix that)

To cut a long story short, if you really want to see all resources (which I doubt), then add an owl:imports to skos-core. Otherwise, add only the system triples that you really want "by hand" into the base graph and use the the graph without imports in your data model. So if you add the following (in Turtle):

rdfs:Class
  rdfs:subClassOf rdfs:Resource ;
.
owl:Class a rdfs:Class ;
  rdfs:subClassOf rdfs:Class ;
.
rdfs:Class a rdfs:Class ;
  rdfs:subClassOf rdfs:Resource ;
.
rdf:Property
  a rdfs:Class ;
.

and change

            swa.queryGraphURI = "http://www.kanoe.org/ontology/testRDF";

I cannot guarantee that the rest of the widgets will still work correctly without the system graph, so you may need to only set the swa.queryGraphURI when the AutoComplete field is created and otherwise use the graph with imports.

HTH
Holger

Shreelakshmi G.M

unread,
Mar 24, 2016, 4:41:04 AM3/24/16
to TopBraid Suite Users
Thanks Holger for the solution. I added the required system triples in the graph and used the graph without imports. Still I am not able to get the result. I will check again if I have done any other mistakes.

Thanks,
Shreelakshmi

I 

Shreelakshmi G.M

unread,
Mar 24, 2016, 6:01:11 AM3/24/16
to TopBraid Suite Users
Hello Holger,

I have added these triples,

owl:Ontology a rdfs:Class ; 
      rdfs:subClassOf rdfs:Resource . 
      

 
owl:Class a rdfs:Class ;
      rdfs:subClassOf rdfs:Class .

rdfs:Class a rdfs:Class ;
      rdfs:subClassOf rdfs:Resource .


Now the problem is, I am able to list classes but not instances. Is it necessary to add any other triples linking instance to rdfs:Resource. I tried using 

test:a rdfs:subClassOf owl:Thing .

but this also did not work.

Thanks,
Shreelakshmi

Holger Knublauch

unread,
Mar 24, 2016, 6:12:25 AM3/24/16
to topbrai...@googlegroups.com
Also add owl:Thing rdfs:subClassOf rdfs:Resource.

Holger

Shreelakshmi G.M

unread,
Mar 24, 2016, 6:42:24 AM3/24/16
to TopBraid Suite Users
Thanks, it worked. I added:

owl:Thing a owl:Class ;
     rdfs:label "Thing" ;
     rdfs:comment "The class of OWL individuals." ;
     rdfs:isDefinedBy <http://www.w3.org/2002/07/owl#> ;
     rdfs:subClassOf rdfs:Resource .

and removed test:a rdfs:subClassOf owl:Thing .
Reply all
Reply to author
Forward
0 new messages