(*********************************************************************************)
(*                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 security_str = "https://w3id.org/security#";;
let security = Iri.of_string security_str ;;
let security_ s = Iri.of_string (security_str ^ s);;

let c_BbsBlsSignature2020 = security_ "BbsBlsSignature2020" ;;
let c_BbsBlsSignatureProof2020 = security_ "BbsBlsSignatureProof2020" ;;
let c_Bls12381G1Key2020 = security_ "Bls12381G1Key2020" ;;
let c_Bls12381G2Key2020 = security_ "Bls12381G2Key2020" ;;
let c_DataIntegrityProof = security_ "DataIntegrityProof" ;;
let c_Digest = security_ "Digest" ;;
let c_EcdsaSecp256k1RecoveryMethod2020 = security_ "EcdsaSecp256k1RecoveryMethod2020" ;;
let c_EcdsaSecp256k1RecoverySignature2020 = security_ "EcdsaSecp256k1RecoverySignature2020" ;;
let c_EcdsaSecp256k1Signature2019 = security_ "EcdsaSecp256k1Signature2019" ;;
let c_EcdsaSecp256k1Signature2020 = security_ "EcdsaSecp256k1Signature2020" ;;
let c_EcdsaSecp256k1VerificationKey2019 = security_ "EcdsaSecp256k1VerificationKey2019" ;;
let c_Ed25519Signature2020 = security_ "Ed25519Signature2020" ;;
let c_Ed25519VerificationKey2018 = security_ "Ed25519VerificationKey2018" ;;
let c_Ed25519VerificationKey2020 = security_ "Ed25519VerificationKey2020" ;;
let c_EncryptedMessage = security_ "EncryptedMessage" ;;
let c_GraphSignature2012 = security_ "GraphSignature2012" ;;
let c_JsonWebKey2020 = security_ "JsonWebKey2020" ;;
let c_JsonWebSignature2020 = security_ "JsonWebSignature2020" ;;
let c_Key = security_ "Key" ;;
let c_LinkedDataSignature2015 = security_ "LinkedDataSignature2015" ;;
let c_LinkedDataSignature2016 = security_ "LinkedDataSignature2016" ;;
let c_MerkleProof2019 = security_ "MerkleProof2019" ;;
let c_Multikey = security_ "Multikey" ;;
let c_Proof = security_ "Proof" ;;
let c_ProofGraph = security_ "ProofGraph" ;;
let c_RsaSignature2018 = security_ "RsaSignature2018" ;;
let c_RsaVerificationKey2018 = security_ "RsaVerificationKey2018" ;;
let c_SchnorrSecp256k1Signature2019 = security_ "SchnorrSecp256k1Signature2019" ;;
let c_SchnorrSecp256k1VerificationKey2019 = security_ "SchnorrSecp256k1VerificationKey2019" ;;
let c_ServiceEndpointProxyService = security_ "ServiceEndpointProxyService" ;;
let c_Signature = security_ "Signature" ;;
let c_SignatureGraph = security_ "SignatureGraph" ;;
let c_VerificationMethod = security_ "VerificationMethod" ;;
let c_X25519KeyAgreementKey2019 = security_ "X25519KeyAgreementKey2019" ;;
let allowedAction = security_ "allowedAction" ;;
let blockchainAccountId = security_ "blockchainAccountId" ;;
let canonicalizationAlgorithm = security_ "canonicalizationAlgorithm" ;;
let capabilityAction = security_ "capabilityAction" ;;
let capabilityChain = security_ "capabilityChain" ;;
let caveat = security_ "caveat" ;;
let challenge = security_ "challenge" ;;
let cipherAlgorithm = security_ "cipherAlgorithm" ;;
let cipherData = security_ "cipherData" ;;
let cipherKey = security_ "cipherKey" ;;
let controller = security_ "controller" ;;
let cryptosuite = security_ "cryptosuite" ;;
let delegator = security_ "delegator" ;;
let digestAlgorithm = security_ "digestAlgorithm" ;;
let digestValue = security_ "digestValue" ;;
let domain = security_ "domain" ;;
let ethereumAddress = security_ "ethereumAddress" ;;
let expirationDate = security_ "expirationDate" ;;
let expires = security_ "expires" ;;
let initializationVector = security_ "initializationVector" ;;
let invocationTarget = security_ "invocationTarget" ;;
let invoker = security_ "invoker" ;;
let jws = security_ "jws" ;;
let nonce = security_ "nonce" ;;
let owner = security_ "owner" ;;
let password = security_ "password" ;;
let privateKeyPem = security_ "privateKeyPem" ;;
let proofPurpose = security_ "proofPurpose" ;;
let proofValue = security_ "proofValue" ;;
let publicKey = security_ "publicKey" ;;
let publicKeyBase58 = security_ "publicKeyBase58" ;;
let publicKeyHex = security_ "publicKeyHex" ;;
let publicKeyJwk = security_ "publicKeyJwk" ;;
let publicKeyMultibase = security_ "publicKeyMultibase" ;;
let publicKeyPem = security_ "publicKeyPem" ;;
let publicKeyService = security_ "publicKeyService" ;;
let revoked = security_ "revoked" ;;
let service = security_ "service" ;;
let serviceEndpoint = security_ "serviceEndpoint" ;;
let signature = security_ "signature" ;;
let signatureAlgorithm = security_ "signatureAlgorithm" ;;
let signatureValue = security_ "signatureValue" ;;
let x509CertificateChain = security_ "x509CertificateChain" ;;
let x509CertificateFingerprint = security_ "x509CertificateFingerprint" ;;

module Open = struct
  let security_c_BbsBlsSignature2020 = c_BbsBlsSignature2020
  let security_c_BbsBlsSignatureProof2020 = c_BbsBlsSignatureProof2020
  let security_c_Bls12381G1Key2020 = c_Bls12381G1Key2020
  let security_c_Bls12381G2Key2020 = c_Bls12381G2Key2020
  let security_c_DataIntegrityProof = c_DataIntegrityProof
  let security_c_Digest = c_Digest
  let security_c_EcdsaSecp256k1RecoveryMethod2020 = c_EcdsaSecp256k1RecoveryMethod2020
  let security_c_EcdsaSecp256k1RecoverySignature2020 = c_EcdsaSecp256k1RecoverySignature2020
  let security_c_EcdsaSecp256k1Signature2019 = c_EcdsaSecp256k1Signature2019
  let security_c_EcdsaSecp256k1Signature2020 = c_EcdsaSecp256k1Signature2020
  let security_c_EcdsaSecp256k1VerificationKey2019 = c_EcdsaSecp256k1VerificationKey2019
  let security_c_Ed25519Signature2020 = c_Ed25519Signature2020
  let security_c_Ed25519VerificationKey2018 = c_Ed25519VerificationKey2018
  let security_c_Ed25519VerificationKey2020 = c_Ed25519VerificationKey2020
  let security_c_EncryptedMessage = c_EncryptedMessage
  let security_c_GraphSignature2012 = c_GraphSignature2012
  let security_c_JsonWebKey2020 = c_JsonWebKey2020
  let security_c_JsonWebSignature2020 = c_JsonWebSignature2020
  let security_c_Key = c_Key
  let security_c_LinkedDataSignature2015 = c_LinkedDataSignature2015
  let security_c_LinkedDataSignature2016 = c_LinkedDataSignature2016
  let security_c_MerkleProof2019 = c_MerkleProof2019
  let security_c_Multikey = c_Multikey
  let security_c_Proof = c_Proof
  let security_c_ProofGraph = c_ProofGraph
  let security_c_RsaSignature2018 = c_RsaSignature2018
  let security_c_RsaVerificationKey2018 = c_RsaVerificationKey2018
  let security_c_SchnorrSecp256k1Signature2019 = c_SchnorrSecp256k1Signature2019
  let security_c_SchnorrSecp256k1VerificationKey2019 = c_SchnorrSecp256k1VerificationKey2019
  let security_c_ServiceEndpointProxyService = c_ServiceEndpointProxyService
  let security_c_Signature = c_Signature
  let security_c_SignatureGraph = c_SignatureGraph
  let security_c_VerificationMethod = c_VerificationMethod
  let security_c_X25519KeyAgreementKey2019 = c_X25519KeyAgreementKey2019
  let security_allowedAction = allowedAction
  let security_blockchainAccountId = blockchainAccountId
  let security_canonicalizationAlgorithm = canonicalizationAlgorithm
  let security_capabilityAction = capabilityAction
  let security_capabilityChain = capabilityChain
  let security_caveat = caveat
  let security_challenge = challenge
  let security_cipherAlgorithm = cipherAlgorithm
  let security_cipherData = cipherData
  let security_cipherKey = cipherKey
  let security_controller = controller
  let security_cryptosuite = cryptosuite
  let security_delegator = delegator
  let security_digestAlgorithm = digestAlgorithm
  let security_digestValue = digestValue
  let security_domain = domain
  let security_ethereumAddress = ethereumAddress
  let security_expirationDate = expirationDate
  let security_expires = expires
  let security_initializationVector = initializationVector
  let security_invocationTarget = invocationTarget
  let security_invoker = invoker
  let security_jws = jws
  let security_nonce = nonce
  let security_owner = owner
  let security_password = password
  let security_privateKeyPem = privateKeyPem
  let security_proofPurpose = proofPurpose
  let security_proofValue = proofValue
  let security_publicKey = publicKey
  let security_publicKeyBase58 = publicKeyBase58
  let security_publicKeyHex = publicKeyHex
  let security_publicKeyJwk = publicKeyJwk
  let security_publicKeyMultibase = publicKeyMultibase
  let security_publicKeyPem = publicKeyPem
  let security_publicKeyService = publicKeyService
  let security_revoked = revoked
  let security_service = service
  let security_serviceEndpoint = serviceEndpoint
  let security_signature = signature
  let security_signatureAlgorithm = signatureAlgorithm
  let security_signatureValue = signatureValue
  let security_x509CertificateChain = x509CertificateChain
  let security_x509CertificateFingerprint = x509CertificateFingerprint
end

class from ?sub g =
  let sub = match sub with None -> Term.Iri (g.Graph.name()) | Some t -> t in
  object(self)
  method allowedAction = g.Graph.objects_of ~sub ~pred: allowedAction
  method allowedAction_opt = match self#allowedAction with [] -> None | x::_ -> Some x
  method allowedAction_iris = Graph.only_iris (self#allowedAction)
  method allowedAction_opt_iri = match self#allowedAction_iris with [] -> None | x::_ -> Some x
  method blockchainAccountId = Graph.literal_objects_of g ~sub ~pred: blockchainAccountId
  method blockchainAccountId_opt = match self#blockchainAccountId with [] -> None | x::_ -> Some x
  method canonicalizationAlgorithm = g.Graph.objects_of ~sub ~pred: canonicalizationAlgorithm
  method canonicalizationAlgorithm_opt = match self#canonicalizationAlgorithm with [] -> None | x::_ -> Some x
  method canonicalizationAlgorithm_iris = Graph.only_iris (self#canonicalizationAlgorithm)
  method canonicalizationAlgorithm_opt_iri = match self#canonicalizationAlgorithm_iris with [] -> None | x::_ -> Some x
  method capabilityAction = g.Graph.objects_of ~sub ~pred: capabilityAction
  method capabilityAction_opt = match self#capabilityAction with [] -> None | x::_ -> Some x
  method capabilityAction_iris = Graph.only_iris (self#capabilityAction)
  method capabilityAction_opt_iri = match self#capabilityAction_iris with [] -> None | x::_ -> Some x
  method capabilityChain = g.Graph.objects_of ~sub ~pred: capabilityChain
  method capabilityChain_opt = match self#capabilityChain with [] -> None | x::_ -> Some x
  method capabilityChain_iris = Graph.only_iris (self#capabilityChain)
  method capabilityChain_opt_iri = match self#capabilityChain_iris with [] -> None | x::_ -> Some x
  method caveat = g.Graph.objects_of ~sub ~pred: caveat
  method caveat_opt = match self#caveat with [] -> None | x::_ -> Some x
  method caveat_iris = Graph.only_iris (self#caveat)
  method caveat_opt_iri = match self#caveat_iris with [] -> None | x::_ -> Some x
  method challenge = Graph.literal_objects_of g ~sub ~pred: challenge
  method challenge_opt = match self#challenge with [] -> None | x::_ -> Some x
  method cipherAlgorithm = Graph.literal_objects_of g ~sub ~pred: cipherAlgorithm
  method cipherAlgorithm_opt = match self#cipherAlgorithm with [] -> None | x::_ -> Some x
  method cipherData = Graph.literal_objects_of g ~sub ~pred: cipherData
  method cipherData_opt = match self#cipherData with [] -> None | x::_ -> Some x
  method cipherKey = Graph.literal_objects_of g ~sub ~pred: cipherKey
  method cipherKey_opt = match self#cipherKey with [] -> None | x::_ -> Some x
  method controller = g.Graph.objects_of ~sub ~pred: controller
  method controller_opt = match self#controller with [] -> None | x::_ -> Some x
  method controller_iris = Graph.only_iris (self#controller)
  method controller_opt_iri = match self#controller_iris with [] -> None | x::_ -> Some x
  method cryptosuite = Graph.literal_objects_of g ~sub ~pred: cryptosuite
  method cryptosuite_opt = match self#cryptosuite with [] -> None | x::_ -> Some x
  method delegator = g.Graph.objects_of ~sub ~pred: delegator
  method delegator_opt = match self#delegator with [] -> None | x::_ -> Some x
  method delegator_iris = Graph.only_iris (self#delegator)
  method delegator_opt_iri = match self#delegator_iris with [] -> None | x::_ -> Some x
  method digestAlgorithm = Graph.literal_objects_of g ~sub ~pred: digestAlgorithm
  method digestAlgorithm_opt = match self#digestAlgorithm with [] -> None | x::_ -> Some x
  method digestValue = Graph.literal_objects_of g ~sub ~pred: digestValue
  method digestValue_opt = match self#digestValue with [] -> None | x::_ -> Some x
  method domain = Graph.literal_objects_of g ~sub ~pred: domain
  method domain_opt = match self#domain with [] -> None | x::_ -> Some x
  method ethereumAddress = Graph.literal_objects_of g ~sub ~pred: ethereumAddress
  method ethereumAddress_opt = match self#ethereumAddress with [] -> None | x::_ -> Some x
  method expirationDate = g.Graph.objects_of ~sub ~pred: expirationDate
  method expirationDate_opt = match self#expirationDate with [] -> None | x::_ -> Some x
  method expirationDate_iris = Graph.only_iris (self#expirationDate)
  method expirationDate_opt_iri = match self#expirationDate_iris with [] -> None | x::_ -> Some x
  method expires = g.Graph.objects_of ~sub ~pred: expires
  method expires_opt = match self#expires with [] -> None | x::_ -> Some x
  method expires_iris = Graph.only_iris (self#expires)
  method expires_opt_iri = match self#expires_iris with [] -> None | x::_ -> Some x
  method initializationVector = Graph.literal_objects_of g ~sub ~pred: initializationVector
  method initializationVector_opt = match self#initializationVector with [] -> None | x::_ -> Some x
  method invocationTarget = g.Graph.objects_of ~sub ~pred: invocationTarget
  method invocationTarget_opt = match self#invocationTarget with [] -> None | x::_ -> Some x
  method invocationTarget_iris = Graph.only_iris (self#invocationTarget)
  method invocationTarget_opt_iri = match self#invocationTarget_iris with [] -> None | x::_ -> Some x
  method invoker = g.Graph.objects_of ~sub ~pred: invoker
  method invoker_opt = match self#invoker with [] -> None | x::_ -> Some x
  method invoker_iris = Graph.only_iris (self#invoker)
  method invoker_opt_iri = match self#invoker_iris with [] -> None | x::_ -> Some x
  method jws = g.Graph.objects_of ~sub ~pred: jws
  method jws_opt = match self#jws with [] -> None | x::_ -> Some x
  method jws_iris = Graph.only_iris (self#jws)
  method jws_opt_iri = match self#jws_iris with [] -> None | x::_ -> Some x
  method nonce = Graph.literal_objects_of g ~sub ~pred: nonce
  method nonce_opt = match self#nonce with [] -> None | x::_ -> Some x
  method owner = g.Graph.objects_of ~sub ~pred: owner
  method owner_opt = match self#owner with [] -> None | x::_ -> Some x
  method owner_iris = Graph.only_iris (self#owner)
  method owner_opt_iri = match self#owner_iris with [] -> None | x::_ -> Some x
  method password = Graph.literal_objects_of g ~sub ~pred: password
  method password_opt = match self#password with [] -> None | x::_ -> Some x
  method privateKeyPem = Graph.literal_objects_of g ~sub ~pred: privateKeyPem
  method privateKeyPem_opt = match self#privateKeyPem with [] -> None | x::_ -> Some x
  method proofPurpose = Graph.literal_objects_of g ~sub ~pred: proofPurpose
  method proofPurpose_opt = match self#proofPurpose with [] -> None | x::_ -> Some x
  method proofValue = Graph.literal_objects_of g ~sub ~pred: proofValue
  method proofValue_opt = match self#proofValue with [] -> None | x::_ -> Some x
  method publicKey = g.Graph.objects_of ~sub ~pred: publicKey
  method publicKey_opt = match self#publicKey with [] -> None | x::_ -> Some x
  method publicKey_iris = Graph.only_iris (self#publicKey)
  method publicKey_opt_iri = match self#publicKey_iris with [] -> None | x::_ -> Some x
  method publicKeyBase58 = Graph.literal_objects_of g ~sub ~pred: publicKeyBase58
  method publicKeyBase58_opt = match self#publicKeyBase58 with [] -> None | x::_ -> Some x
  method publicKeyHex = Graph.literal_objects_of g ~sub ~pred: publicKeyHex
  method publicKeyHex_opt = match self#publicKeyHex with [] -> None | x::_ -> Some x
  method publicKeyJwk = Graph.literal_objects_of g ~sub ~pred: publicKeyJwk
  method publicKeyJwk_opt = match self#publicKeyJwk with [] -> None | x::_ -> Some x
  method publicKeyMultibase = Graph.literal_objects_of g ~sub ~pred: publicKeyMultibase
  method publicKeyMultibase_opt = match self#publicKeyMultibase with [] -> None | x::_ -> Some x
  method publicKeyPem = Graph.literal_objects_of g ~sub ~pred: publicKeyPem
  method publicKeyPem_opt = match self#publicKeyPem with [] -> None | x::_ -> Some x
  method publicKeyService = g.Graph.objects_of ~sub ~pred: publicKeyService
  method publicKeyService_opt = match self#publicKeyService with [] -> None | x::_ -> Some x
  method publicKeyService_iris = Graph.only_iris (self#publicKeyService)
  method publicKeyService_opt_iri = match self#publicKeyService_iris with [] -> None | x::_ -> Some x
  method revoked = g.Graph.objects_of ~sub ~pred: revoked
  method revoked_opt = match self#revoked with [] -> None | x::_ -> Some x
  method revoked_iris = Graph.only_iris (self#revoked)
  method revoked_opt_iri = match self#revoked_iris with [] -> None | x::_ -> Some x
  method service = g.Graph.objects_of ~sub ~pred: service
  method service_opt = match self#service with [] -> None | x::_ -> Some x
  method service_iris = Graph.only_iris (self#service)
  method service_opt_iri = match self#service_iris with [] -> None | x::_ -> Some x
  method serviceEndpoint = g.Graph.objects_of ~sub ~pred: serviceEndpoint
  method serviceEndpoint_opt = match self#serviceEndpoint with [] -> None | x::_ -> Some x
  method serviceEndpoint_iris = Graph.only_iris (self#serviceEndpoint)
  method serviceEndpoint_opt_iri = match self#serviceEndpoint_iris with [] -> None | x::_ -> Some x
  method signature = g.Graph.objects_of ~sub ~pred: signature
  method signature_opt = match self#signature with [] -> None | x::_ -> Some x
  method signature_iris = Graph.only_iris (self#signature)
  method signature_opt_iri = match self#signature_iris with [] -> None | x::_ -> Some x
  method signatureAlgorithm = g.Graph.objects_of ~sub ~pred: signatureAlgorithm
  method signatureAlgorithm_opt = match self#signatureAlgorithm with [] -> None | x::_ -> Some x
  method signatureAlgorithm_iris = Graph.only_iris (self#signatureAlgorithm)
  method signatureAlgorithm_opt_iri = match self#signatureAlgorithm_iris with [] -> None | x::_ -> Some x
  method signatureValue = Graph.literal_objects_of g ~sub ~pred: signatureValue
  method signatureValue_opt = match self#signatureValue with [] -> None | x::_ -> Some x
  method x509CertificateChain = g.Graph.objects_of ~sub ~pred: x509CertificateChain
  method x509CertificateChain_opt = match self#x509CertificateChain with [] -> None | x::_ -> Some x
  method x509CertificateChain_iris = Graph.only_iris (self#x509CertificateChain)
  method x509CertificateChain_opt_iri = match self#x509CertificateChain_iris with [] -> None | x::_ -> Some x
  method x509CertificateFingerprint = g.Graph.objects_of ~sub ~pred: x509CertificateFingerprint
  method x509CertificateFingerprint_opt = match self#x509CertificateFingerprint with [] -> None | x::_ -> Some x
  method x509CertificateFingerprint_iris = Graph.only_iris (self#x509CertificateFingerprint)
  method x509CertificateFingerprint_opt_iri = match self#x509CertificateFingerprint_iris with [] -> None | x::_ -> Some x
  end
