(*********************************************************************************)
(*                OCaml-RDF                                                      *)
(*                                                                               *)
(*    Copyright (C) 2012-2024 Institut National de Recherche en Informatique     *)
(*    et en Automatique. All rights reserved.                                    *)
(*                                                                               *)
(*    This program is free software; you can redistribute it and/or modify       *)
(*    it under the terms of the GNU Lesser General Public License version        *)
(*    3 as published by the Free Software Foundation.                            *)
(*                                                                               *)
(*    This program is distributed in the hope that it will be useful,            *)
(*    but WITHOUT ANY WARRANTY; without even the implied warranty of             *)
(*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *)
(*    GNU General Public License for more details.                               *)
(*                                                                               *)
(*    You should have received a copy of the GNU General Public License          *)
(*    along with this program; if not, write to the Free Software                *)
(*    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA                   *)
(*    02111-1307  USA                                                            *)
(*                                                                               *)
(*    Contact: Maxence.Guesdon@inria.fr                                          *)
(*                                                                               *)
(*********************************************************************************)

let doap_str = "http://usefulinc.com/ns/doap#";;
let doap = Iri.of_string doap_str ;;
let doap_ s = Iri.of_string (doap_str ^ s);;

let c_ArchRepository = doap_ "ArchRepository" ;;
let c_BKRepository = doap_ "BKRepository" ;;
let c_BazaarBranch = doap_ "BazaarBranch" ;;
let c_CVSRepository = doap_ "CVSRepository" ;;
let c_DarcsRepository = doap_ "DarcsRepository" ;;
let c_GitRepository = doap_ "GitRepository" ;;
let c_HgRepository = doap_ "HgRepository" ;;
let c_Project = doap_ "Project" ;;
let c_Repository = doap_ "Repository" ;;
let c_SVNRepository = doap_ "SVNRepository" ;;
let c_Specification = doap_ "Specification" ;;
let c_Version = doap_ "Version" ;;
let anon_root = doap_ "anon-root" ;;
let audience = doap_ "audience" ;;
let blog = doap_ "blog" ;;
let browse = doap_ "browse" ;;
let bug_database = doap_ "bug-database" ;;
let category = doap_ "category" ;;
let created = doap_ "created" ;;
let description = doap_ "description" ;;
let developer = doap_ "developer" ;;
let documenter = doap_ "documenter" ;;
let download_mirror = doap_ "download-mirror" ;;
let download_page = doap_ "download-page" ;;
let file_release = doap_ "file-release" ;;
let helper = doap_ "helper" ;;
let homepage = doap_ "homepage" ;;
let implements = doap_ "implements" ;;
let language = doap_ "language" ;;
let license = doap_ "license" ;;
let location = doap_ "location" ;;
let mailing_list = doap_ "mailing-list" ;;
let maintainer = doap_ "maintainer" ;;
let module_ = doap_ "module" ;;
let name = doap_ "name" ;;
let old_homepage = doap_ "old-homepage" ;;
let os = doap_ "os" ;;
let platform = doap_ "platform" ;;
let programming_language = doap_ "programming-language" ;;
let release = doap_ "release" ;;
let repository = doap_ "repository" ;;
let revision = doap_ "revision" ;;
let screenshots = doap_ "screenshots" ;;
let service_endpoint = doap_ "service-endpoint" ;;
let shortdesc = doap_ "shortdesc" ;;
let tester = doap_ "tester" ;;
let translator = doap_ "translator" ;;
let vendor = doap_ "vendor" ;;
let wiki = doap_ "wiki" ;;

module Open = struct
  let doap_c_ArchRepository = c_ArchRepository
  let doap_c_BKRepository = c_BKRepository
  let doap_c_BazaarBranch = c_BazaarBranch
  let doap_c_CVSRepository = c_CVSRepository
  let doap_c_DarcsRepository = c_DarcsRepository
  let doap_c_GitRepository = c_GitRepository
  let doap_c_HgRepository = c_HgRepository
  let doap_c_Project = c_Project
  let doap_c_Repository = c_Repository
  let doap_c_SVNRepository = c_SVNRepository
  let doap_c_Specification = c_Specification
  let doap_c_Version = c_Version
  let doap_anon_root = anon_root
  let doap_audience = audience
  let doap_blog = blog
  let doap_browse = browse
  let doap_bug_database = bug_database
  let doap_category = category
  let doap_created = created
  let doap_description = description
  let doap_developer = developer
  let doap_documenter = documenter
  let doap_download_mirror = download_mirror
  let doap_download_page = download_page
  let doap_file_release = file_release
  let doap_helper = helper
  let doap_homepage = homepage
  let doap_implements = implements
  let doap_language = language
  let doap_license = license
  let doap_location = location
  let doap_mailing_list = mailing_list
  let doap_maintainer = maintainer
  let doap_module = module_
  let doap_name = name
  let doap_old_homepage = old_homepage
  let doap_os = os
  let doap_platform = platform
  let doap_programming_language = programming_language
  let doap_release = release
  let doap_repository = repository
  let doap_revision = revision
  let doap_screenshots = screenshots
  let doap_service_endpoint = service_endpoint
  let doap_shortdesc = shortdesc
  let doap_tester = tester
  let doap_translator = translator
  let doap_vendor = vendor
  let doap_wiki = wiki
