Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix up some import errors caused by move to virtualenv installation

  • Loading branch information...
commit 2510667c92a29e1c8272c3c4643bf265bae5479a 1 parent f4d760e
@emmett9001 emmett9001 authored
View
1  requirements.txt
@@ -1,5 +1,6 @@
rdflib
lepl
html5lib
+lxml
-e git+git://github.com/RDFLib/pyrdfa3.git#egg=pyrdfa3
-e git+git://github.com/RDFLib/pymicrodata.git#egg=pyMicrodata
View
3  schemato/schemato.py
@@ -2,6 +2,7 @@
import logging as log
import re
from collections import defaultdict
+import os
import rdflib
@@ -9,6 +10,8 @@
import settings
+os.sys.path.append(os.path.dirname(os.path.abspath(__file__)))
+
class Schemato(object):
def __init__(self, source, loglevel="ERROR"):
View
7 schemato/validator.py
@@ -19,12 +19,7 @@ def __init__(self, graph, doc_lines, url=""):
super(SchemaValidator, self).__init__()
self.schema_def = None
self.allowed_namespaces = []
-
- if isinstance(graph, compound_graph.CompoundGraph):
- self.graph = graph
- else:
- log.error("Validatable graph must be of type CompoundGraph")
- return
+ self.graph = graph
log.info("init validator: %s" % self.graph)
self.doc_lines = doc_lines
View
144 templates/index.html
@@ -1,144 +0,0 @@
-<! DOCTYPE HTML PUBLIC>
-<html>
-<head>
- <!-- im in ur source, testin ur fabfilez -->
- <title>Mr. Schemato</title>
- <link rel="stylesheet" href="static/bootstrap/css/bootstrap.css"/>
- <link rel="stylesheet" href="static/css/style.css"/>
-
- <script src="js/bootstrap.min.js"></script>
- <script type="text/javascript" src="http://use.typekit.com/bqi7maz.js"></script>
- <script type="text/javascript">try{Typekit.load();}catch(e){}</script>
- <script type="text/javascript" src="/static/js/jquery.min.js"></script>
- <script type="text/javascript">
- var status_string;
- var status_url;
- var url, ontology, errors, ont_name, msg;
- var didFinishValidating = true;
- var intval;
-
- function appendResults(){
- if(url != undefined)
- $("#result").append("<p><a href='" + url + "'>" + url + "</a></p>");
- $("#result").append("<p>" + msg + "</p>");
-
- if(ontology != undefined){
- for(var i = 0; i < ontology.length; i++){
- $("#result").append("<p>Detected standard: <a href='" + ontology[i] + "'>" + ont_name[i] + "</a></p>");
- }
- }
-
- if(errors != undefined){
- $.each(errors, function(key, value){
- var line, num, err;
- $.each(value, function(k, v){
- if(k == "num") num = v;
- else if(k == "line") line = v;
- else if(k == "err") err = v;
- });
- var error_div = $("<div class='error'></div>").appendTo("#result");
- error_div.append("<p><strong>Line " + num + "</strong>: <code>" + line + "</code></p>");
- error_div.append("<code>" + err.split(' - ')[0] + "</code> - <b>" + err.split(' - ')[1] + "</b>");
- });
- }
- }
-
- function storeResults(data){
- url = ontology = errors = ont_name = msg = undefined;
- didFinishValidating = true;
- $("#working").empty();
- $.each(data, function(key, value){
- if(key == "errors") errors = value;
- else if(key == "url") url = value;
- else if(key == "ontology") ontology = value;
- else if(key == "ont_name") ont_name = value;
- else if(key == "msg") msg = value;
- });
- appendResults();
- }
-
- function getStatus(){
- $.getJSON(status_url, function(response){
- if(response.status == 'WORKING'){
- $("#working").html("<p style='text-align: center;'>Validating...<br /><img src='static/img/loading.gif' /></p>");
- } else {
- clearInterval(intval);
- storeResults(response.data);
- }
- });
- }
-
- function postData(){
- $("#linkform").submit(function(e){
- e.preventDefault();
- $("#result").empty();
- if(didFinishValidating){
- $.post("/validate", $("#linkform").serialize(),
- function(data){
- status_url = data.url;
- }, "json");
- didFinishValidating = false;
- }
- });
- intval = setInterval('getStatus()', 500);
- }
- </script>
-</head>
-<body>
- <div id="mainwrap" class="container">
- <a href="https://github.com/Parsely/schemato"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub"></a>
- <div class="hero-unit">
- <h1>schema.to</h1>
- <h4>Semantic markup is cool again</h4>
- <p>Meet Mr. Schemato, the unified semantic web validator for the next generation of metadata.</p>
- </div>
- <div class="row">
- <div class="span4">
- <h3>"Semantic web?"</h3>
- <p>If you've used the internet in the last few years, chances are you've been the beneficiary of embedded semantic markup in some way. Sites and applications like <a href="http://parse.ly">Parse.ly Dash</a> rely heavily on semantic technologies to easily parse the important metadata from websites that implement them. This data describes the document it's a part of - it's "data about data".</p>
- </div>
- <div class="span4">
- <h3>What metadata looks like</h3>
- <p>Until recently, the internet was set up primarily for consumption by humans - it's easy to look at a web news article and point to, for example, the author's name. However, that's much harder for a computer. Embdedded metadata aims to make it easy for machines to parse the important information from websites using standardized labels, like <br/><code>&lt;div rel="rnews:creator"&gt;Emmett&lt;/div&gt;</code></p>
- </div>
- <div class="span4">
- <h3>Metadata protocols</h3>
- <p>As with any web standard, there is more than one. <a href="http://dev.iptc.org/rNews">rNews</a> is an RDFa-based standard that was recently developed to provide a comprehensive metadata model to online publishers, and is implemented by the New York Times. <a href="http://schema.org">Schema.org</a> defines a broad set of metadata fields for various use cases in HTML5 Microdata. <a href="http://parse.ly">Parse.ly</a> also uses a proprietary JSON metadata standard, with which publishers can ease integration with Dash.</p>
- </div>
- </div>
- <hr>
- <div class="row">
- <div class="span12">
- Mr. Schemato provides comprehensive validation of the rNews, Schema.org, Facebook openGraph, and parsely-page metadata standards. Paste a URL below to see how any site's implementation stacks up.
- </div>
- </div>
- <form id="linkform">
- <fieldset>
- <label for='link'>Link to validate:</label>
- <input type='text' name='link' id='link'
- value='http://www.nytimes.com/2012/07/19/world/middleeast/syrian-rebels-hone-bomb-skills-military-analysis.html' size="100"/>
- <input class="btn" type='submit' onclick=postData() href="#" id="submit" value="Validate &raquo;" />
- </fieldset>
- </form>
- <div id="resultwrap">
- <div id="working"></div>
- <div id="result">
- </div>
- </div>
- <hr>
- <div class="row">
- <div class="span6">
- This validator reads the latest official versions of the metadata standards it tracks (usually in the Turtle RDF format) and compares the validated document's metadata content against these standards. The standards define a number of classes, each of which is permitted to contain certain data members. This validator performs cross-checks to ensure that any data members present are valid, unduplicated, and in the right places.
- </div>
- <div class="span6">
- schema.to is written and maintained by Emmett Butler and powered by W3C's semantic web tools for Python, written by Ivan Herman - specifically <a href="https://github.com/RDFLib/Pymicrodata">pyMicrodata</a> and <a href="https://github.com/RDFLib/PyRDFa">pyRdfa</a>. If you'd like to contribute to the project, <a href="http://github.com/Parsely/schemato">fork it on github</a>.
- </div>
- </div>
- <hr>
- <footer>
- <p><a href="http://emmettbutler.com">Emmett Butler</a>, <a href="http://parse.ly">Parse.ly, Inc.</a> 2012</p>
- <div class="footer-logo-container">Powered by<a href="http://parse.ly"><img class="footer-logo" src="/static/img/footer_logo.png"/></a></div>
- </footer>
- </div>
-</body>
-</html>
Please sign in to comment.
Something went wrong with that request. Please try again.