--- /dev/null
+(* Copyright (C) 2000, HELM Team.
+ *
+ * This file is part of HELM, an Hypertextual, Electronic
+ * Library of Mathematics, developed at the Computer Science
+ * Department, University of Bologna, Italy.
+ *
+ * HELM is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * HELM 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 HELM; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA.
+ *
+ * For details, see the HELM World-Wide-Web page,
+ * http://cs.unibo.it/helm/.
+ *)
+
+(*
+ *
+ *)
+
+open MathQL;;
+
+(*
+ * implementazione della funzione NAME
+ *
+ * esempio:
+ * name "cic:/Algebra/CC_Props/CC_CauchySeq.ind#xpointer(1/1/1)" = CC_CauchySeq
+ *)
+let func_name value =
+ try (
+ let i = Str.search_forward (Str.regexp "[^/]*\.") value 0 in
+ let s = Str.matched_string value in
+ let retVal = Str.string_before s ((String.length s) - 1) in
+ retVal
+ ) with
+ Not_found -> ""
+;;
+
+(*
+ *
+ *)
+let func_theory value =
+ ""
+;;
+
+(*
+ * implementazione delle funzioni dublin core
+ *)
+let func_dc (value, name) =
+ let pathv = ("\"" ^ "/home/lorenzo/helm/metadata/dc" ^ value ^ "\"") in
+ let xq ="namespace rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"
+ namespace rdfs=\"http://www.w3.org/2000/01/rdf-schema#\"
+ namespace dc=\"http://purl.org/metadata/dublin_core#\"
+ namespace dcq=\"http://purl.org/metadata/dublin_core_qualifiers#\"
+ namespace h=\"http:/www.cs.unibo.it/helm/schemas/schema-h.rdf#\"
+ namespace hth=\"http://www.cs.unibo.it/helm/schemas/schema-hth.rdf#\"
+
+ for $i in document(" ^ pathv ^ ")//rdf:RDF//h:DirectoryOfObjects
+ return $i//dc:" ^ name
+ in
+ let uril = Toputils.eval_query_string xq in (* e' una lista di liste di stringhe*)
+ let hd_uril = List.hd uril in (*prendo l'elemento in testa che e' quello che contiene la lista
+ di uri, IN REALTA' ORA CONTIENE ALTERNATIVAMENTE UN URI E LA SUA POSIZIONE!! *)
+ List.hd hd_uril
+
+
+
+(*print_string (( List.hd hd_uril) ^ "NEW!");
+ print_endline " [FINE]";*)
+
+
+
+ (*List.iter (List.iter print_string) uril;*)
+
+ ;;
+
+(*
+ *
+ *)
+let apply_func f value =
+ match f with
+ MQName -> func_name value
+ | MQTheory -> func_theory value
+ | MQTitle -> func_dc (value, "title")
+ | MQContributor -> func_dc (value, "contributor")
+ | MQCreator -> func_dc (value, "creator")
+ | MQPublisher -> func_dc (value, "publisher")
+ | MQSubject -> func_dc (value, "subject")
+ | MQDescription -> func_dc (value, "description")
+ | MQDate -> func_dc (value, "date")
+ | MQType -> func_dc (value, "type")
+ | MQFormat -> func_dc (value, "format")
+ | MQIdentifier -> func_dc (value, "identifier")
+ | MQLanguage -> func_dc (value, "language")
+ | MQRelation -> func_dc (value, "relation")
+ | MQSource -> func_dc (value, "source")
+ | MQCoverage -> func_dc (value, "coverage")
+ | MQRights -> func_dc (value, "rights")
+ | MQInstitution -> func_dc (value, "institution")
+ | MQContact -> func_dc (value, "contact")
+ | MQFirstVersion -> func_dc (value, "firstversion")
+ | MQModified -> func_dc (value, "modified")
+;;
+