end

class from ?sub g =
  let sub = match sub with None -> Term.Iri (g.Graph.name()) | Some t -> t in
  object(self)
  method anon_root = Graph.literal_objects_of g ~sub ~pred: anon_root
  method anon_root_opt = match self#anon_root with [] -> None | x::_ -> Some x
  method audience = Graph.literal_objects_of g ~sub ~pred: audience
  method audience_opt = match self#audience with [] -> None | x::_ -> Some x
  method blog = g.Graph.objects_of ~sub ~pred: blog
  method blog_opt = match self#blog with [] -> None | x::_ -> Some x
  method blog_iris = Graph.only_iris (self#blog)
  method blog_opt_iri = match self#blog_iris with [] -> None | x::_ -> Some x
  method browse = g.Graph.objects_of ~sub ~pred: browse
  method browse_opt = match self#browse with [] -> None | x::_ -> Some x
  method browse_iris = Graph.only_iris (self#browse)
  method browse_opt_iri = match self#browse_iris with [] -> None | x::_ -> Some x
  method bug_database = g.Graph.objects_of ~sub ~pred: bug_database
  method bug_database_opt = match self#bug_database with [] -> None | x::_ -> Some x
  method bug_database_iris = Graph.only_iris (self#bug_database)
  method bug_database_opt_iri = match self#bug_database_iris with [] -> None | x::_ -> Some x
  method category = g.Graph.objects_of ~sub ~pred: category
  method category_opt = match self#category with [] -> None | x::_ -> Some x
  method category_iris = Graph.only_iris (self#category)
  method category_opt_iri = match self#category_iris with [] -> None | x::_ -> Some x
  method created = Graph.literal_objects_of g ~sub ~pred: created
  method created_opt = match self#created with [] -> None | x::_ -> Some x
  method description = Graph.literal_objects_of g ~sub ~pred: description
  method description_opt = match self#description with [] -> None | x::_ -> Some x
  method developer = g.Graph.objects_of ~sub ~pred: developer
  method developer_opt = match self#developer with [] -> None | x::_ -> Some x
  method developer_iris = Graph.only_iris (self#developer)
  method developer_opt_iri = match self#developer_iris with [] -> None | x::_ -> Some x
  method documenter = g.Graph.objects_of ~sub ~pred: documenter
  method documenter_opt = match self#documenter with [] -> None | x::_ -> Some x
  method documenter_iris = Graph.only_iris (self#documenter)
  method documenter_opt_iri = match self#documenter_iris with [] -> None | x::_ -> Some x
  method download_mirror = g.Graph.objects_of ~sub ~pred: download_mirror
  method download_mirror_opt = match self#download_mirror with [] -> None | x::_ -> Some x
  method download_mirror_iris = Graph.only_iris (self#download_mirror)
  method download_mirror_opt_iri = match self#download_mirror_iris with [] -> None | x::_ -> Some x
  method download_page = g.Graph.objects_of ~sub ~pred: download_page
  method download_page_opt = match self#download_page with [] -> None | x::_ -> Some x
  method download_page_iris = Graph.only_iris (self#download_page)
  method download_page_opt_iri = match self#download_page_iris with [] -> None | x::_ -> Some x
  method file_release = g.Graph.objects_of ~sub ~pred: file_release
  method file_release_opt = match self#file_release with [] -> None | x::_ -> Some x
  method file_release_iris = Graph.only_iris (self#file_release)
  method file_release_opt_iri = match self#file_release_iris with [] -> None | x::_ -> Some x
  method helper = g.Graph.objects_of ~sub ~pred: helper
  method helper_opt = match self#helper with [] -> None | x::_ -> Some x
  method helper_iris = Graph.only_iris (self#helper)
  method helper_opt_iri = match self#helper_iris with [] -> None | x::_ -> Some x
  method homepage = g.Graph.objects_of ~sub ~pred: homepage
  method homepage_opt = match self#homepage with [] -> None | x::_ -> Some x
  method homepage_iris = Graph.only_iris (self#homepage)
  method homepage_opt_iri = match self#homepage_iris with [] -> None | x::_ -> Some x
  method implements = g.Graph.objects_of ~sub ~pred: implements
  method implements_opt = match self#implements with [] -> None | x::_ -> Some x
  method implements_iris = Graph.only_iris (self#implements)
  method implements_opt_iri = match self#implements_iris with [] -> None | x::_ -> Some x
  method language = Graph.literal_objects_of g ~sub ~pred: language
  method language_opt = match self#language with [] -> None | x::_ -> Some x
  method license = g.Graph.objects_of ~sub ~pred: license
  method license_opt = match self#license with [] -> None | x::_ -> Some x
  method license_iris = Graph.only_iris (self#license)
  method license_opt_iri = match self#license_iris with [] -> None | x::_ -> Some x
  method location = g.Graph.objects_of ~sub ~pred: location
  method location_opt = match self#location with [] -> None | x::_ -> Some x
  method location_iris = Graph.only_iris (self#location)
  method location_opt_iri = match self#location_iris with [] -> None | x::_ -> Some x
  method mailing_list = g.Graph.objects_of ~sub ~pred: mailing_list
  method mailing_list_opt = match self#mailing_list with [] -> None | x::_ -> Some x
  method mailing_list_iris = Graph.only_iris (self#mailing_list)
  method mailing_list_opt_iri = match self#mailing_list_iris with [] -> None | x::_ -> Some x
  method maintainer = g.Graph.objects_of ~sub ~pred: maintainer
  method maintainer_opt = match self#maintainer with [] -> None | x::_ -> Some x
  method maintainer_iris = Graph.only_iris (self#maintainer)
  method maintainer_opt_iri = match self#maintainer_iris with [] -> None | x::_ -> Some x
  method module_ = g.Graph.objects_of ~sub ~pred: module_
  method module__opt = match self#module_ with [] -> None | x::_ -> Some x
  method module__iris = Graph.only_iris (self#module_)
  method module__opt_iri = match self#module__iris with [] -> None | x::_ -> Some x
  method name = Graph.literal_objects_of g ~sub ~pred: name
  method name_opt = match self#name with [] -> None | x::_ -> Some x
  method old_homepage = g.Graph.objects_of ~sub ~pred: old_homepage
  method old_homepage_opt = match self#old_homepage with [] -> None | x::_ -> Some x
  method old_homepage_iris = Graph.only_iris (self#old_homepage)
  method old_homepage_opt_iri = match self#old_homepage_iris with [] -> None | x::_ -> Some x
  method os = Graph.literal_objects_of g ~sub ~pred: os
  method os_opt = match self#os with [] -> None | x::_ -> Some x
  method platform = Graph.literal_objects_of g ~sub ~pred: platform
  method platform_opt = match self#platform with [] -> None | x::_ -> Some x
  method programming_language = Graph.literal_objects_of g ~sub ~pred: programming_language
  method programming_language_opt = match self#programming_language with [] -> None | x::_ -> Some x
  method release = g.Graph.objects_of ~sub ~pred: release
  method release_opt = match self#release with [] -> None | x::_ -> Some x
  method release_iris = Graph.only_iris (self#release)
  method release_opt_iri = match self#release_iris with [] -> None | x::_ -> Some x
  method repository = g.Graph.objects_of ~sub ~pred: repository
  method repository_opt = match self#repository with [] -> None | x::_ -> Some x
  method repository_iris = Graph.only_iris (self#repository)
  method repository_opt_iri = match self#repository_iris with [] -> None | x::_ -> Some x
  method revision = Graph.literal_objects_of g ~sub ~pred: revision
  method revision_opt = match self#revision with [] -> None | x::_ -> Some x
  method screenshots = g.Graph.objects_of ~sub ~pred: screenshots
  method screenshots_opt = match self#screenshots with [] -> None | x::_ -> Some x
  method screenshots_iris = Graph.only_iris (self#screenshots)
  method screenshots_opt_iri = match self#screenshots_iris with [] -> None | x::_ -> Some x
  method service_endpoint = g.Graph.objects_of ~sub ~pred: service_endpoint
  method service_endpoint_opt = match self#service_endpoint with [] -> None | x::_ -> Some x
  method service_endpoint_iris = Graph.only_iris (self#service_endpoint)
  method service_endpoint_opt_iri = match self#service_endpoint_iris with [] -> None | x::_ -> Some x
  method shortdesc = Graph.literal_objects_of g ~sub ~pred: shortdesc
  method shortdesc_opt = match self#shortdesc with [] -> None | x::_ -> Some x
  method tester = g.Graph.objects_of ~sub ~pred: tester
  method tester_opt = match self#tester with [] -> None | x::_ -> Some x
  method tester_iris = Graph.only_iris (self#tester)
  method tester_opt_iri = match self#tester_iris with [] -> None | x::_ -> Some x
  method translator = g.Graph.objects_of ~sub ~pred: translator
  method translator_opt = match self#translator with [] -> None | x::_ -> Some x
  method translator_iris = Graph.only_iris (self#translator)
  method translator_opt_iri = match self#translator_iris with [] -> None | x::_ -> Some x
  method vendor = g.Graph.objects_of ~sub ~pred: vendor
  method vendor_opt = match self#vendor with [] -> None | x::_ -> Some x
  method vendor_iris = Graph.only_iris (self#vendor)
  method vendor_opt_iri = match self#vendor_iris with [] -> None | x::_ -> Some x
  method wiki = g.Graph.objects_of ~sub ~pred: wiki
  method wiki_opt = match self#wiki with [] -> None | x::_ -> Some x
  method wiki_iris = Graph.only_iris (self#wiki)
  method wiki_opt_iri = match self#wiki_iris with [] -> None | x::_ -> Some x
  end
