Ejemplo n.º 1
0
 def __init__(self, language):
     # initialize sparql querier
     # get mapping from two-letter country code to dbpedia endpoint URL
     dbpedia_url = dbpedia_mapping.language_to_dbpedia_url(language)
     self.sparql = SPARQLWrapper(dbpedia_url)
     self.sparql.setTimeout(1000)
     self.sparql.setReturnFormat(JSON)
 def __init__(self,language):
     # initialize sparql querier
     # get mapping from two-letter country code to dbpedia endpoint URL
     dbpedia_url = dbpedia_mapping.language_to_dbpedia_url(language) 
     self.sparql = SPARQLWrapper(dbpedia_url)
     self.sparql.setTimeout(1000)
     self.sparql.setReturnFormat(JSON)
Ejemplo n.º 3
0
    dest="threshold",
    default=0.1,
    type=float,
    help="absolute threshold for majority voting on coordinates (default: 0.1)"
)

args = parser.parse_args()

outputfile_path = args.output
sparql_language = args.language
absolute_threshold = args.threshold

print "running sparql_location_extraction"

# get mapping from two-letter country code to dbpedia endpoint URL
dbpedia_url = dbpedia_mapping.language_to_dbpedia_url(sparql_language)

print "Running on the following dbpedia SPARQL endpoint: " + dbpedia_url

sparql = SPARQLWrapper(dbpedia_url)
# sparql = SPARQLWrapper("https://query.wikidata.org/sparql")
# sparql = SPARQLWrapper("https://query.wikidata.org/bigdata/namespace/wdq/sparql")

sparql.setTimeout(1000)

# SPARQL query that
namespaces = """
PREFIX dbo: <http://dbpedia.org/resource/classes#>
PREFIX dbp: <http://dbpedia.org/property/>
"""
Ejemplo n.º 4
0
parser = argparse.ArgumentParser(description='Extracts Websites with locations from dbpedia.')
parser.add_argument('output',
                   help='a file path to the output file generated by this program')
parser.add_argument("--language", dest="language", type=str, help="one of the language editions of dbpedia (default: en)", required=True)
parser.add_argument("--threshold", dest="threshold", default=0.1, type=float, help="absolute threshold for majority voting on coordinates (default: 0.1)" )

args = parser.parse_args()

outputfile_path=args.output
sparql_language=args.language
absolute_threshold=args.threshold

print "running sparql_location_extraction" 

# get mapping from two-letter country code to dbpedia endpoint URL
dbpedia_url = dbpedia_mapping.language_to_dbpedia_url(sparql_language) 

print "Running on the following dbpedia SPARQL endpoint: " + dbpedia_url

sparql = SPARQLWrapper(dbpedia_url)
# sparql = SPARQLWrapper("https://query.wikidata.org/sparql")
# sparql = SPARQLWrapper("https://query.wikidata.org/bigdata/namespace/wdq/sparql")

sparql.setTimeout(1000)


# SPARQL query that 
namespaces = """
PREFIX dbo: <http://dbpedia.org/resource/classes#>
PREFIX dbp: <http://dbpedia.org/property/>
"""