Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolves #111 #114

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions ontospy/core/ontospy.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def __init__(self,
uri_or_path=None,
data=None,
file_obj=None,
graph_obj=None,
rdf_format="",
verbose=False,
hide_base_schemas=True,
Expand All @@ -70,6 +71,8 @@ def __init__(self,
[description], by default None
file_obj : [type], optional
[description], by default None
graph_obj : [type], optional
[description], by default None
rdf_format : str, optional
[description], by default ""
verbose : bool, optional
Expand Down Expand Up @@ -127,8 +130,8 @@ def __init__(self,
self.pref_lang)

# finally:
if uri_or_path or data or file_obj:
self.load_rdf(uri_or_path, data, file_obj, rdf_format, verbose)
if uri_or_path or data or file_obj or graph_obj:
self.load_rdf(uri_or_path, data, file_obj, graph_obj ,rdf_format, verbose)
if build_all:
self.build_all(
verbose=verbose,
Expand Down Expand Up @@ -160,13 +163,18 @@ def load_rdf(self,
uri_or_path=None,
data=None,
file_obj=None,
graph_obj=None,
rdf_format="",
verbose=False):
"""Load an RDF source into an ontospy/rdflib graph"""
loader = RDFLoader(verbose=verbose)
loader.load(uri_or_path, data, file_obj, rdf_format)
self.rdflib_graph = loader.rdflib_graph
self.sources = loader.sources_valid
if graph_obj:
self.rdflib_graph = graph_obj
self.sources = graph_obj.identifier
else:
loader = RDFLoader(verbose=verbose)
loader.load(uri_or_path, data, file_obj, rdf_format)
self.rdflib_graph = loader.rdflib_graph
self.sources = loader.sources_valid
self.sparqlHelper = SparqlHelper(self.rdflib_graph)
self.namespaces = sorted(self.rdflib_graph.namespaces())

Expand Down