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-discussion] Problem with SPARQL query

Matthew Horridge matthew.horridge at stanford.edu
Tue Nov 29 15:35:27 PST 2011


Hi Linh,

You need to know something about how toppings in this ontology are represented in OWL and how this OWL translates to RDF under the hood.  Take your example of Caprina pizza.  The fact that a Caprina pizza has a tomato topping is represented by the following axiom in OWL:

Class:  Caprina 

SubClassOf:
	 hasTopping some TomatoTopping

in other words Caprina is a subclass of the class of things that have at least one hasTopping relationship to an instance of TomatoTopping.  This gets translated to the following RDF triples:


:Caprina  rdfs:subClassOf _:x .
_:x rdf:type owl:Restriction .
_:x owl:onProperty :hasTopping .
_:x owl:someValuesFrom :TomatoTopping .

where the _:x represents a blank node that is used in RDF to encode the "hasTopping some TomatoTopping" class expression.  You would therefore need to ask the following query, which returns a table with two columns - one containing the pizza and one containing the topping.


SELECT ?p ?t 

WHERE
{
?p rdfs:subClassOf _:x .
_:x rdf:type owl:Restriction .
_:x owl:onProperty :hasTopping .
_:x owl:someValuesFrom ?t .
}

This gives the results you seem to want (see screenshot below).  You should note that these results are based on asserted information as Protege 3 doesn't use any reasoning to answer sparql queries.  If you need reasoning to compute query answers then you'll need to use reasoners that support this such as Pellet or HermiT directly.

Cheers,

Matthew



On 29 Nov 2011, at 07:32, Khánh Linh wrote:

