[Developers] Multiple Wildcards in MQL Query

Alexander Marks al at metaweb.com
Sat Jan 3 23:35:22 UTC 2009


The "one of" operator only works with exact constraints on "id", and the pattern matching operator doesn't support the sort of operation you need here. Right now, the only way to get the result you want is to run one query per numeral and combine them locally.

Al

----- Original Message -----
From: "James Taylor" <jame0taylor at gmail.com>
To: "For discussions about MQL, Freebase API and apps built on Freebase" <developers at freebase.com>
Sent: Saturday, January 3, 2009 3:13:02 PM GMT -08:00 US/Canada Pacific
Subject: Re: [Developers] Multiple Wildcards in MQL Query


Concatenating results is not idea. Is there a way to solve this in a single query by combining the 'pattern matching' operator and the 'one of' operator? 

Something like (which doesn't work): 
[ 
{ 
"name" : null, 
"name|=" : [ 
"^0*", 
"^1*", 
"^2*" 
], 
"type" : "/base/bioventurist/science_or_technology_company" 
} 
] 

-JT 


On Sat, Jan 3, 2009 at 2:37 PM, Kurt Bollacker < kurt at metaweb.com > wrote: 



Your query is simply the logical intersection of the name constraints, 
rather than the union ("OR") that you wanted. You could write each of 
your 10 queries like: 

[ 
{ 
"a:name~=" : "^0*", 

"name" : null, 
"type" : "/base/bioventurist/science_or_technology_company" 
} 
] 

and concatenate the results. Currently, MQL pattern matching does not 
have a "full set" of regular expressions. 


Kurt :-) 






On Sat, Jan 03, 2009 at 02:06:43PM -0800, Rob Warren wrote: 
> Hi, 
> 
> I was wondering if anybody has any experience using multiple wildcards 
> within a single MQL query? 
> 
> I am trying to write a single query that returns all names that begin with a 
> number for a given type (e.g. for "type" : 
> "/base/bioventurist/science_or_technology_company", I want freebase to 
> return 3M, 454 Life Sciences, 23andme etc.). 
> 
> I have tried using property prefixes such as in the example below and not 
> had any luck. 
> 
> [ 
> { 
> "a:name~=" : "^0*", 
> "b:name~=" : "^1*", 
> "c:name~=" : "^2*", 
> "d:name~=" : "^3*", 
> "e:name~=" : "^4*", 
> "f:name~=" : "^5*", 
> "g:name~=" : "^6*", 
> "h:name~=" : "^7*", 
> "i:name~=" : "^8*", 
> "j:name~=" : "^9*", 
> "name" : null, 
> "type" : "/base/bioventurist/science_or_technology_company" 
> } 
> ] 
> 
> I am unsure as to how to combine wildcards and either numeric comparisons 
> "one of" operators and am not sure if this is even an effective solution. 
> 
> Any suggestions or help would be much appreciated. 

> _______________________________________________ 
> Developers mailing list 
> Developers at freebase.com 
> http://lists.freebase.com/mailman/listinfo/developers 

_______________________________________________ 
Developers mailing list 
Developers at freebase.com 
http://lists.freebase.com/mailman/listinfo/developers 


_______________________________________________
Developers mailing list
Developers at freebase.com
http://lists.freebase.com/mailman/listinfo/developers


More information about the Developers mailing list