home
to by nando.quintana
/**
* Add an onchange event handler to the specified textfield object
* to validate the user's input and autocomplete it if necessary.
* The type argument is the Metaweb type, such as "/music/artist"
* for which autocompletion should be done.to by nando.quintana
<script src="json.js"></script>
<script src="metaweb.js"></script>
<script src="validateAndComplete.js"></script>
<script>
window.onload = function() {to by nando.quintana
/**
* metaweb_proxy.js:
*
* This file implements a Metaweb.read() utility function using XMLHttpRequest
* and a server-side proxy script named mqlread.phpto by nando.quintana
<?php
$q = str_replace("\\\"", "\"", $_GET["queries"]);
$url = "http://www.freebase.com/api/service/mqlread?queries=" . urlencode($q);
$request = curl_init($url);
curl_setopt($request, CURLOPT_COOKIE, "###freebase.com cookie data here###");to by nando.quintana
/**
* json.js:
* This file defines functions JSON.parse() and JSON.serialize()
* for decoding and encoding JavaScript objects and arrays from and to
* application/json format.to by nando.quintana
import sys, getopt # Command-line parsing
import metaweb # login, read, and write utilities
# A cache that maps type ids to arrays of property information
typecache = {}
# Primitive types other than /type/text and /type/key, which areto by nando.quintana
import sys, re, metaweb
# Read the content of the file specified on the command line
# It must be an HTML file with a <title>
filename = sys.argv[1]
try:to by nando.quintana
import metaweb # Our metaweb utilities
import urllib2 # For downloading images from the mint server
USERNAME = 'username' # Put your Freebase username and password here
PASSWORD = 'password'
# The ID for our US State Quarter type depends on our usernameto by nando.quintana
import urllib2 # Higher-level URL content fetching
import simplejson # JSON serialization and parsing
host = 'sandbox.freebase.com' # The Metaweb host
uploadservice = '/api/service/upload' # Path to upload service
# Upload the specified content (and give it the specified type).to by nando.quintana
import metaweb # Use the metaweb module
USERNAME = 'username' # Put your Freebase username and password here
PASSWORD = 'password'
# The ID for our US State Quarter type depends on our username
TYPEID = '/user/' + USERNAME + '/default_domain/us_state_quarter'