Search Mailing List Archives


Limit search to: Subject & Body Subject Author
Sort by: Reverse Sort
Limit to: All This Week Last Week This Month Last Month
Select Date Range     through    

[protege-owl] retreiving Individuals using SPARQL

Pitonyak, Andrew D PitonyakA at BATTELLE.ORG
Tue Mar 24 08:13:17 PDT 2009


Not pretty, but, I do the following:

(1) use SPARQL to get ALL classes. 

SELECT DISTINCT ?sub
WHERE { ?sub rdf:type owl:Class }

This provides all of the classes. If you desire to also obtain the hierarchy, then find and build it.

SELECT DISTINCT ?sub ?obj
WHERE { ?sub rdfs:subClassOf ?obj }

Now, for each class, I perform a query:

SELECT DISTINCT ?sub
WHERE { ?sub rdf:type <" + parent.getUri() + "> }

Not pretty, but it works. Also, since your Ontology is likely to contain more individuals than classes and properties, AND, because your types are likely to have their own namespace, you can probably use a filter in your query. I will not test this query, so figuring it out is your problem, but it is likely something like this:


SELECT DISTINCT ?sub ?obj
WHERE { ?sub rdf:type ?obj FILTER ( regex(str(?obj), "your name space here" ) }


-----Original Message-----
From: protege-owl-bounces at lists.stanford.edu [mailto:protege-owl-bounces at lists.stanford.edu] On Behalf Of babar shahzad
Sent: Tuesday, March 24, 2009 10:36 AM
To: protege-owl at lists.stanford.edu
Subject: [protege-owl] retreiving Individuals using SPARQL



Hi all,

Is it possible using SPARQL to query Individuals ???
If so, can someone kindly provide a simple example!

Suppose there is a concept 'Product' & it has some individuals as members.



 
Babar Shahzad Chaudary, 
+358408532112         
Deptt of Information Processing
Science,
University of Oulu, Finland.



      
_______________________________________________
protege-owl mailing list
protege-owl at lists.stanford.edu
https://mailman.stanford.edu/mailman/listinfo/protege-owl

Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03 



More information about the protege-owl mailing list