בדף הזה מופיעה רשימה של מתכונים לדרכים שונות להגבלת שאילתות חיפוש באמצעות שירות החיפוש.
הגבלות טקסטואליות
נתונים טקסטואליים של ישות ב-Freebase מגיעים קודם מהשם ומהכינויים שלה, אחר כך מהמפתחות וממאפיינים טקסטואליים אחרים, ולבסוף מנתוני העוגן שלה בוויקיפדיה אם היא הותאמה לנושא בוויקיפדיה בשפה ספציפית.
מגבלות טקסטואליות הן ספציפיות לשפה. נכון לעכשיו, יש תמיכה ב-18 שפות. הכיסוי של השפה האנגלית הוא הכי רחב, והיא שפת ברירת המחדל.
רשימה של כל קודי השפות שנתמכים כרגע זמינה בכתובת:
https://www.googleapis.com/freebase/v1/search?help=langs&indent=true
אילוץ טקסטואלי מצוין באמצעות הפרמטר query
. השפה שלו מצוינת באמצעות הפרמטר lang
. לדוגמה:
query: "gore" query: "gore" lang: "fr" query: "gore" lang: "de"
במהלך יצירת האינדקס, הנתונים הטקסטואליים עוברים נורמליזציה באופן ספציפי לשפה. לדוגמה, באנגלית, הטקסט מומר לאותיות קטנות וההטעמות מוסרות. בזמן השאילתה, מתבצעת נורמליזציה ספציפית לשפה על טקסט השאילתה. לדוגמה:
query: "beyoncé" query: "beyonce"
יש כמה פרמטרים שקובעים איך מתבצעת התאמה של אילוץ טקסטואלי. הגדרת הפרמטר prefixed
לערך true
מפעילה התאמה של תחילית רק בשם ובכינויים (והתאמה רגילה בנתוני טקסט אחרים). לדוגמה:
query: "bob dy" prefixed: true
הגדרת stemmed
ל-true
מפעילה התאמה למילים עם אותה מילה בסיסית רק בשם ובכינויים (והתאמה רגילה לנתוני טקסט אחרים). אפשר להשתמש בהתאמות עם גזרי מילים כדי להדביק מעל הבדלים בסיומות שספציפיות לשפה, שנובעים מריבוי או מצורות דקדוקיות אחרות. לדוגמה:
query: "potatos" stemmed: true
אם מקיפים את טקסט השאילתה במירכאות כפולות (""), מופעלת התאמה לביטוי. רכיבי הטקסט בשאילתה צריכים להופיע זה לצד זה בנתוני הטקסט של הישות התואמת. לדוגמה:
query: "\"to be or not to be\""
משתמשים בפרמטרים name
, alias
ו-type
כדי להתאים לאנשים וליישות מסוג person שהשם שלהם מכיל את המילה שרוצים להתאים. לדוגמה:
filter: "(all name:gore alias:gore type:/people/person)"
באופן דומה, הדוגמה הבאה תואמת רק לישויות /people/person
עם alias
תואם, ולא ל-name
שלהן:
filter: "(all (not name:gore) alias:gore type:/people/person)"
בנוסף לציון שדות הטקסט שצריך להתאים, אפשר גם לציין איך ההתאמה צריכה להתבצע. לשם כך, צריך להוסיף אחד מהמגבילים הבאים בין האופרנד לבין שדה הטקסט:
-
{word}
: המילים במחרוזת צריכות להיות זהות למילים בשדה הטקסט המתאים במסמך. (ברירת מחדל) -
{phrase}
: המילים צריכות להופיע זו לצד זו באותו הסדר בשדה הטקסט המתאים במסמך. -
{full}
: כמו{phrase}
אבל גם דורש שהביטוי יתאים באופן מלא לשדה הטקסט, ולא רק בתוך שדה הטקסט. במילים אחרות, התאמה מלאה.
לדוגמה, כדי למצוא את הסינגל המוזיקלי Home של מארק ברוסארד, משתמשים במסנן כמו זה:
filter: "(all type:/music/single name{full}:home /music/track/artist:"Marc Broussard")"
מגבלות שפה
כמו שמתואר במגבלות הטקסטואליות, הפרמטר lang
משמש לציון כללי הנורמליזציה של השפה שבהם יש להשתמש כדי להפוך טקסט לטוקנים של שאילתות. השפה של השאילתה משפיעה גם על דירוג התוצאות, כי חיפוש Freebase מקבל אות רלוונטיות ספציפי לשפה מתוך ויקיפדיה בשפה המתאימה.
בשלב הזה, יש תמיכה ב-9 שפות: אנגלית (en), ספרדית (es), צרפתית (fr), גרמנית (de), איטלקית (it), פורטוגזית (pt), סינית (zh), יפנית (ja) וקוריאנית (ko). הכיסוי של השפה האנגלית הוא הכי רחב, והיא שפת ברירת המחדל.
חיפוש בכמה שפות בו-זמנית
הפרמטר lang
מקבל רשימה של קודי שפות מופרדים בפסיקים, שגורמים לחיפוש להתבצע בכל השפות שצוינו, ולתוצאות להיות מדורגות בשפה הראשונה שמופיעה ברשימה ומוצגות בשפה הראשונה ברשימה שיש לה שם לישות.
לדוגמה:
החיפוש הבא מחפש את המילה הגרמנית Sonnenblume בגרמנית ובצרפתית. היא מדרגת את התוצאות ומציגה אותן בצרפתית:
query: "Sonnenblume" lang: "fr,de"
החיפושים הבאים באנגלית הם של סרטים שהשפה שלהם היא קוריאנית, והשם שלהם מוצג בקוריאנית. החלק באנגלית בשאילתה הוא המילה korean באילוץ expressed_by
:
filter: "(all expressed_by:korean type:/film/film)" lang: "ko,en"
מגבלות על סכימה
אילוצי הסכימה מצוינים באמצעות הפרמטרים type
ו-domain
. type
תואם לערכי המאפיין /type/object/type
של ישות.
לדוגמה, ההגדרה הבאה מגבילה את החיפוש לאנשים בלבד:
query: "gore" type: "/people/person"
הפונקציה domain
מתאימה לערכים /type/type/domain
של כל הערכים /type/object/type
של ישות.
לדוגמה, ההגבלה הבאה מאפשרת לחפש רק ישויות בצרפתית בדומיין /film
:
query: "babar" domain: "/film" lang: "fr"
אפשר גם להשתמש במאפיינים ספציפיים של Freebase כדי לסנן שאילתה. לדוגמה, הפקודה הבאה מגבילה את החיפוש לאנשים מקנדה:
query "john" filter: "(all type:/people/person /people/person/nationality:"Canada")"
מגבלות של מטא-סכמה
מסנן מגבלות של מטא-סכמה מסנן ישויות לפי פרדיקטים סמנטיים. הפרדיקטים האלה הם מושגים ברמה גבוהה יותר, שמבוססים על אוספים של מאפייני Freebase שמתארים קשרים סמנטיים דומים.
אילוצים של מטא-סכימה מצוינים באמצעות אופרנדים של הפרמטר filter
בשילוב עם שם ישות או אילוץ MID.
אופרנדים נתמכים של מסננים במטא-סכמה
חיפוש Freebase תומך באופרנדים הבאים של מסנני Metaschema. כדי לנסות כל דוגמה, לוחצים על הקישור בטבלה או משתמשים באפליקציית הדוגמה של חיפוש Freebase.
שם האופרנד | דוגמה או דוגמאות |
---|---|
abstraction |
"fettuccine dishes" (אפשר לנסות.)
filter: "(all abstraction:fettuccine)" |
abstraction_of |
"class of the Western Bulwark locomotive" (אפשר לנסות.)
filter: "(all abstraction_of:"Western Bulwark")" |
adaptation |
"Works La Traviata is an adaptation of" (אפשר לנסות.)
filter: "(all adaptation_of:"La Traviata")" |
administered_by |
"Cannes awards" (אפשר לנסות.)
filter: "(all type:awards administered_by:cannes)" |
administers |
"מי מנהל את העיתון Synapse?" (רוצים לנסות?)
filter: "(all administers:synapse)" |
appears_in |
"characters in the Magic Flute" (Try it.)
filter: "(all appears_in:"magic flute")" filter: "(all appears_in:"Die Zauberflöte")" lang: "de" |
broader_than |
"line of aircraft that the Airbus 319 belongs to" (Try it.)
filter: "(all broader_than:"Airbus A319")" |
category |
"french actresses" (אפשר לנסות.)
filter: "(all category:female origin:france notable:actor)" filter: "(all category:female origin:france practitioner_of:actor)" filter: "(all category:volcano (any part_of:california part_of:france))" "pasta dishes" (אפשר לנסות.) filter: "(all category:pasta)" |
center |
"airlines with a hub in San Francisco" (Try it.)
filter: "(all type:airline center:"San Francisco")" filter: "(all type:airline center:"San Francisco" center:atlanta)" filter: "(all type:/book/newspaper center:/m/0d6lp)" |
center_for |
"sports facilities for the San Francisco 49ers" (כדאי לנסות)
filter: "(all center_for:"san francisco 49ers")" |
certification |
"R-rated movies by Wim Wenders" (Try it.)
filter: "(all type:/film/film contributor:wenders certification:r)" |
character |
"works which have Papageno as character" (אפשר לנסות.)
filter: "(all character:papageno)" |
child |
"ההורים של ביל קלינטון" (אפשר לנסות.)
filter: "(all child:"bill clinton")" |
contributed_to |
"Who contributed to Blade Runner?" (רוצים לנסות?)
filter: "(all contributed_to:"Blade Runner")" |
contributor |
"movies by Steven Spielberg" (Try it.)
filter: "(all type:/film/film contributor:"Steven Spielberg")" filter: "(all type:/film/film contributor:/m/06pj8)" filter: "(all type:/film/film contributor:"Harrison Ford")" |
created |
"who created 'for whom the bell tolls'" (Try it.)
filter: "(all created:"for whom the bell tolls")" |
created_by |
"תוכנה של Google" (אפשר לנסות)
filter: "(all notable:software created_by:google)" |
discovered |
"discoverers of radium" (אפשר לנסות.)
filter: "(all discovered:radium)" |
discovered_by |
"discoveries by Curie" (אפשר לנסות.)
filter: "(all discovered_by:curie)" |
distributed_by |
"NPR shows" (כדאי לנסות)
filter: "(all type:show distributed_by:npr)" |
exhibited |
"where was 'down by law' presented ?" (כדאי לנסות.)
filter: "(all exhibited:"down by law")" |
exhibited_at |
"nominated works shown at the 2010 Cannes Film Festival" (כדאי לנסות.)
filter: "(all type:"nominated work" exhibited_at:"2010 Cannes Film festival")" |
expressed_by |
"books in esperanto" (אפשר לנסות.)
filter: "(all type:book expressed_by:esperanto)" |
fictional_link |
"דמויות בדיוניות שקשורות למיקי מאוס" (אפשר לנסות.)
filter: "(all type:/fictional_universe/fictional_character fiction_link:"mickey mouse")" |
genre |
"gothic cathedrals" (אפשר לנסות.)
filter: "(all category:cathedral genre:gothic)" filter: "(all category:cathedral genre:gothic created_by:viollet)" |
identifies |
"What identifies Southwest Airlines?" (רוצים לנסות?)
filter: "(all identifies:"Southwest Airlines")" |
leader |
"Mitch Kapor companies" (כדאי לנסות.)
filter: "(all type:company leader:kapor)" |
leader_of |
"Paris mayors" (אפשר לנסות.)
filter: "(all title:mayor leader_of:paris)" |
made_of |
"wax paintings" (אפשר לנסות.)
filter: "(all type:painting made_of:wax)" |
means_of_demise |
"executed politicians" (אפשר לנסות.)
filter: "(all type:politician means_of_demise:"capital punishment")" |
member_of |
"african monarchs" (אפשר לנסות.)
filter: "(all type:monarch member_of:africa)" filter: "(all type:politician member_of:democratic notable:actor)" |
narrower_than |
"examples of v8 engines" (אפשר לנסות.)
filter: "(all type:engine narrower_than:"v8 engine")" |
occurs_in |
"languages spoken in Romania" (כדאי לנסות.)
filter: "(all type:language occurs_in:romania)" |
origin |
"Republican governors from Austria" (אפשר לנסות.)
filter: "(all title:governor member_of:republican origin:austria)" |
owner |
"makes owned by Ford" (אפשר לנסות.)
filter: "(all type:make owner:ford)" |
owns |
"Who owns the Mavericks?" (רוצים לנסות?)
filter: "(all owns:mavericks)" |
parent |
"Al Gore's children" (אפשר לנסות.)
filter: "(all parent:"al gore")" filter: "(all type:/computer/programming_language parent:lisp)" |
part_of |
"swedish lakes" (אפשר לנסות.)
filter: "(all type:lake part_of:sweden)" filter: "(all type:competition part_of:"2008 summer olympics")" |
participant |
"Bowie concerts" (אפשר לנסות.)
filter: "(all participant:bowie type:concert)" |
participated_in |
"Notable austrian skiers who participated in Olympics" (כדאי לנסות.)
filter: "(all notable:skier member_of:austria participated_in:olympics)"' |
peer_of |
"politicians peers of Al Gore" (אפשר לנסות.)
filter: "(all notable:politician peer_of:gore)" |
permits_use_of |
"Diesel engines" (אפשר לנסות.)
filter: "(all permits_use_of:diesel)" |
portrayed |
"actors who portrayed John Lennon" (אפשר לנסות.)
filter: "(all notable:actor portrayed:"john lennon")" |
portrayed_by |
"characters portrayed by Harrison Ford" (כדאי לנסות.)
filter: "(all portrayed_by:"Harrison Ford")" |
practitioner_of |
"female african american lawyers" (אפשר לנסות.)
filter: "(all category:female category:"african american" practitioner_of:lawyer)" |
preceeding |
"sequels to The Lord of the Rings, the two Towers" (כדאי לנסות)
filter: "(all type:/film/film preceeding:"The Lord of the Rings, the two Towers")" |
produced_by |
"Apple computers" (אפשר לנסות)
filter: "(all type:computers produced_by:apple)" |
publication |
"which book has /m/0clw238 as first edition ?" (כדאי לנסות)
filter: "(all publication:/m/0clw238)" |
publication_of |
"releases of La Traviata" (Try it.)
filter: "(all publication_of:"La Traviata")" |
service_area |
"California broadcasters" (אפשר לנסות.)
filter: "(all type:broadcaster service_area:california)" |
status |
"retreating swiss glaciers" (כדאי לנסות.)
filter: "(all type:glacier status:retreating part_of:switzerland)" |
subclass_of |
"סוגים של בגדי ים" (אפשר לנסות.)
filter: "(all subclass_of:swimwear)" |
subject |
"סרטים על השואה" (אפשר לנסות.)
filter: "(all type:film subject:holocaust)" filter: "(all type:book subject:mathematics)" |
subsequent |
"prequels to The Lord of the Rings, the two Towers" (כדאי לנסות.)
filter: "(all type:/film/film subsequent:"The Lord of the Rings, the two Towers")" |
succeeded_by |
"Which automotive platform was succeeded by the Ford B3 platform ?" (Try it.)
filter: "(all succeeded_by:"ford b3 platform")" |
succeeds |
"מי ירש את בית סטיוארט?" (אפשר לנסות)
filter: "(all succeeds:stuart)" |
superclass_of |
"Classes coronary heart disease belongs to" (Try it.)
filter: "(all superclass_of:"coronary heart disease")" |
title |
"מהנדסי Google" (כדאי לנסות)
filter: "(all title:engineer member_of:google)" |
tookplace_at |
"battles that took place at Marengo" (אפשר לנסות.)
filter: "(all type:battles tookplace_at:marengo)" |
use_permitted_by |
"פורמטים של קבצים שנתמכים באייפון" (אפשר לנסות.)
filter: "(all type:"file format" use_permitted_by:iphone)" |
ציון ודירוג
ליישויות ב-Freebase יש ציון רלוונטיות (דירוג) מובנה שמחושב במהלך הוספה לאינדקס, והוא פונקציה של מספר הקישורים הנכנסים והיוצאים שלה ב-Freebase וב-Wikipedia. לחלק מהישויות הפופולריות ב-Freebase יש גם ציון פופולריות שמחושב על ידי Google. כברירת מחדל, שני הניקודים משולבים במהלך השאילתות.
אם יש אילוץ טקסטואלי, מחושב ציון התאמה טקסטואלית ממספר התוצאות שמוחזרות על ידי אינדקס החיפוש, והוא משולב עם ציון הרלוונטיות.
תוצאות החיפוש ב-Freebase תמיד ממוינות לפי הניקוד הסופי, מהניקוד הגבוה ביותר לנמוך ביותר.
פרמטר הניקוד מאפשר לקבוע אילו רכיבים של ניקוד הרלוונטיות ישמשו לחישוב הניקוד הסופי:
freebase: שימוש רק בציון הרלוונטיות של Freebase.
query: "beyoncé" scoring: freebase
entity: המערכת משתמשת בשני ציוני הרלוונטיות, ומחליפה כל ציון חסר של Google בציון 1.0. זוהי ברירת המחדל.
query: "beyoncé" scoring: entity
סכימה: משתמשים בה כשמחפשים ישויות של סכימה כמו סוגים, מאפיינים או דומיינים. חישוב מספר הקישורים של ישויות סכימה מתבצע באופן שונה.
query: "performance" scoring: schema
הגבלות אחרות
אפשר לסנן ישויות לפי תג אינדקס באמצעות הפרמטרים with או without. התיוג של הישויות מתבצע במהלך ההוספה לאינדקס, וכל תג מתאים לשאילתה אחת או לכמה שאילתות של Freebase שיהיה יקר מדי להריץ במהלך החיפוש:
commons
הוא תג שאפשר להשתמש בו כדי להגביל את החיפוש בסכימה כך שיוחזרו רק סכימות של Freebase Commons.
לדוגמה, סוגי Freebase Commons שתואמים למילה color
query: "color" type: "/type/type" with: "commons"
gg
היא תג שאפשר להשתמש בו כדי להגביל חיפוש לישויות שיש להן או שאין להן ציון פופולריות ב-Google.
query: "1923" type: "/people/person" with: "gg" query: "1923" type: "/people/person" without: "gg"
הפרמטר without
שווה ערך ל-a negated with בביטוי מסנן.
query: "color" limit: 5 type: "/type/type" without: "commons" query: "color" limit: 5 type: "/type/type" filter: "(not with:commons)"