Exemple #1
0
def list_files(url: str, repo_name: str) -> List[str]:
    rest_url = f"{url}/rest/data/import/server/{repo_name}"
    response = handle_response(requests.get(rest_url), writeResult=False)
    files = []
    for entry in json.loads(response.text):
        files.append(entry["name"])
    return files
Exemple #2
0
def load_data(url: str, repo_name: str,
              turtle_file: Union[str, BinaryIO]) -> requests.Response:
    """
    Upload a single turtle file
    """
    headers = {"Content-Type": "text/turtle"}
    rest_url = f"{url}/repositories/{repo_name}/rdf-graphs/service?default"
    data = openIfNotOpenBinary(turtle_file)
    return handle_response(requests.post(rest_url, headers=headers, data=data))
Exemple #3
0
def rm_repo_cmd(repo_name: str, url: str) -> NoReturn:
    """
    Delete a repository in the GraphDB database
    """
    handle_response(cmd.rm_repo(repo_name=repo_name, url=url))
    sys.exit(0)
Exemple #4
0
def ls_repo_cmd(url: str) -> NoReturn:
    """
    List all repositories in the GraphDB database
    """
    handle_response(cmd.ls_repo(url=url))
    sys.exit(0)
Exemple #5
0
def make_cmd(config_file: str, url: str) -> NoReturn:
    """
    Create a new data repository within a graphdb database
    """
    handle_response(cmd.make_repo(config=config_file, url=url))
    sys.exit(0)
Exemple #6
0
def start_cmd(path: Optional[str]) -> NoReturn:
    """
    Start a GraphDB daemon in server mode
    """
    handle_response(cmd.start_graphdb(path=path))
    sys.exit(0)