-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
mhausenblas
committed
Jun 11, 2011
1 parent
e7627a2
commit fc74edf
Showing
194 changed files
with
38,243 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!DOCTYPE HTML> | ||
<html> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | ||
<title> | ||
omnidator | ||
</title> | ||
</head> | ||
<body> | ||
<div style="margin: 5em; text-align: center; font-size: 30pt">Uuuups, that a 404</div> | ||
<div style="margin: 5em; text-align: center; font-size: 18pt">... sorry, seems we don't have what you're looking for ...</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
application: omnidator | ||
version: 1 | ||
runtime: python | ||
api_version: 1 | ||
|
||
handlers: | ||
- url: /examples | ||
static_dir: examples | ||
- url: /.* | ||
script: main.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Thing,Mass,URL | ||
Earth,"5.9721986x10^24 kg",http://dbpedia.org/resource/Earth | ||
Mars,"6.4191x10^23 kg",http://dbpedia.org/resource/Mars | ||
Sun,"1.988435x10^30 kg",http://dbpedia.org/resource/Sun |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
""" | ||
The handler script. | ||
@author: Michael Hausenblas, http://sw-app.org/mic.xhtml#i | ||
@since: 2011-06-11 | ||
@status: inital version | ||
""" | ||
import sys | ||
sys.path.insert(0, 'lib') | ||
import logging | ||
import cgi | ||
import os | ||
import platform | ||
import urllib | ||
import urllib2 | ||
import StringIO | ||
import csv | ||
|
||
from google.appengine.ext import webapp | ||
from google.appengine.ext.webapp import template | ||
|
||
import rdflib | ||
|
||
from rdflib import Graph | ||
from rdflib import Namespace | ||
from rdflib import plugin | ||
from rdflib.serializer import Serializer | ||
|
||
import schema_org_processor | ||
|
||
|
||
class MainHandler(webapp.RequestHandler): | ||
def get(self): | ||
self.response.out.write(template.render('index.html', None)) | ||
|
||
class NotFoundHandler(webapp.RequestHandler): | ||
def get(self): | ||
self.error(404) | ||
self.response.out.write(template.render('a404.html', None)) | ||
|
||
class SchemaOrgHandler(webapp.RequestHandler): | ||
def get(self, doc_url): | ||
logging.info('Trying to translate document at [%s]' %(urllib.unquote(doc_url))) | ||
|
||
try: | ||
sop = schema_org_processor.SchemaOrgProcessor() | ||
sop.parse(urllib.unquote(doc_url)) | ||
self.response.headers.add_header("Access-Control-Allow-Origin", "*") # CORS-enabled | ||
self.response.headers['Content-Type'] = 'application/rdf+xml' | ||
self.response.out.write(str(sop.dump_data())) | ||
except Exception, e: | ||
self.error(404) | ||
self.response.out.write(e)#template.render('a404.html', None)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!DOCTYPE HTML> | ||
<html> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | ||
<title> | ||
omnidator | ||
</title> | ||
</head> | ||
<body> | ||
<h1>API</h1> | ||
<div>http://omnidator.appspot.com/2/{URL} ... from Schema.org data (microdata, CSV, etc.) to RDF</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
""" | ||
HTML parsing library based on the WHATWG "HTML5" | ||
specification. The parser is designed to be compatible with existing | ||
HTML found in the wild and implements well-defined error recovery that | ||
is largely compatible with modern desktop web browsers. | ||
Example usage: | ||
import html5lib | ||
f = open("my_document.html") | ||
tree = html5lib.parse(f) | ||
""" | ||
__version__ = "0.95-dev" | ||
from html5parser import HTMLParser, parse, parseFragment | ||
from treebuilders import getTreeBuilder | ||
from treewalkers import getTreeWalker | ||
from serializer import serialize |
Binary file not shown.
Oops, something went wrong.