pyLDAPI Client Documentation¶
Welcome to pyLDAPI Client¶
The Python client library for the Python Linked Data API (pyLDAPI) is:
A Simple helper library for consuming registers, indexes, and instances of classes exposed via a pyLDAPI endpoint.
See the pyLDAPI module for more information.
PyPI Badge - coming soon
Example usage¶
from pyldapi_client import LDAPIClient
async def async_test_script(loop):
remapper = {
"http://test.linked.data.gov.au/dataset/asgs/": "http://13.236.122.60/asgs/sa4/"
}
base = "http://test.linked.data.gov.au/dataset/asgs/reg"
client = await LDAPIClient(base, url_remapper=remapper, asynchronous=True, loop=loop)
register = client.register("http://test.linked.data.gov.au/dataset/asgs/sa4/")
first_page = await register.index_page(per_page=50)
a = await register.index()
instances = await register.instances(index=a, min_count=20)
_ = await client.close()
print(len(a))
print(len(instances))
return
def threaded_test_script():
remapper = {
"http://test.linked.data.gov.au/dataset/asgs/": "http://13.236.122.60/asgs/sa4/"
}
base = "http://test.linked.data.gov.au/dataset/asgs/reg"
client = LDAPIClient(base, url_remapper=remapper, asynchronous=False, threads=8)
register = client.register("http://test.linked.data.gov.au/dataset/asgs/sa4/")
first_page = register.index_page(per_page=50)
a = register.index()
instances = register.instances(index=a, min_count=20)
client.close()
print(len(a))
print(len(instances))
return
def sync_test_script():
remapper = {
"http://test.linked.data.gov.au/dataset/asgs/": "http://13.236.122.60/asgs/sa4/"
}
base = "http://test.linked.data.gov.au/dataset/asgs/reg"
client = LDAPIClient(base, url_remapper=remapper, asynchronous=False, threads=1)
register = client.register("http://test.linked.data.gov.au/dataset/asgs/sa4/")
first_page = register.index_page(per_page=50)
a = register.index()
instances = register.instances(index=a, min_count=20)
client.close()
print(len(a))
print(len(instances))
return
if __name__ == "__main__":
import asyncio
# For debugging/testing
threaded_test_script()
sync_test_script()
loop = asyncio.get_event_loop()
_a = async_test_script(loop)
loop.run_until_complete(_a)
Documentation¶
Read the documentation at http://pyldapi-client.readthedocs.io/.
Implementations of pyLDAPI Client¶
- LOC-I Index File Exporter
Licence¶
This module is licensed under Apache Software License v2.0. See the LICENSE deed for details.
Contact¶
Nicholas Car (lead)¶
Senior Experimental Scientist
Ashley Sommer (senior developer)¶
Utility functions¶
Utility functions shared between the py27 and py35 versions of pyLDAPI Client. In theory, all of these functions should be compatible with all versions of python.
-
pyldapi_client.functions.
extract_page_from_string
(page_string)[source]¶ TODO: Ashley
Parameters: page_string – Returns: Return type:
LDAPIClient¶
This is the documentation for python3+ however, the API should be the same for the python2.7 version as well.