12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364(*********************************************************************************)(* OCaml-RDF *)(* *)(* Copyright (C) 2012-2021 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 *)(* *)(*********************************************************************************)(** *)moduleIrimap=Iri.MapmoduleIriset=Iri.SetexceptionCould_not_retrieve_graphofIri.t*stringlet()=Printexc.register_printer(function|Could_not_retrieve_graph(iri,s)->Some(Printf.sprintf"Could not retrieve graph %s: %s"(Iri.to_stringiri)s)|_->None)letcould_not_retrieve_graphirimsg=raise(Could_not_retrieve_graph(iri,msg));;typedataset={default:Graph.graph;named:Iriset.t;get_named:Iri.t->Graph.graph;}letsimple_dataset?(named=[])default=letnamed_set=List.fold_left(funset(iri,_)->Iriset.addiriset)Iriset.emptynamedinletnamed=List.fold_left(funmap(iri,g)->Irimap.addirigmap)Irimap.emptynamedinletget_namediri=tryIrimap.findirinamedwithNot_found->could_not_retrieve_graphiri("Unknown graph "^(Iri.to_stringiri))in{default;named=named_set;get_named};;letdataset?get_named?(named=Iriset.empty)default=matchget_namedwithNone->simple_datasetdefault|Someget_named->{default;named;get_named};;