public void AddRelsExtMetaData(RelationshipMetadata relsMetadata) { _contentFactory.AddMetadataDatastream("RELS-EXT", "RDF Statements about this object", relsMetadata, "application/rdf+xml"); }
protected void AddNonContentStreams(string label, string parentID, string mimeType, string objectPID, string documentAuthor) { //Get date DateTime dt = DateTime.Now; string timestamp = String.Format("{0:yy-MM-dd}", dt); //Set Metadata datastream "DC" with some basic meta _contentFactory.AddMetadataDatastream("DC", "Dublin Core Metadata", BuildSomeDC(label, "", "", "", documentAuthor, timestamp, "", mimeType, objectPID, "en", "", "", "", "", ""), "text/xml"); //Create the relationship metadata RelationshipMetadata relsMetadata = new RelationshipMetadata(objectPID); relsMetadata.AddRelationship(relsMetadata.HAS_MODEL_REL, "hydra-cModel:commonMetadata"); relsMetadata.AddRelationship(relsMetadata.HAS_MODEL_REL, "hydra-cModel:genericContent"); relsMetadata.IsCollection = false; //Set parentID if its defined... if (parentID != null) { relsMetadata.AddRelationship(relsMetadata.IS_MEMBER_REL, parentID); } //Add relationship metadata to the Object... _contentFactory.AddMetadataDatastream("RELS-EXT", "RDF Statements about this object", relsMetadata, "application/rdf+xml"); //Set the content datastream with the content //Creates some sample DC - ***Need a MODS editor - Object model for insertion into objects*** string descMetadata = BuildSomeDC(label, "", "", "", documentAuthor, timestamp, "", "text/xml", objectPID, "en", "", "", "", "", "").Xml.ToString(); //Creates a 'ManagedContentDatastream' for the descMetadata, using the sample DC created above _contentFactory.AddManagedContentDatastream("descMetadata", "MODS metadata", "text/xml", 0, System.Text.Encoding.ASCII.GetBytes(descMetadata)); // Creates a contentMetadata datastream... _contentFactory.AddManagedContentDatastream("contentMetadata", "Content metadata", "text/xml", 0, System.Text.Encoding.ASCII.GetBytes("<adminMetadata />")); // Creates a rightsMetadata datastream... _contentFactory.AddManagedContentDatastream("rightsMetadata", "Rights metadata", "text/xml", 0, System.Text.Encoding.ASCII.GetBytes("<rightsMetadata />")); }
/// <summary> /// Adds some very basic RDF parent child metadata /// </summary> /// <param name="parentID"></param> public void AddRelsExtMetaData(string parentID) { //Create the relationship metadata RelationshipMetadata relsMetadata = new RelationshipMetadata(_objectPID); relsMetadata.AddRelationship(relsMetadata.HAS_MODEL_REL, "hydra-cModel:commonMetadata"); relsMetadata.AddRelationship(relsMetadata.HAS_MODEL_REL, "hydra-cModel:genericContent"); relsMetadata.IsCollection = false; //Set parentID if its defined... if (parentID != null) { relsMetadata.AddRelationship(relsMetadata.IS_MEMBER_REL, parentID); } //Add relationship metadata to the Object... _contentFactory.AddMetadataDatastream("RELS-EXT", "RDF Statements about this object", relsMetadata, "application/rdf+xml"); }
/// <summary> /// <para>This method will create an Hydra 'Implicit set object' with a fized (Singleton PID), and add three metadata datastreams:- /// - descMetadata (for descriptive metadata) - Hydra suggests MODS XML /// - contentMetadata (for content specific metadata) /// - rightsMetadata (for rights specific metadata) - Loosely based on METS /// </para> /// <para>For content model info - See http://www.fedora-commons.org/confluence/display/hydra/Hydra+content+models+and+disseminators</para> /// <para>This method needs to be expanded to allow the setting of the metadata datastreams</para> /// </summary> /// <param name="nameSpace">Object namespace</param> /// <param name="label">Object label</param> /// <param name="parentID">Object parent (if it's a sub-set)</param> public string DepositSingletonSet(string nameSpace, string label, string parentID) { string objectPID = string.Empty; //Create a fedoraManagement client _fedoraManagement = new FedoraManagementSOAPImpl(_fedoraServer); //--------------------------------------------------// // Modified By Suresh Thampi on 04/01/2011 if (_objectPID == string.Empty) { //objectPID = nameSpace + ":1"; objectPID = GetNextPID(nameSpace); } else { objectPID = _objectPID; } //--------------------------------------------------// //Use the content factory to create a new object ContentFactory contentFactory = new ContentFactory(objectPID, label, "A", "fedoraAdmin"); DateTime dt = DateTime.Now; string timestamp = String.Format("{0:yy-MM-dd}", dt); //Create a basic DC Datastream contentFactory.AddMetadataDatastream("DC", "Dublin Core Metadata", BuildSomeDC(label, "", "", "", "fedoraAdmin", timestamp, "", "text/xml", objectPID, "en", "", "", "", "", ""), "text/xml"); //Create the RELS-EXT XML, this contains the content model membership relationships etc... RelationshipMetadata relsMetadata = new RelationshipMetadata(objectPID); relsMetadata.AddRelationship(relsMetadata.HAS_MODEL_REL, "hydra-cModel:implicitSet"); relsMetadata.AddRelationship(relsMetadata.HAS_MODEL_REL, "hydra-cModel:commonMetadata"); relsMetadata.IsCollection = true; //Set parentID if its defined... if (parentID != null) { relsMetadata.AddRelationship(relsMetadata.IS_MEMBER_REL, parentID); } //Creates the metadata datastream with the RelationshipsMetadata object created above contentFactory.AddMetadataDatastream("RELS-EXT", "RDF Statements about this object", relsMetadata, "application/rdf+xml"); //Creates some sample DC - ***Need a MODS editor - Object model for insertion into objects*** string descMetadata = BuildSomeDC(label, "", "", "", "fedoraAdmin", timestamp, "", "text/xml", objectPID, "en", "", "", "", "", "").Xml.ToString(); //Creates a 'ManagedContentDatastream' for the descMetadata, using the sample DC created above contentFactory.AddManagedContentDatastream("descMetadata", "Descriptive metadata", "text/xml", 0, System.Text.Encoding.ASCII.GetBytes(descMetadata)); // Creates a contentMetadata datastream... contentFactory.AddManagedContentDatastream("contentMetadata", "Content metadata", "text/xml", 0, System.Text.Encoding.ASCII.GetBytes("<adminMetadata />")); // Creates a rightsMetadata datastream... contentFactory.AddManagedContentDatastream("rightsMetadata", "Rights metadata", "text/xml", 0, System.Text.Encoding.ASCII.GetBytes("<rightsMetadata />")); //Once we have added all the datastreams, we can use the contentFactory.getContentAsByteArray() to get Byte[] rep of the FOXML object byte[] objectXML = contentFactory.GetContentAsByteArray(); using (OperationContextScope scope = new OperationContextScope(_fedoraManagement.FedoraManagementProxy.InnerChannel)) { try { _fedoraManagement.ingest(objectXML, "info:fedora/fedora-system:FOXML-1.0", "Ingested by the .net hydra client", scope); //Ingests into Fedora instance } catch (Exception ex) { if (!ex.Message.Contains("ObjectExistsException")) throw ex; } } return objectPID; }