Help talk:Semantic search/archive

From semantic-mediawiki.org
Jump to: navigation, search


Fragment remove from text

This fragment:

This page explains these basic features of semantic queries in SMW: the query description that states which pages are to be selected, and the printout statements which state what further information should be displayed about each result.

Appeared at the end of the document... it should be somewhere near the beginning, but I can't see how to work it in. Moved here for review. --Dan Bolser 08:14, 30 March 2009 (UTC)

Max length of queries

Hello, is there any eay to increase the max length of a query? Now I need to use several nested concepts due to query strings being to long... Rotsee 15:48, 7 June 2011 (CEST)

sorry, i should rtfm, I see now that there is a setting for just that.

Semantic Search isn't working

Hi, whenever I try to search for values within a property the semantic search just returns all of the pages that have that property. It completely ignores the value I specified.

For example, to get a list of all pages that contained reports published by GAO, I type in GAO and instead of showing just the pages that were published by GAO it shows all of the pages.

Does anybody know how I can fix this problem? I would appreciate it greatly. -J.F.

I have this exact same problem! -M.R.
Can you provide a link to the search, or cut and paste the query here? Rotsee 22:26, 4 January 2012 (CET)

Complex Query with Conditional Statements

I'm trying to create a pretty complex query using a query form for a safety system I'm building. My data structure is essentially:

Page of Category=Hazard, has properties:

  • Hazard type = Note OR Caution OR Warning (three levels of hazard; cannot be null)
  • Location (hazard is present when in a particular location; can be null)
  • Hardware (hazard is involved with handling particular hardware; can be null)
  • Interface (hazard is involved with actuating a particular interface; can be null)
  • Hazard description (explanation of the hazard)

Note: Hardware and Interface are similar. An example of a hardware-related hazard may be the possibility of electrical shock when removing a radio from its housing. An example of an interface-related hazard may be the possibility of electrical shock when disconnecting a particular type of connector; that connector may be on the radio, but it also may be present elsewhere.

I've attempted to create a query form that allows me to select multiple locations, hardware, and interfaces using three comboboxes, and find all Notes, Cautions or Warnings. I believe the query I'm looking to build should look like this:

{{#ask: [[Category:Hazard]] [[Hazard type::Note]] [[Location::Worksite A]] OR [[Location::Worksite B]] OR [[Location::Worksite C]]
      OR [[Hardware::Widget A]] OR [[Hardware::Widget B]] OR [[Interface::Connector A]]
|? Hazard description
|  format = template
|  template = My template
}}

I've had trouble building such a query, so I simplified to looking for just Location for now. To accomplish this functionality I build my query with the following:

{{#ask: [[Category:Hazard]] [[Hazard type::Note]] {{#arraymap {{{Location input|}}} |,|x| [[Location::x]] | OR }}
|? Hazard description
|  format = template
|  template = My template
}}

Which should expand to the following for multiple-location queries:

{{#ask: [[Category:Hazard]] [[Hazard type::Note]] [[Location::Worksite A]] OR [[Location::Worksite B]] OR [[Location::Worksite C]] 
|? Hazard description
|  format = template
|  template = My template
}}

And expand to the following for single-location queries:

{{#ask: [[Category:Hazard]] [[Hazard type::Note]] [[Location::Worksite A]]
|? Hazard description
|  format = template
|  template = My template
}}

The problem is if I query for "Location A" I'll get 5 results, "Location B" I'll get 2 results, and "Location C" I'll get 4 results….but If I query for Location A, B and C together? I get 15 results (not the 11 expected)! Upon further investigation this is because when I query for multiple locations it stops returning only [[Hazard type::Note]]. It will also return Cautions and Warnings.

So what am I doing wrong?

Thanks

Jamesmontalvo3 02:15, 20 June 2012 (CEST)

the disjunction OR joins multiple queries, but that means that <condition 1> <condition2> OR <condition 3> means combining <condition 1> <condition2> with <condition 3>, NOT <condition 1> <condition2> with <condition 1> <condition 3>. Therefor it's clearer to split disjuncted queries over multiple lines; your query, I believe, should read
{{#ask: [[Category:Hazard]] [[Hazard type::Note]] [[Location::Worksite A]] OR
        [[Category:Hazard]] [[Hazard type::Note]] [[Location::Worksite B]] OR
        [[Category:Hazard]] [[Hazard type::Note]] [[Location::Worksite C]] 
|? Hazard description
|  format = template
|  template = My template
}}
See Help:Selecting_pages --Jan "Saruman!" S. 08:03, 20 June 2012 (CEST)
There are no threads on this page yet.