(*********************************************************************************)
(*                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 foaf_str = "http://xmlns.com/foaf/0.1/";;
let foaf = Iri.of_string foaf_str ;;
let foaf_ s = Iri.of_string (foaf_str ^ s);;

let c_Agent = foaf_ "Agent" ;;
let c_Document = foaf_ "Document" ;;
let c_Group = foaf_ "Group" ;;
let c_Image = foaf_ "Image" ;;
let c_LabelProperty = foaf_ "LabelProperty" ;;
let c_OnlineAccount = foaf_ "OnlineAccount" ;;
let c_OnlineChatAccount = foaf_ "OnlineChatAccount" ;;
let c_OnlineEcommerceAccount = foaf_ "OnlineEcommerceAccount" ;;
let c_OnlineGamingAccount = foaf_ "OnlineGamingAccount" ;;
let c_Organization = foaf_ "Organization" ;;
let c_Person = foaf_ "Person" ;;
let c_PersonalProfileDocument = foaf_ "PersonalProfileDocument" ;;
let c_Project = foaf_ "Project" ;;
let account = foaf_ "account" ;;
let accountName = foaf_ "accountName" ;;
let accountServiceHomepage = foaf_ "accountServiceHomepage" ;;
let age = foaf_ "age" ;;
let aimChatID = foaf_ "aimChatID" ;;
let based_near = foaf_ "based_near" ;;
let birthday = foaf_ "birthday" ;;
let currentProject = foaf_ "currentProject" ;;
let depiction = foaf_ "depiction" ;;
let depicts = foaf_ "depicts" ;;
let dnaChecksum = foaf_ "dnaChecksum" ;;
let familyName = foaf_ "familyName" ;;
let family_name = foaf_ "family_name" ;;
let firstName = foaf_ "firstName" ;;
let focus = foaf_ "focus" ;;
let fundedBy = foaf_ "fundedBy" ;;
let geekcode = foaf_ "geekcode" ;;
let gender = foaf_ "gender" ;;
let givenName = foaf_ "givenName" ;;
let givenname = foaf_ "givenname" ;;
let holdsAccount = foaf_ "holdsAccount" ;;
let homepage = foaf_ "homepage" ;;
let icqChatID = foaf_ "icqChatID" ;;
let img = foaf_ "img" ;;
let interest = foaf_ "interest" ;;
let isPrimaryTopicOf = foaf_ "isPrimaryTopicOf" ;;
let jabberID = foaf_ "jabberID" ;;
let knows = foaf_ "knows" ;;
let lastName = foaf_ "lastName" ;;
let logo = foaf_ "logo" ;;
let made = foaf_ "made" ;;
let maker = foaf_ "maker" ;;
let mbox = foaf_ "mbox" ;;
let mbox_sha1sum = foaf_ "mbox_sha1sum" ;;
let member = foaf_ "member" ;;
let membershipClass = foaf_ "membershipClass" ;;
let msnChatID = foaf_ "msnChatID" ;;
let myersBriggs = foaf_ "myersBriggs" ;;
let name = foaf_ "name" ;;
let nick = foaf_ "nick" ;;
let openid = foaf_ "openid" ;;
let page = foaf_ "page" ;;
let pastProject = foaf_ "pastProject" ;;
let phone = foaf_ "phone" ;;
let plan = foaf_ "plan" ;;
let primaryTopic = foaf_ "primaryTopic" ;;
let publications = foaf_ "publications" ;;
let schoolHomepage = foaf_ "schoolHomepage" ;;
let sha1 = foaf_ "sha1" ;;
let skypeID = foaf_ "skypeID" ;;
let status = foaf_ "status" ;;
let surname = foaf_ "surname" ;;
let theme = foaf_ "theme" ;;
let thumbnail = foaf_ "thumbnail" ;;
let tipjar = foaf_ "tipjar" ;;
let title = foaf_ "title" ;;
let topic = foaf_ "topic" ;;
let topic_interest = foaf_ "topic_interest" ;;
let weblog = foaf_ "weblog" ;;
let workInfoHomepage = foaf_ "workInfoHomepage" ;;
let workplaceHomepage = foaf_ "workplaceHomepage" ;;
let yahooChatID = foaf_ "yahooChatID" ;;

module Open = struct
  let foaf_c_Agent = c_Agent
  let foaf_c_Document = c_Document
  let foaf_c_Group = c_Group
  let foaf_c_Image = c_Image
  let foaf_c_LabelProperty = c_LabelProperty
  let foaf_c_OnlineAccount = c_OnlineAccount
  let foaf_c_OnlineChatAccount = c_OnlineChatAccount
  let foaf_c_OnlineEcommerceAccount = c_OnlineEcommerceAccount
  let foaf_c_OnlineGamingAccount = c_OnlineGamingAccount
  let foaf_c_Organization = c_Organization
  let foaf_c_Person = c_Person
  let foaf_c_PersonalProfileDocument = c_PersonalProfileDocument
  let foaf_c_Project = c_Project
  let foaf_account = account
  let foaf_accountName = accountName
  let foaf_accountServiceHomepage = accountServiceHomepage
  let foaf_age = age
  let foaf_aimChatID = aimChatID
  let foaf_based_near = based_near
  let foaf_birthday = birthday
  let foaf_currentProject = currentProject
  let foaf_depiction = depiction
  let foaf_depicts = depicts
  let foaf_dnaChecksum = dnaChecksum
  let foaf_familyName = familyName
  let foaf_family_name = family_name
  let foaf_firstName = firstName
  let foaf_focus = focus
  let foaf_fundedBy = fundedBy
  let foaf_geekcode = geekcode
  let foaf_gender = gender
  let foaf_givenName = givenName
  let foaf_givenname = givenname
  let foaf_holdsAccount = holdsAccount
  let foaf_homepage = homepage
  let foaf_icqChatID = icqChatID
  let foaf_img = img
  let foaf_interest = interest
  let foaf_isPrimaryTopicOf = isPrimaryTopicOf
  let foaf_jabberID = jabberID
  let foaf_knows = knows
  let foaf_lastName = lastName
  let foaf_logo = logo
  let foaf_made = made
  let foaf_maker = maker
  let foaf_mbox = mbox
  let foaf_mbox_sha1sum = mbox_sha1sum
  let foaf_member = member
  let foaf_membershipClass = membershipClass
  let foaf_msnChatID = msnChatID
  let foaf_myersBriggs = myersBriggs
  let foaf_name = name
  let foaf_nick = nick
  let foaf_openid = openid
  let foaf_page = page
  let foaf_pastProject = pastProject
  let foaf_phone = phone
  let foaf_plan = plan
  let foaf_primaryTopic = primaryTopic
  let foaf_publications = publications
  let foaf_schoolHomepage = schoolHomepage
  let foaf_sha1 = sha1
  let foaf_skypeID = skypeID
  let foaf_status = status
  let foaf_surname = surname
  let foaf_theme = theme
  let foaf_thumbnail = thumbnail
  let foaf_tipjar = tipjar
  let foaf_title = title
  let foaf_topic = topic
  let foaf_topic_interest = topic_interest
  let foaf_weblog = weblog
  let foaf_workInfoHomepage = workInfoHomepage
  let foaf_workplaceHomepage = workplaceHomepage
  let foaf_yahooChatID = yahooChatID
end

class from ?sub g =
  let sub = match sub with None -> Term.Iri (g.Graph.name()) | Some t -> t in
  object(self)
  method account = g.Graph.objects_of ~sub ~pred: account
  method account_opt = match self#account with [] -> None | x::_ -> Some x
  method account_iris = Graph.only_iris (self#account)
  method account_opt_iri = match self#account_iris with [] -> None | x::_ -> Some x
  method accountName = Graph.literal_objects_of g ~sub ~pred: accountName
  method accountName_opt = match self#accountName with [] -> None | x::_ -> Some x
  method accountServiceHomepage = g.Graph.objects_of ~sub ~pred: accountServiceHomepage
  method accountServiceHomepage_opt = match self#accountServiceHomepage with [] -> None | x::_ -> Some x
  method accountServiceHomepage_iris = Graph.only_iris (self#accountServiceHomepage)
  method accountServiceHomepage_opt_iri = match self#accountServiceHomepage_iris with [] -> None | x::_ -> Some x
  method age = Graph.literal_objects_of g ~sub ~pred: age
  method age_opt = match self#age with [] -> None | x::_ -> Some x
  method aimChatID = Graph.literal_objects_of g ~sub ~pred: aimChatID
  method aimChatID_opt = match self#aimChatID with [] -> None | x::_ -> Some x
  method based_near = g.Graph.objects_of ~sub ~pred: based_near
  method based_near_opt = match self#based_near with [] -> None | x::_ -> Some x
  method based_near_iris = Graph.only_iris (self#based_near)
  method based_near_opt_iri = match self#based_near_iris with [] -> None | x::_ -> Some x
  method birthday = Graph.literal_objects_of g ~sub ~pred: birthday
  method birthday_opt = match self#birthday with [] -> None | x::_ -> Some x
  method currentProject = g.Graph.objects_of ~sub ~pred: currentProject
  method currentProject_opt = match self#currentProject with [] -> None | x::_ -> Some x
  method currentProject_iris = Graph.only_iris (self#currentProject)
  method currentProject_opt_iri = match self#currentProject_iris with [] -> None | x::_ -> Some x
  method depiction = g.Graph.objects_of ~sub ~pred: depiction
  method depiction_opt = match self#depiction with [] -> None | x::_ -> Some x
  method depiction_iris = Graph.only_iris (self#depiction)
  method depiction_opt_iri = match self#depiction_iris with [] -> None | x::_ -> Some x
  method depicts = g.Graph.objects_of ~sub ~pred: depicts
  method depicts_opt = match self#depicts with [] -> None | x::_ -> Some x
  method depicts_iris = Graph.only_iris (self#depicts)
  method depicts_opt_iri = match self#depicts_iris with [] -> None | x::_ -> Some x
  method dnaChecksum = Graph.literal_objects_of g ~sub ~pred: dnaChecksum
  method dnaChecksum_opt = match self#dnaChecksum with [] -> None | x::_ -> Some x
  method familyName = Graph.literal_objects_of g ~sub ~pred: familyName
  method familyName_opt = match self#familyName with [] -> None | x::_ -> Some x
  method family_name = Graph.literal_objects_of g ~sub ~pred: family_name
  method family_name_opt = match self#family_name with [] -> None | x::_ -> Some x
  method firstName = Graph.literal_objects_of g ~sub ~pred: firstName
  method firstName_opt = match self#firstName with [] -> None | x::_ -> Some x
  method focus = g.Graph.objects_of ~sub ~pred: focus
  method focus_opt = match self#focus with [] -> None | x::_ -> Some x
  method focus_iris = Graph.only_iris (self#focus)
  method focus_opt_iri = match self#focus_iris with [] -> None | x::_ -> Some x
  method fundedBy = g.Graph.objects_of ~sub ~pred: fundedBy
  method fundedBy_opt = match self#fundedBy with [] -> None | x::_ -> Some x
  method fundedBy_iris = Graph.only_iris (self#fundedBy)
  method fundedBy_opt_iri = match self#fundedBy_iris with [] -> None | x::_ -> Some x
  method geekcode = Graph.literal_objects_of g ~sub ~pred: geekcode
  method geekcode_opt = match self#geekcode with [] -> None | x::_ -> Some x
  method gender = Graph.literal_objects_of g ~sub ~pred: gender
  method gender_opt = match self#gender with [] -> None | x::_ -> Some x
  method givenName = g.Graph.objects_of ~sub ~pred: givenName
  method givenName_opt = match self#givenName with [] -> None | x::_ -> Some x
  method givenName_iris = Graph.only_iris (self#givenName)
  method givenName_opt_iri = match self#givenName_iris with [] -> None | x::_ -> Some x
  method givenname = g.Graph.objects_of ~sub ~pred: givenname
  method givenname_opt = match self#givenname with [] -> None | x::_ -> Some x
  method givenname_iris = Graph.only_iris (self#givenname)
  method givenname_opt_iri = match self#givenname_iris with [] -> None | x::_ -> Some x
  method holdsAccount = g.Graph.objects_of ~sub ~pred: holdsAccount
  method holdsAccount_opt = match self#holdsAccount with [] -> None | x::_ -> Some x
  method holdsAccount_iris = Graph.only_iris (self#holdsAccount)
  method holdsAccount_opt_iri = match self#holdsAccount_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 icqChatID = Graph.literal_objects_of g ~sub ~pred: icqChatID
  method icqChatID_opt = match self#icqChatID with [] -> None | x::_ -> Some x
  method img = g.Graph.objects_of ~sub ~pred: img
  method img_opt = match self#img with [] -> None | x::_ -> Some x
  method img_iris = Graph.only_iris (self#img)
  method img_opt_iri = match self#img_iris with [] -> None | x::_ -> Some x
  method interest = g.Graph.objects_of ~sub ~pred: interest
  method interest_opt = match self#interest with [] -> None | x::_ -> Some x
  method interest_iris = Graph.only_iris (self#interest)
  method interest_opt_iri = match self#interest_iris with [] -> None | x::_ -> Some x
  method isPrimaryTopicOf = g.Graph.objects_of ~sub ~pred: isPrimaryTopicOf
  method isPrimaryTopicOf_opt = match self#isPrimaryTopicOf with [] -> None | x::_ -> Some x
  method isPrimaryTopicOf_iris = Graph.only_iris (self#isPrimaryTopicOf)
  method isPrimaryTopicOf_opt_iri = match self#isPrimaryTopicOf_iris with [] -> None | x::_ -> Some x
  method jabberID = Graph.literal_objects_of g ~sub ~pred: jabberID
  method jabberID_opt = match self#jabberID with [] -> None | x::_ -> Some x
  method knows = g.Graph.objects_of ~sub ~pred: knows
  method knows_opt = match self#knows with [] -> None | x::_ -> Some x
  method knows_iris = Graph.only_iris (self#knows)
  method knows_opt_iri = match self#knows_iris with [] -> None | x::_ -> Some x
  method lastName = Graph.literal_objects_of g ~sub ~pred: lastName
  method lastName_opt = match self#lastName with [] -> None | x::_ -> Some x
  method logo = g.Graph.objects_of ~sub ~pred: logo
  method logo_opt = match self#logo with [] -> None | x::_ -> Some x
  method logo_iris = Graph.only_iris (self#logo)
  method logo_opt_iri = match self#logo_iris with [] -> None | x::_ -> Some x
  method made = g.Graph.objects_of ~sub ~pred: made
  method made_opt = match self#made with [] -> None | x::_ -> Some x
  method made_iris = Graph.only_iris (self#made)
  method made_opt_iri = match self#made_iris with [] -> None | x::_ -> Some x
  method maker = g.Graph.objects_of ~sub ~pred: maker
  method maker_opt = match self#maker with [] -> None | x::_ -> Some x
  method maker_iris = Graph.only_iris (self#maker)
  method maker_opt_iri = match self#maker_iris with [] -> None | x::_ -> Some x
  method mbox = g.Graph.objects_of ~sub ~pred: mbox
  method mbox_opt = match self#mbox with [] -> None | x::_ -> Some x
  method mbox_iris = Graph.only_iris (self#mbox)
  method mbox_opt_iri = match self#mbox_iris with [] -> None | x::_ -> Some x
  method mbox_sha1sum = Graph.literal_objects_of g ~sub ~pred: mbox_sha1sum
  method mbox_sha1sum_opt = match self#mbox_sha1sum with [] -> None | x::_ -> Some x
  method member = g.Graph.objects_of ~sub ~pred: member
  method member_opt = match self#member with [] -> None | x::_ -> Some x
  method member_iris = Graph.only_iris (self#member)
  method member_opt_iri = match self#member_iris with [] -> None | x::_ -> Some x
  method membershipClass = g.Graph.objects_of ~sub ~pred: membershipClass
  method membershipClass_opt = match self#membershipClass with [] -> None | x::_ -> Some x
  method membershipClass_iris = Graph.only_iris (self#membershipClass)
  method membershipClass_opt_iri = match self#membershipClass_iris with [] -> None | x::_ -> Some x
  method msnChatID = Graph.literal_objects_of g ~sub ~pred: msnChatID
  method msnChatID_opt = match self#msnChatID with [] -> None | x::_ -> Some x
  method myersBriggs = Graph.literal_objects_of g ~sub ~pred: myersBriggs
  method myersBriggs_opt = match self#myersBriggs 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 nick = g.Graph.objects_of ~sub ~pred: nick
  method nick_opt = match self#nick with [] -> None | x::_ -> Some x
  method nick_iris = Graph.only_iris (self#nick)
  method nick_opt_iri = match self#nick_iris with [] -> None | x::_ -> Some x
  method openid = g.Graph.objects_of ~sub ~pred: openid
  method openid_opt = match self#openid with [] -> None | x::_ -> Some x
  method openid_iris = Graph.only_iris (self#openid)
  method openid_opt_iri = match self#openid_iris with [] -> None | x::_ -> Some x
  method page = g.Graph.objects_of ~sub ~pred: page
  method page_opt = match self#page with [] -> None | x::_ -> Some x
  method page_iris = Graph.only_iris (self#page)
  method page_opt_iri = match self#page_iris with [] -> None | x::_ -> Some x
  method pastProject = g.Graph.objects_of ~sub ~pred: pastProject
  method pastProject_opt = match self#pastProject with [] -> None | x::_ -> Some x
  method pastProject_iris = Graph.only_iris (self#pastProject)
  method pastProject_opt_iri = match self#pastProject_iris with [] -> None | x::_ -> Some x
  method phone = g.Graph.objects_of ~sub ~pred: phone
  method phone_opt = match self#phone with [] -> None | x::_ -> Some x
  method phone_iris = Graph.only_iris (self#phone)
  method phone_opt_iri = match self#phone_iris with [] -> None | x::_ -> Some x
  method plan = Graph.literal_objects_of g ~sub ~pred: plan
  method plan_opt = match self#plan with [] -> None | x::_ -> Some x
  method primaryTopic = g.Graph.objects_of ~sub ~pred: primaryTopic
  method primaryTopic_opt = match self#primaryTopic with [] -> None | x::_ -> Some x
  method primaryTopic_iris = Graph.only_iris (self#primaryTopic)
  method primaryTopic_opt_iri = match self#primaryTopic_iris with [] -> None | x::_ -> Some x
  method publications = g.Graph.objects_of ~sub ~pred: publications
  method publications_opt = match self#publications with [] -> None | x::_ -> Some x
  method publications_iris = Graph.only_iris (self#publications)
  method publications_opt_iri = match self#publications_iris with [] -> None | x::_ -> Some x
  method schoolHomepage = g.Graph.objects_of ~sub ~pred: schoolHomepage
  method schoolHomepage_opt = match self#schoolHomepage with [] -> None | x::_ -> Some x
  method schoolHomepage_iris = Graph.only_iris (self#schoolHomepage)
  method schoolHomepage_opt_iri = match self#schoolHomepage_iris with [] -> None | x::_ -> Some x
  method sha1 = g.Graph.objects_of ~sub ~pred: sha1
  method sha1_opt = match self#sha1 with [] -> None | x::_ -> Some x
  method sha1_iris = Graph.only_iris (self#sha1)
  method sha1_opt_iri = match self#sha1_iris with [] -> None | x::_ -> Some x
  method skypeID = Graph.literal_objects_of g ~sub ~pred: skypeID
  method skypeID_opt = match self#skypeID with [] -> None | x::_ -> Some x
  method status = Graph.literal_objects_of g ~sub ~pred: status
  method status_opt = match self#status with [] -> None | x::_ -> Some x
  method surname = Graph.literal_objects_of g ~sub ~pred: surname
  method surname_opt = match self#surname with [] -> None | x::_ -> Some x
  method theme = g.Graph.objects_of ~sub ~pred: theme
  method theme_opt = match self#theme with [] -> None | x::_ -> Some x
  method theme_iris = Graph.only_iris (self#theme)
  method theme_opt_iri = match self#theme_iris with [] -> None | x::_ -> Some x
  method thumbnail = g.Graph.objects_of ~sub ~pred: thumbnail
  method thumbnail_opt = match self#thumbnail with [] -> None | x::_ -> Some x
  method thumbnail_iris = Graph.only_iris (self#thumbnail)
  method thumbnail_opt_iri = match self#thumbnail_iris with [] -> None | x::_ -> Some x
  method tipjar = g.Graph.objects_of ~sub ~pred: tipjar
  method tipjar_opt = match self#tipjar with [] -> None | x::_ -> Some x
  method tipjar_iris = Graph.only_iris (self#tipjar)
  method tipjar_opt_iri = match self#tipjar_iris with [] -> None | x::_ -> Some x
  method title = g.Graph.objects_of ~sub ~pred: title
  method title_opt = match self#title with [] -> None | x::_ -> Some x
  method title_iris = Graph.only_iris (self#title)
  method title_opt_iri = match self#title_iris with [] -> None | x::_ -> Some x
  method topic = g.Graph.objects_of ~sub ~pred: topic
  method topic_opt = match self#topic with [] -> None | x::_ -> Some x
  method topic_iris = Graph.only_iris (self#topic)
  method topic_opt_iri = match self#topic_iris with [] -> None | x::_ -> Some x
  method topic_interest = g.Graph.objects_of ~sub ~pred: topic_interest
  method topic_interest_opt = match self#topic_interest with [] -> None | x::_ -> Some x
  method topic_interest_iris = Graph.only_iris (self#topic_interest)
  method topic_interest_opt_iri = match self#topic_interest_iris with [] -> None | x::_ -> Some x
  method weblog = g.Graph.objects_of ~sub ~pred: weblog
  method weblog_opt = match self#weblog with [] -> None | x::_ -> Some x
  method weblog_iris = Graph.only_iris (self#weblog)
  method weblog_opt_iri = match self#weblog_iris with [] -> None | x::_ -> Some x
  method workInfoHomepage = g.Graph.objects_of ~sub ~pred: workInfoHomepage
  method workInfoHomepage_opt = match self#workInfoHomepage with [] -> None | x::_ -> Some x
  method workInfoHomepage_iris = Graph.only_iris (self#workInfoHomepage)
  method workInfoHomepage_opt_iri = match self#workInfoHomepage_iris with [] -> None | x::_ -> Some x
  method workplaceHomepage = g.Graph.objects_of ~sub ~pred: workplaceHomepage
  method workplaceHomepage_opt = match self#workplaceHomepage with [] -> None | x::_ -> Some x
  method workplaceHomepage_iris = Graph.only_iris (self#workplaceHomepage)
  method workplaceHomepage_opt_iri = match self#workplaceHomepage_iris with [] -> None | x::_ -> Some x
  method yahooChatID = Graph.literal_objects_of g ~sub ~pred: yahooChatID
  method yahooChatID_opt = match self#yahooChatID with [] -> None | x::_ -> Some x
  end
