searching for propertys
-
-
hello,
im working on an application that uses freebase. So far i've worked out how to search for a type. But is there a way to search for a property of a type??
-
Certainly there is. What are you looking for in particular?
-
for example.
lets say i have a base called Base
Base has a type called Base Type (id is base_type)
and Base Type has a property called Type Property (id is type_property)
I know how to search for Base Type, but i dont know how to search for Type Property.
So maybe i do a search and write "hello", i want to search to find all Type Property in my base that have a value "hello"
Does this make sense? How can i do that?
-
OK, first off, are you using our "search" API (/api/service/search) or our "mqlread" API (/api/service/mqlread)? It sounds like you probably want to be using mqlread, so if that's not what you're doing, it should be.
mqlread will return the results of any MQL query. MQL is our query language used to query our whole database, including metadata about the database. You can learn about MQL in our MQL Reference Guide and experiment with queries using our Query Editor.
It sounds like you're interested in queries to do with the structure of your types, properties, etc. That is, rather than asking questions like "Show me all people born in California whose profession is lawyer" you're asking for things like "Show me the names of all the properties on Person". If that's what you're doing, you might like to look at our Schema Introspection Cookbook, which gives some recipes for queries of that kind.
-
for some reason i cant see your full reply.
But anyway im using the search api
-
ok now i can see the full reply.
thank you...i'll look into that :)
-
,one more question,
with the search api, you can search part of the name. for example if i wanna seach for the music album "hello how are you", i can type hello and it will find it.
Im assuming that with mql read i wont be able to do that? i will have to write the whole album name, right?
-
The answer should be in the MQL reference Guide.
-
You can use wildcards and textual comparisons with any search. Check out sections 3.4 (Property Names in MQL Queries) and 3.6 (MQL Operators) of the MQL Reference Guide for more info.
-
thanks philg, that was a great help :)
what i've managed to do is print out the value of the properties of a certain type.
Just a question though.
Say i have a type called Type, which has two properties : prop1 and prop2.
And then i've made a topic called MyTopic.
So i did a mql read to get the values of prop1 and prop2.
But how do i get that little description that goes at the start of the topic?
I know that its "article" under type /common/topic. But if my query is getting the properties, then the type is /MyBase/MyType, meaning i cant get that description.
Will i have to do two seperate queries? or is there a way of combing the two?
Cheers
-