{"id":26002612,"url":"https://github.com/loopwork-ai/ontology","last_synced_at":"2025-03-05T19:07:55.481Z","repository":{"id":279874414,"uuid":"940288254","full_name":"loopwork-ai/Ontology","owner":"loopwork-ai","description":null,"archived":false,"fork":false,"pushed_at":"2025-02-27T23:54:05.000Z","size":17,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-02-28T08:10:55.065Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Swift","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/loopwork-ai.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}},"created_at":"2025-02-27T23:21:57.000Z","updated_at":"2025-02-27T23:54:07.000Z","dependencies_parsed_at":"2025-02-28T08:11:01.084Z","dependency_job_id":"cd81053c-bbff-49f8-b111-4cfdf71cb460","html_url":"https://github.com/loopwork-ai/Ontology","commit_stats":null,"previous_names":["loopwork-ai/ontology"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loopwork-ai%2FOntology","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loopwork-ai%2FOntology/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loopwork-ai%2FOntology/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loopwork-ai%2FOntology/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/loopwork-ai","download_url":"https://codeload.github.com/loopwork-ai/Ontology/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242087922,"owners_count":20069723,"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","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-03-05T19:07:54.753Z","updated_at":"2025-03-05T19:07:55.450Z","avatar_url":"https://github.com/loopwork-ai.png","language":"Swift","readme":"# Ontology\n\nA Swift library for working with structured data.\nThis library provides [JSON-LD][json-ld] serializable types\nthat can represent entities from various vocabularies, \nwith a focus on [Schema.org][schema.org]. \nIt includes convenience initializers for types from Apple frameworks, like \n[Contacts][framework-contacts] and [EventKit][framework-eventkit].\n\n## Requirements\n\n- Swift 6.0+ / Xcode 16+\n- macOS 14.0+ (Sonoma)\n- iOS 17.0+\n\n## Installation\n\n### Swift Package Manager\n\nAdd the following to your `Package.swift` file:\n\n```swift\ndependencies: [\n    .package(url: \"https://github.com/loopwork-ai/ontology.git\", from: \"0.3.0\")\n]\n```\n\n## Supported Types\n\n### Schema.org Vocabulary\n\nSupported Schema.org types and their Apple framework equivalents:\n\n| Schema.org Type | Apple Framework Type | Description |\n|----------------|----------------------|-------------|\n| [ContactPoint](https://schema.org/ContactPoint) | [CNInstantMessageAddress](https://developer.apple.com/documentation/contacts/cninstantmessageaddress) | Represents a method of contact like instant messaging |\n| [DateTime](https://schema.org/DateTime) | [Date](https://developer.apple.com/documentation/foundation/date) | Represents a date and time with ISO 8601 formatting |\n| [Event](https://schema.org/Event) | [EKEvent](https://developer.apple.com/documentation/eventkit/ekevent) | Represents an event with start/end dates, location, etc. |\n| [GeoCoordinates](https://schema.org/GeoCoordinates) | [CLLocation](https://developer.apple.com/documentation/corelocation/cllocation) | Represents geographic coordinates with latitude, longitude, and optional elevation |\n| [Organization](https://schema.org/Organization) | [CNContact](https://developer.apple.com/documentation/contacts/cncontact) | Represents an organization with properties like name and contact info |\n| [Person](https://schema.org/Person) | [CNContact](https://developer.apple.com/documentation/contacts/cncontact) | Represents a person with properties like name, contact info, and relationships |\n| [PlanAction](https://schema.org/PlanAction) | [EKReminder](https://developer.apple.com/documentation/eventkit/ekreminder) | Represents a planned action or task with properties like name, description, due date, and completion status |\n| [PostalAddress](https://schema.org/PostalAddress) | [CNPostalAddress](https://developer.apple.com/documentation/contacts/cnpostaladdress) | Represents a physical address with street, city, region, etc. |\n\n### Weather.gov API Vocabulary\n\nAdditional types supporting the [National Weather Service API][nws-api]:\n\n| Weather.gov Type | Description |\n|-----------------|-------------|\n| WeatherForecast | Represents detailed weather forecast data including temperature, precipitation probability, and wind information |\n\n## Usage\n\n### Creating objects and encoding as JSON-LD\n\n```swift\nimport Ontology\n\n// Create a Person\nvar person = Person()\nperson.givenName = \"John\"\nperson.familyName = \"Doe\"\nperson.email = [\"john.doe@example.com\"]\n\n// Create an organization\nvar organization = Organization()\norganization.name = \"Example Corp\"\n\n// Associate person with organization\nperson.worksFor = organization\n\n// Encode to JSON-LD\nlet encoder = JSONEncoder()\nlet jsonData = try encoder.encode(person)\nprint(String(data: jsonData, encoding: .utf8)!)\n\n// Output:\n// {\n//   \"@context\": \"https://schema.org\",\n//   \"@type\": \"Person\",\n//   \"givenName\": \"John\",\n//   \"familyName\": \"Doe\"\n// }\n```\n\n### Initializing from Apple framework types\n\n```swift\nimport Ontology\nimport Contacts\n\n// Convert from Apple's CNContact to Schema.org Person\nlet contact = CNMutableContact()\ncontact.givenName = \"Jane\"\ncontact.familyName = \"Smith\"\ncontact.emailAddresses = [\n    CNLabeledValue(label: CNLabelHome, \n                   value: \"jane.smith@example.com\" as NSString)\n]\n\n// Convert to Schema.org Person\nlet person = Person(contact)\n```\n\n## License\n\nThis project is licensed under the Apache License, Version 2.0.\n\n[schema.org]: https://schema.org\n[json-ld]: https://json-ld.org\n[nws-api]: https://weather.gov\n[framework-contacts]: https://developer.apple.com/documentation/contacts/\n[framework-eventkit]: https://developer.apple.com/documentation/eventkit\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floopwork-ai%2Fontology","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Floopwork-ai%2Fontology","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floopwork-ai%2Fontology/lists"}