{"id":24761672,"url":"https://github.com/driebit/zotonic_mod_adlib","last_synced_at":"2025-07-27T08:04:24.415Z","repository":{"id":41968645,"uuid":"414206404","full_name":"driebit/zotonic_mod_adlib","owner":"driebit","description":null,"archived":false,"fork":false,"pushed_at":"2024-09-18T16:01:29.000Z","size":43,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-31T07:05:22.018Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Erlang","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/driebit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-10-06T12:38:56.000Z","updated_at":"2024-09-18T16:01:30.000Z","dependencies_parsed_at":"2025-05-30T22:21:04.747Z","dependency_job_id":"44e67746-e646-4d11-8b80-ed9d914ed7ec","html_url":"https://github.com/driebit/zotonic_mod_adlib","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/driebit/zotonic_mod_adlib","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/driebit%2Fzotonic_mod_adlib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/driebit%2Fzotonic_mod_adlib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/driebit%2Fzotonic_mod_adlib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/driebit%2Fzotonic_mod_adlib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/driebit","download_url":"https://codeload.github.com/driebit/zotonic_mod_adlib/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/driebit%2Fzotonic_mod_adlib/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267327534,"owners_count":24069442,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-27T02:00:11.917Z","response_time":82,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-28T19:18:40.534Z","updated_at":"2025-07-27T08:04:24.400Z","avatar_url":"https://github.com/driebit.png","language":"Erlang","funding_links":[],"categories":[],"sub_categories":[],"readme":"Adlib support for Zotonic\n=========================\n\n[Adlib](http://www.adlibsoft.nl) is a collection organization and management tool for museums and libraries.\n\nThis [Zotonic](http://www.zotonic.com) module adds support routines for accessing and importing these collections into a Zotonic system.\n\n\n## API functions\n\nThe remote Adlib endpoint is configured using a record:\n\n```erlang\n#adlib_endpoint{\n    name = \u003c\u003c\"My Foobar database\"\u003e\u003e,\n    api_url = \u003c\u003c\"https://foobar.adlibhosting.com/mydatabase/wwwopac.ashx\"\u003e\u003e,\n    database = \u003c\u003c\"collect\"\u003e\u003e,\n    extra_arguments = [],\n    date_format = \"'Y-m-d H:i:s'\",\n    timezone = \u003c\u003c\"UTC\"\u003e\u003e\n}\n\n```\n\nThe API URL is the base URL for all API calls.\n\nThe database is one of the databases available on the remote system.\n\nThe date_format is there to support legacy Adlib systems, older systems might need `\"Ymd\"` as format.\n\n### Listing all databases in Adlib\n\nA list of databases can be requested:\n\n\n```erlang\nm_adlib_api:list_databases(\u003c\u003c\"https://foobar.adlibhosting.com/mydatabase/wwwopac.ashx\"\u003e\u003e, z:c(yoursite)).\n\n```\n\nThis returns a list of databases:\n\n```erlang\n{ok,[#{database =\u003e \u003c\u003c\"fullcatalogue\"\u003e\u003e,\n       datasource =\u003e \u003c\u003c\"document\u003efullcatalogue\"\u003e\u003e},\n     #{database =\u003e \u003c\u003c\"books\"\u003e\u003e,\n       datasource =\u003e \u003c\u003c\"document\u003ebook\"\u003e\u003e},\n     #{database =\u003e \u003c\u003c\"collect\"\u003e\u003e,\n       datasource =\u003e \u003c\u003c\"document\u003ecollect\"\u003e\u003e},\n     #{database =\u003e \u003c\u003c\"dublincore\"\u003e\u003e,\n       datasource =\u003e \u003c\u003c\"document\u003eresource\"\u003e\u003e},\n     #{database =\u003e \u003c\u003c\"thesau\"\u003e\u003e,\n       datasource =\u003e \u003c\u003c\"thesau\"\u003e\u003e}]}\n\n```\n\n\n### Fetching a single record\n\nRecords are fetched using their `priref` id.\n\nLet `Endpoint` be a configured `#adlib_endpoint{}` then this fetches a specific record:\n\n```erlang\nm_adlib_api:fetch_record(Endpoint, 10594, z:c(yoursite)).\n```\n\nReturns:\n\n```erlang\n{ok,#{\u003c\u003c\"@attributes\"\u003e\u003e =\u003e\n          #{\u003c\u003c\"created\"\u003e\u003e =\u003e \u003c\u003c\"2021-05-16T15:19:38\"\u003e\u003e,\n            \u003c\u003c\"modification\"\u003e\u003e =\u003e \u003c\u003c\"2021-05-20T16:32:20\"\u003e\u003e,\n            \u003c\u003c\"priref\"\u003e\u003e =\u003e \u003c\u003c\"10594\"\u003e\u003e,\u003c\u003c\"selected\"\u003e\u003e =\u003e \u003c\u003c\"False\"\u003e\u003e},\n      \u003c\u003c\"alternative_number\"\u003e\u003e =\u003e\n          [#{\u003c\u003c\"alternative_number\"\u003e\u003e =\u003e [\u003c\u003c\"Carte di Castello 13\"\u003e\u003e]}],\n      \u003c\u003c\"associated_subject\"\u003e\u003e =\u003e\n          [#{\u003c\u003c\"association.subject\"\u003e\u003e =\u003e\n                 [#{\u003c\u003c\"value\"\u003e\u003e =\u003e\n                        [#{\u003c\u003c\"@attributes\"\u003e\u003e =\u003e\n                               #{\u003c\u003c\"invariant\"\u003e\u003e =\u003e \u003c\u003c\"false\"\u003e\u003e,\u003c\u003c\"lang\"\u003e\u003e =\u003e \u003c\u003c\"nl-NL\"\u003e\u003e},\n                           \u003c\u003c\"value\"\u003e\u003e =\u003e [\u003c\u003c\"plattegrond / kaart\"\u003e\u003e]},\n                         #{\u003c\u003c\"@attributes\"\u003e\u003e =\u003e\n                               #{\u003c\u003c\"invariant\"\u003e\u003e =\u003e \u003c\u003c\"false\"\u003e\u003e,\u003c\u003c\"lang\"\u003e\u003e =\u003e \u003c\u003c\"en-GB\"\u003e\u003e},\n                           \u003c\u003c\"value\"\u003e\u003e =\u003e [\u003c\u003c\"Map/Chart/Plan\"\u003e\u003e]}]}],\n             \u003c\u003c\"association.subject.latitude\"\u003e\u003e =\u003e [],\n\n    (..)\n}}\n```\nNote that all tag names and attributes are lowercased.\n\nIf the record is not found then `{error, enoent}` is returned.\n\n\n### Fetching all records since a date\n\nFor syncing the Adlib content with Zotonic there is a function to fetch all records\nmodified since a certain date (in UTC).\n\nThe date can be a relative date `\"-1 week\"`, a timestamp `1633526615`, a date\n`{2021, 10, 5}`, a datetime `{{2021, 10, 5}, {12, 0, 0}}` or a string with a date \n`\"2021-10-05 12:00:00\"`.\n\nThe `timezone` of the Adlib endpoint is used to convert the date to the date/time used\nby Adlib. Adlib uses local time in their output, where the timezone depends on the\nconfiguration of the Adlib server.\n\n```erlang\nm_adlib_api:fetch_since(Endpoint, \u003c\u003c\"-1 month\"\u003e\u003e, z:c(yoursite)).\n```\n\nReturns:\n\n```erlang\n{ok, {List, Next}}\n\n```\n\nWhere `List` is a list of Adlib records and `Next` is the continuation function.\n`Next` can be:\n\n- `done`\n- `{next, Fun}`\n\nThe `Fun` can be called as `Fun()` and will return the next result.\n\nThe records are sorted by _priref_.\n\n\n### Fetching all records\n\nTo fetch all records, pass an empty date to the `fetch_since`:\n\n```erlang\nm_adlib_api:fetch_since(Endpoint, undefined, z:c(yoursite)).\n```\n\nThe records are sorted by _priref_.\n\n\n## Mapping Adlib records to RDF triples.\n\nThere are basic routines to map an Adlib record to RDF statements.\n\n\n### Generate an unique URI for an Adlib record\n\nTo identify a resource, an unique URI is needed. This routine generates the unique URI using\nthe Adlib endpoint specification and the _priref_ in the Adlib record.\n\n```erlang\nadlib_rdf:uri(Endpoint, Record).\n```\n\nReturns something like:\n\n```erlang\n{ok, \u003c\u003c\"adlib:foobar.adlibhosting.com/mydatabase/collect/10594\"\u003e\u003e}\n\n```\n\n### Check if an URI matches an endpoint\n\nTo find the endpoint for an Adlib URI you can check the URI against an Endpoint:\n\n```erlang\nadlib_rdf:is_matching_uri(Endpoint, \u003c\u003c\"adlib:foobar.adlibhosting.com/mydatabase/collect/10594\"\u003e\u003e).\n```\n\nThis returns a boolean (in this case `true`).\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdriebit%2Fzotonic_mod_adlib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdriebit%2Fzotonic_mod_adlib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdriebit%2Fzotonic_mod_adlib/lists"}