This file contains hidden or 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
| #!/bin/bash | |
| # Script by @tatiana (Tatiana Al-Chueyr) | |
| # Available at https://gist.github.com/tatiana/9543419 | |
| clear | |
| echo "Installing git (Version control manager)" | |
| sudo apt-get install git |
This file contains hidden or 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
| from flask import Flask | |
| app = Flask(__name__) | |
| @app.route("/") | |
| def hello(): | |
| return "Hi from Flask!" | |
| if __name__ == "__main__": |
This file contains hidden or 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
| import urlparse | |
| from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer | |
| # http://pymotw.com/2/BaseHTTPServer/ | |
| class GetHandler(BaseHTTPRequestHandler): | |
| def do_GET(self): | |
| parsed_path = urlparse.urlparse(self.path) | |
| message_parts = [ | |
| 'CLIENT VALUES:', |
This file contains hidden or 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
| DEFINE input:inference <http://tatipedia.org/property_ruleset> | |
| SELECT DISTINCT ?subject ?label count(distinct ?subject) as ?total | |
| WHERE { | |
| ?subject a <http://tatipedia.org/Place>; | |
| rdfs:label ?label . | |
| FILTER (langMatches(lang(?label), "pt")) | |
| } | |
| LIMIT 2 |
This file contains hidden or 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
| @prefix tpedia: <http://tatipedia.org/> . | |
| @prefix owl: <http://www.w3.org/2002/07/owl#> . | |
| @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . | |
| tpedia:new_york a tpedia:Place ; | |
| rdfs:label "Nova Iorque"@pt ; | |
| rdfs:label "New York"@en . | |
| tpedia:london a tpedia:Place ; | |
| rdfs:label "Londres"@pt ; |
This file contains hidden or 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
| from SPARQLWrapper import SPARQLWrapper, JSON | |
| # List all instances (eg. bands) with genre Metal | |
| query = """ | |
| PREFIX db: <http://dbpedia.org/resource/> | |
| PREFIX dbonto: <http://dbpedia.org/ontology/> | |
| SELECT DISTINCT ?who | |
| FROM <http://dbpedia.org> | |
| WHERE { |
This file contains hidden or 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
| from SPARQLWrapper import SPARQLWrapper, JSON | |
| query = """ | |
| SELECT distinct ?subject | |
| FROM <http://dbpedia.org> | |
| { | |
| ?subject rdfs:domain ?object . | |
| <http://dbpedia.org/ontology/Band> rdfs:subClassOf ?object | |
| OPTION (TRANSITIVE, t_distinct, t_step('step_no') as ?n, t_min (0) ). | |
| }""" |
This file contains hidden or 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
| from rdfalchemy import rdfSingle, rdfSubject | |
| from rdfalchemy.sparql import SPARQLGraph | |
| from rdflib import Namespace | |
| query = """ | |
| PREFIX db: <http://dbpedia.org/resource/> | |
| PREFIX dbprop: <http://dbpedia.org/property/> | |
| PREFIX dbonto: <http://dbpedia.org/ontology/> | |
| SELECT distinct ?name ?label { |
This file contains hidden or 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
| from rdfalchemy.sparql import SPARQLGraph | |
| from rdflib import Namespace | |
| query = """ | |
| PREFIX db: <http://dbpedia.org/resource/> | |
| PREFIX dbonto: <http://dbpedia.org/ontology/> | |
| SELECT DISTINCT ?who | |
| FROM <http://dbpedia.org> | |
| WHERE { |
This file contains hidden or 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
| from lettuce import * | |
| @step('I have the number (\d+)') | |
| def have_the_number(step, number): | |
| world.number = int(number) | |
| @step('I compute its factorial') | |
| def compute_its_fatorial(step): | |
| world.number = factorial(world.number) |