How to use the ontospy.extras.dbpedia.DBpediaEndpoint function in ontospy

To help you get started, we’ve selected a few ontospy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lambdamusic / Ontospy / ontospy / extras / dbpedia.py View on Github external
def __init__(self, prefixes={}, verbose=True):
        endpoint = "http://dbpedia.org/sparql"

        prefixes = {
            "dbpedia-owl": "http://dbpedia.org/ontology/",
            "dbpedia2": "http://dbpedia.org/property/",
            "dbpedia": "http://dbpedia.org/",
            "yago" : "http://dbpedia.org/class/yago/" ,
        }

        super(DBpediaEndpoint, self).__init__(endpoint, prefixes, verbose=True)
github lambdamusic / Ontospy / ontospy / extras / dbpedia.py View on Github external
def main():
    # get parameters
    opts, args = parse_options()
    query, format, describe, alltriples, ontology = opts.query, opts.format, opts.describe, opts.alltriples, opts.ontology

    sTime = time.time()

    s = DBpediaEndpoint()

    url = s.endpoint

    if query:
        print("Contacting %s ... \nQuery: \"%s\"; Format: %s\n" % (url, query, format))
        results = s.query(query, format)
    elif describe:
        print("Contacting %s ... \nQuery: DESCRIBE %s; Format: %s\n" % (url, describe, format))
        results = s.describe(describe, format)
    elif alltriples:
        print("Contacting %s ... \nQuery: ALL TRIPLES FOR %s; Format: %s\n" % (url, alltriples, format))
        results = s.allTriplesForURI(alltriples, format)
    elif ontology:
        print("Contacting %s ... \nQuery: ONTOLOGY; Format: %s\n" % (url, format))
        results = s.ontology(format)