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
import requests | |
import time | |
import pdb | |
import json | |
import sys | |
import urllib | |
FILE_NAME = "ontology_ids_and_parents.txt" | |
APIKEY = 'YOUR KEY' |
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
<?xml version="1.0"?> | |
<!DOCTYPE rdf:RDF [ | |
<!ENTITY dcam "http://purl.org/dc/dcam/" > | |
<!ENTITY dcterms "http://purl.org/dc/terms/" > | |
<!ENTITY dcmitype "http://purl.org/dc/dcmitype/" > | |
<!ENTITY dwc "http://rs.tdwg.org/dwc/terms/" > | |
<!ENTITY dwctype "http://rs.tdwg.org/dwc/dwctype/" > | |
<!ENTITY owl "http://www.w3.org/2002/07/owl#" > | |
<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" > |
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
import sys | |
import urllib,urllib2 | |
import traceback | |
import pdb | |
import time | |
import json | |
import os | |
def query(q,epr,f='text/plain'): | |
params = {'query': q} |
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
import timeit | |
DATA = 'abcdef' | |
def bytearr(): | |
bytesn = 1024 * 1024 * 5 | |
s = bytearray(bytesn) | |
i = 0 | |
while i < bytesn: | |
s[i] = DATA[i%len(DATA)] |
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
require 'pry' | |
module Test | |
module Settings | |
def self.included(base) | |
base.extend(ClassMethods) | |
end | |
module ClassMethods | |
attr_accessor :settings |
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
public ResultSet executeQuery(String queryString) throws Exception { | |
Query query = QueryFactory.create(queryString) ; | |
QueryEngineHTTP qexec = QueryExecutionFactory.createServiceRequest(this.service, query) | |
qexec.addParam("apikey", this.apikey) | |
ResultSet results = qexec.execSelect() ; | |
return results; | |
} |
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
import json,urllib2,urllib,traceback, sys | |
def query(q,apikey,epr,f='application/json'): | |
try: | |
params = {'query': q, 'apikey': apikey} | |
params = urllib.urlencode(params) | |
opener = urllib2.build_opener(urllib2.HTTPHandler) | |
request = urllib2.Request(epr+'?'+params) | |
request.add_header('Accept', f) | |
request.get_method = lambda: 'GET' |
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
package test; | |
import java.io.PrintStream; | |
public class TestOutput { | |
public static void outputFiltered(String label, PrintStream out) { | |
for (byte b : label.getBytes()) { | |
if (Character.isLetterOrDigit((char)b)) { | |
out.print((char)b); |
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
import json | |
import urllib2 | |
import urllib | |
import traceback | |
import sys | |
def query(q,apikey,epr,f='application/json'): | |
"""Function that uses urllib/urllib2 to issue a SPARQL query. | |
By default it requests json as data format for the SPARQL resultset""" |
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
#Ontology here http://protege.stanford.edu/ontologies/mappings/mappings.rdfs | |
<http://purl.bioontology.org/mapping/21d7a8e0-004d-012e-74a1-005056bd0010> | |
<http://protege.stanford.edu/ontologies/mappings/mappings.rdfs#created_in_source_ontology_version> 40400 ; | |
<http://protege.stanford.edu/ontologies/mappings/mappings.rdfs#created_in_target_ontology_version> 42693 ; | |
<http://protege.stanford.edu/ontologies/mappings/mappings.rdfs#date> "2010-05-17T23:24:34Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> ; | |
<http://protege.stanford.edu/ontologies/mappings/mappings.rdfs#mapping_source> "Application" ; | |
<http://protege.stanford.edu/ontologies/mappings/mappings.rdfs#mapping_source_algorithm> "Mappings were generated by the LOOM algorithm automatically based on close lexical match between preferred names of terms or a preferred name and a synonym." ; | |
<http://protege.stanford.edu/ontologies/mappings/mappings.rdfs#mapping_source_contact_info> "[email protected]" ; | |
<http://protege.stanford. |
NewerOlder