> Hi,
> 
> I have added "SELECT ?p" instead of "SELECT *" but it still does not work (returns "No matches found").
> 
> I think we will get rid of it and try to focus on thinking query for example: Find which pizzas has TomatoTopping or, which toppings that a Caprina pizza has ?
> 
> Thanks a lot,
> 
> Linh
> On Tue, Nov 29, 2011 at 5:51 PM, <protege-discussion-request at lists.stanford.edu> wrote:
> Send protege-discussion mailing list submissions to
>        protege-discussion at lists.stanford.edu
> 
> To subscribe or unsubscribe via the World Wide Web, visit
>        https://mailman.stanford.edu/mailman/listinfo/protege-discussion
> or, via email, send a message with subject or body 'help' to
>        protege-discussion-request at lists.stanford.edu
> 
> You can reach the person managing the list at
>        protege-discussion-owner at lists.stanford.edu
> 
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of protege-discussion digest..."
> 
> 
> Today's Topics:
> 
>   1. Re: Problem with SPARQL query (Brice Sommacal)
>   2. Re: 3.4.7 WebStart Client failing (Dennis Pierson)
> 
> 
> ----------------------------------------------------------------------
> 
> Message: 1
> Date: Tue, 29 Nov 2011 11:31:16 +0100
> From: Brice Sommacal <brice.sommacal at gmail.com>
> To: User support for Core Protege and the Protege-Frames editor
>        <protege-discussion at lists.stanford.edu>
> Subject: Re: [protege-discussion] Problem with SPARQL query
> Message-ID:
>        <CAKf=qYvT+BOkCFu973Aj03qK7DE87+se3GJrAyzLxGYBZmUbww at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
> 
> Hello Linh,
> 
> In your SELECT, you have to refer to a variable which is defined in your
> query.
> You can't use "*" in SELECT, but only a variable (?x).
> 
> You should try:
> *"PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> *
> *PREFIX pizza: <http://www.co-ode.org/ontologies/pizza/pizza.owl#> *
> *SELECT ?p WHERE { ?p rdf:type pizza:Pizza; pizza:hasTopping ?t. ?t
> rdf:type pizza:TomatoTopping }"*
> 
> Regards,
> 
> Brice
> 
> 2011/11/29 Kh?nh Linh <linhkid91 at gmail.com>
> 
> > Dear all,
> >
> > I know this maybe a stupid question but I will be very glad if someone
> > help me with this. I'm absolutely new with Ontology.
> >
> > Started with Pizza example. I want to list a Pizza that has Tomato
> > Topping. And I tried this in my Prote?ge? 3.4.7 in the SPARQL Query Panel:
> >
> > *"PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> *
> > *PREFIX pizza: <http://www.co-ode.org/ontologies/pizza/pizza.owl#> *
> > *SELECT * WHERE { ?p rdf:type pizza:Pizza; pizza:hasTopping ?t. ?t
> > rdf:type pizza:TomatoTopping }"*
> >
> > It returns "No matches found".
> >
> > I don't know why the result is like that. Can you run this query and find
> > out why it returns null ?
> >
> > Beside, I also attach the Pizza.owl.pprj file if somebody doesn't have it.
> >
> > I'm looking forward to hearing from you,
> >
> > Best regrads,
> >
> > Linh Nguyen
> >
> > _______________________________________________
> > protege-discussion mailing list
> > protege-discussion at lists.stanford.edu
> > https://mailman.stanford.edu/mailman/listinfo/protege-discussion
> >
> > Instructions for unsubscribing:
> > http://protege.stanford.edu/doc/faq.html#01a.03
> >
> >
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://mailman.stanford.edu/pipermail/protege-discussion/attachments/20111129/b8e8f11b/attachment-0001.html>
> 
> ------------------------------
> 
> Message: 2
> Date: Tue, 29 Nov 2011 10:51:09 +0000
> From: Dennis Pierson <Dennis.Pierson at mphasis.com>
> To: User support for Core Protege and the Protege-Frames editor
>        <protege-discussion at lists.stanford.edu>
> Subject: Re: [protege-discussion] 3.4.7 WebStart Client failing
> Message-ID:
>        <268F58C065D67D48853D7F4337BAFB4D01FACA at MPDAMBX01.corp.mphasis.com>
> Content-Type: text/plain; charset="iso-8859-1"
> 
> I think this slipped by. Please take a look.
> 
> From: protege-discussion-bounces at lists.stanford.edu [mailto:protege-discussion-bounces at lists.stanford.edu] On Behalf Of Dennis Pierson
> Sent: Sunday, November 27, 2011 3:39 PM
> To: protege-discussion at lists.stanford.edu
> Cc: Solomon Harsha
> Subject: [protege-discussion] 3.4.7 WebStart Client failing
> 
> Hi,
> 
> I believe the downloaded client is connecting across the internet ok. It stalls when I click the Open Other button. I can create a new one, but I'm not sure which file system it's looking at because I can't find it either locally or remotely after I save it.  The webapp is working fine.
> 
> Here's the stack trace from the java console - the logger.access denied, bundle, and jgo NoClassDefFoundError warnings happen on load (where is that class?).
> 
> The AccessControlException exceptions occur when I click the Open Other button. I tried cert-signing the prot?g?.jar in the webapps/WebProtege/lib folder, but that didn't help. If that really is the solution, I may have done it wrong
> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> Exception configuring logger
> Could not set logger level
> Warning: IO exception getting logger. access denied (java.util.PropertyPermission protege.properties.in.user.home read)
> Nov 27, 2011 3:29:21 PM edu.stanford.smi.protege.plugin.PluginUtilities findPluginsDirectory
> WARNING: Application directory not specified
> Nov 27, 2011 3:29:22 PM edu.stanford.smi.protege.resource.BundleHelper <init>
> WARNING: missing bundle: standard_extensions_text
> Nov 27, 2011 3:29:22 PM edu.stanford.smi.protege.resource.BundleHelper internalGetText
> WARNING: no resource bundle: tab.queries
> Nov 27, 2011 3:29:22 PM edu.stanford.smi.protege.plugin.PluginUtilities isLoadableClass
> WARNING: java.lang.NoClassDefFoundError: com/nwoods/jgo/JGoViewListener
> JGoodies Looks: Can't read the System property Plastic.tabStyle.
> JGoodies Looks: Can't read the System property Plastic.highContrastFocus.
> JGoodies Looks: Can't read the System property Plastic.defaultTheme.
> JGoodies Looks: Can't read the System property jgoodies.useNarrowButtons.
> JGoodies Looks: Can't read the System property jgoodies.tabIconsEnabled.
> JGoodies Looks: Can't read the System property jgoodies.popupDropShadowEnabled.
> Nov 27, 2011 3:29:22 PM edu.stanford.smi.protege.resource.BundleHelper <init>
> WARNING: missing bundle: protege_text
> Exception occurred during event dispatching:
> java.security.AccessControlException: access denied (java.util.PropertyPermission user.dir read)
>                at java.security.AccessControlContext.checkPermission(Unknown Source)
>                at java.security.AccessController.checkPermission(Unknown Source)
>                at java.lang.SecurityManager.checkPermission(Unknown Source)
>                at java.lang.SecurityManager.checkPropertyAccess(Unknown Source)
>                at java.lang.System.getProperty(Unknown Source)
>                at java.io.Win32FileSystem.getUserPath(Unknown Source)
>                at java.io.Win32FileSystem.resolve(Unknown Source)
>                at java.io.File.getAbsolutePath(Unknown Source)
>                at javax.swing.filechooser.WindowsFileSystemView.isFloppyDrive(Unknown Source)
>                at javax.swing.plaf.basic.BasicFileChooserUI$BasicFileView.getIcon(Unknown Source)
>                at com.jgoodies.looks.plastic.PlasticFileChooserUI$SystemIconFileView.getIcon(PlasticFileChooserUI.java:95)
>                at javax.swing.JFileChooser.getIcon(Unknown Source)
>                at javax.swing.plaf.metal.MetalFileChooserUI$DirectoryComboBoxRenderer.getListCellRendererComponent(Unknown Source)
>                at javax.swing.plaf.basic.BasicListUI.updateLayoutState(Unknown Source)
>                at javax.swing.plaf.basic.BasicListUI.maybeUpdateLayoutState(Unknown Source)
>                at javax.swing.plaf.basic.BasicListUI$Handler.valueChanged(Unknown Source)
>                at javax.swing.DefaultListSelectionModel.fireValueChanged(Unknown Source)
>                at javax.swing.DefaultListSelectionModel.fireValueChanged(Unknown Source)
>                at javax.swing.DefaultListSelectionModel.fireValueChanged(Unknown Source)
>                at javax.swing.DefaultListSelectionModel.changeSelection(Unknown Source)
>                at javax.swing.DefaultListSelectionModel.changeSelection(Unknown Source)
>                at javax.swing.DefaultListSelectionModel.setSelectionInterval(Unknown Source)
>                at javax.swing.JList.setSelectedIndex(Unknown Source)
>                at javax.swing.plaf.basic.BasicComboPopup.setListSelection(Unknown Source)
>                at javax.swing.plaf.basic.BasicComboPopup.access$300(Unknown Source)
>                at javax.swing.plaf.basic.BasicComboPopup$Handler.itemStateChanged(Unknown Source)
>                at javax.swing.JComboBox.fireItemStateChanged(Unknown Source)
>                at javax.swing.JComboBox.selectedItemChanged(Unknown Source)
>                at javax.swing.JComboBox.contentsChanged(Unknown Source)
>                at javax.swing.AbstractListModel.fireContentsChanged(Unknown Source)
>                at javax.swing.plaf.metal.MetalFileChooserUI$DirectoryComboBoxModel.setSelectedItem(Unknown Source)
>                at javax.swing.plaf.metal.MetalFileChooserUI$DirectoryComboBoxModel.addItem(Unknown Source)
>                at javax.swing.plaf.metal.MetalFileChooserUI$DirectoryComboBoxModel.access$900(Unknown Source)
>                at javax.swing.plaf.metal.MetalFileChooserUI.doDirectoryChanged(Unknown Source)
>                at javax.swing.plaf.metal.MetalFileChooserUI.access$1200(Unknown Source)
>                at javax.swing.plaf.metal.MetalFileChooserUI$5.propertyChange(Unknown Source)
>                at java.beans.PropertyChangeSupport.firePropertyChange(Unknown Source)
>                at java.beans.PropertyChangeSupport.firePropertyChange(Unknown Source)
>                at java.awt.Component.firePropertyChange(Unknown Source)
>                at javax.swing.JFileChooser.setCurrentDirectory(Unknown Source)
>                at javax.swing.JFileChooser.<init>(Unknown Source)
>                at javax.swing.JFileChooser.<init>(Unknown Source)
>                at edu.stanford.smi.protege.util.ProjectChooser.<init>(Unknown Source)
>                at edu.stanford.smi.protege.ui.ProjectManager.getRequestedProject(Unknown Source)
>                at edu.stanford.smi.protege.ui.ProjectManager.openProjectRequest(Unknown Source)
>                at edu.stanford.smi.protege.ui.WelcomeDialog.openOtherButton_actionPerformed(Unknown Source)
>                at edu.stanford.smi.protege.ui.WelcomeDialog$3.actionPerformed(Unknown Source)
>                at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
>                at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
>                at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
>                at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
>                at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
>                at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
>                at java.awt.Component.processMouseEvent(Unknown Source)
>                at javax.swing.JComponent.processMouseEvent(Unknown Source)
>                at java.awt.Component.processEvent(Unknown Source)
>                at java.awt.Container.processEvent(Unknown Source)
>                at java.awt.Component.dispatchEventImpl(Unknown Source)
>                at java.awt.Container.dispatchEventImpl(Unknown Source)
>                at java.awt.Component.dispatchEvent(Unknown Source)
>                at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
>                at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
>                at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
>                at java.awt.Container.dispatchEventImpl(Unknown Source)
>                at java.awt.Window.dispatchEventImpl(Unknown Source)
>                at java.awt.Component.dispatchEvent(Unknown Source)
>                at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
>                at java.awt.EventQueue.access$000(Unknown Source)
>                at java.awt.EventQueue$1.run(Unknown Source)
>                at java.awt.EventQueue$1.run(Unknown Source)
>                at java.security.AccessController.doPrivileged(Native Method)
>                at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
>                at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
>                at java.awt.EventQueue$2.run(Unknown Source)
>                at java.awt.EventQueue$2.run(Unknown Source)
>                at java.security.AccessController.doPrivileged(Native Method)
>                at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
>                at java.awt.EventQueue.dispatchEvent(Unknown Source)
>                at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
>                at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
>                at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
>                at java.awt.Dialog$1.run(Unknown Source)
>                at java.awt.event.InvocationEvent.dispatch(Unknown Source)
>                at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
>                at java.awt.EventQueue.access$000(Unknown Source)
>                at java.awt.EventQueue$1.run(Unknown Source)
>                at java.awt.EventQueue$1.run(Unknown Source)
>                at java.security.AccessController.doPrivileged(Native Method)
>                at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
>                at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
>                at java.awt.EventQueue$2.run(Unknown Source)
>                at java.awt.EventQueue$2.run(Unknown Source)
>                at java.security.AccessController.doPrivileged(Native Method)
>                at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
>                at java.awt.EventQueue.dispatchEvent(Unknown Source)
>                at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
>                at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
>                at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
>                at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
>                at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
>                at java.awt.EventDispatchThread.run(Unknown Source)
> 
> Dennis Pierson | Senior Architect, MDM and Semantics | M P H A S I S  an HP Company | 460 Park Avenue South, Suite 1101, New York, NY 10016  |  Fax:  (212) 686 2422 | Mobile: (215) 622 1650|  www.mphasis.com<https://usmail1.mphasis.com/owa/UrlBlockedError.aspx>
> 
> 
> ________________________________
> 
> Information transmitted by this e-mail is proprietary to MphasiS, its associated companies and/ or its customers and is intended for use only by the individual or entity to which it is addressed, and may contain information that is privileged, confidential or exempt from disclosure under applicable law. If you are not the intended recipient or it appears that this mail has been forwarded to you without proper authority, you are notified that any use or dissemination of this information in any manner is strictly prohibited. In such cases, please notify us immediately at mailmaster at mphasis.com and delete this mail from your records.
> 
> ________________________________
> 
> Information transmitted by this e-mail is proprietary to MphasiS, its associated companies and/ or its customers and is intended for use only by the individual or entity to which it is addressed, and may contain information that is privileged, confidential or exempt from disclosure under applicable law. If you are not the intended recipient or it appears that this mail has been forwarded to you without proper authority, you are notified that any use or dissemination of this information in any manner is strictly prohibited. In such cases, please notify us immediately at mailmaster at mphasis.com and delete this mail from your records.
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://mailman.stanford.edu/pipermail/protege-discussion/attachments/20111129/18d7707a/attachment.html>
> 
> ------------------------------
> 
> _______________________________________________
> protege-discussion mailing list
> protege-discussion at lists.stanford.edu
> https://mailman.stanford.edu/mailman/listinfo/protege-discussion
> 
> 
> End of protege-discussion Digest, Vol 64, Issue 36
> **************************************************
> 
> _______________________________________________
> protege-discussion mailing list
> protege-discussion at lists.stanford.edu
> https://mailman.stanford.edu/mailman/listinfo/protege-discussion
> 
> Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.stanford.edu/pipermail/protege-discussion/attachments/20111129/4cfed0dc/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PastedGraphic-1.png
Type: image/png
Size: 47669 bytes
Desc: not available
URL: <http://mailman.stanford.edu/pipermail/protege-discussion/attachments/20111129/4cfed0dc/attachment-0001.png>


More information about the protege-discussion mailing list