private static void ShowCreatedMetadata(PhaidraAttribute attribute, Dictionary <string, string> values) { PhaidraFile phaidraFile = new PhaidraFile(); attribute.WriteAttributeContent(phaidraFile, values); Console.WriteLine($"Attribute {attribute.Name}:"); Console.WriteLine(phaidraFile.Metadata.ToString()); }
private void AddMapping(PhaidraAttribute phaidraAttribute) { //if (phaidraAttribute.OnlyOneAllowed) //{ // if (Mappings.Any(i => i.PhaidraAttribute == phaidraAttribute)) // { // return; // } // PhaidraAttributes.Remove(phaidraAttribute); //} //Mappings.Add(new PhaidraMapping //{ // PhaidraAttribute = phaidraAttribute, // PhaidraAttributeFields2CsvColumns = new ObservableCollection<PhaidraAttributeField2CsvColumn>(phaidraAttribute.Fields.Select(field => new PhaidraAttributeField2CsvColumn() { Field = field, SelectedCsvColumn = CsvColumn.Empty }).ToList()) //}); }
private static void TemplateAttributeTest() { var templateAttributes = PhaidraAttribute.GetTemplatePhaidraAttributes(); foreach (var attribute in templateAttributes) { switch (attribute.Predicate) { case "dcterms:created": { ShowCreatedMetadata(attribute, new Dictionary <string, string> { { "Date", "2020" } }); } break; case "role:aut": { /* + [0] {[Nachname, Nachname]} System.Collections.Generic.KeyValuePair<string, string> + [1] {[Vorname, Vorname]} System.Collections.Generic.KeyValuePair<string, string> + [2] {[Wikidata-ID, Wikidata-ID]} System.Collections.Generic.KeyValuePair<string, string> + [3] {[Affiliation, Affiliation]} System.Collections.Generic.KeyValuePair<string, string> */ ShowCreatedMetadata(attribute, new Dictionary <string, string> { { "Vorname", "Wolfgang Amadeus" }, { "Nachname", "Mozart" }, { "Wikidata-ID", "Q254" }, { "Affiliation", "Institut für Kunstgeschichte" }, { "Bla", "Institut für Kunstgeschichte" }, }); ShowCreatedMetadata(attribute, new Dictionary <string, string> { { "Vorname", "Wolfgang Amadeus" }, }); ShowCreatedMetadata(attribute, new Dictionary <string, string> { { "Nachname", "Mozart" }, }); ShowCreatedMetadata(attribute, new Dictionary <string, string> { { "Wikidata-ID", "Q254" }, }); ShowCreatedMetadata(attribute, new Dictionary <string, string> { { "Affiliation", "Institut für Kunstgeschichte" }, }); ShowCreatedMetadata(attribute, new Dictionary <string, string> { { "Vorname", "Wolfgang Amadeus" }, { "Nachname", "Mozart" }, }); ShowCreatedMetadata(attribute, new Dictionary <string, string> { { "Vorname", "Wolfgang Amadeus" }, { "Nachname", "Mozart" }, { "Wikidata-ID", "Q254" }, }); } break; case "dce:title": { ShowCreatedMetadata(attribute, new Dictionary <string, string> { { "Haupttitel", "test-titel" } }); ShowCreatedMetadata(attribute, new Dictionary <string, string> { { "Haupttitel", "test-titel2" }, { "Untertitel", "test-titel2" } }); ShowCreatedMetadata(attribute, new Dictionary <string, string> { { "Untertitel", "sub-test-titel" } }); } break; } } }
public MappingsViewModel(Dictionary <int, string> headers, List <Dictionary <int, string> > rows, string rootDir) { _headers = headers; _rows = rows; _rootDir = rootDir; _currentRowIndex = 0; AddMappingCommand = new Command(AddMappingExecute, AddMappingCanExecute); DeleteSelectedMappingCommand = new Command(RemoveSelectedMappingExecute, RemoveSelectedMappingCanExecute); OKCommand = new Command(OKExecute); ResetMappingsCommand = new Command(ResetMappingsExecute); PreviousRowCommand = new Command(PreviousRowExecute, PreviousRowCanExecute); NextRowCommand = new Command(NextRowExecute, NextRowCanExecute); SelectPhaidraAttributeFieldCommand = new Command(SelectPhaidraAttributeFieldExecute, SelectPhaidraAttributeFieldCanExecute); DuplicateCsvColumnCommand = new Command(DuplicateCsvColumnExecute); DebugCommand = new Command(DebugExecute); CsvColumns = new ObservableCollection <CsvColumn>(); PhaidraAttributes = new ObservableCollection <PhaidraAttribute>(); //Mappings = new ObservableCollection<PhaidraMapping>(); Mappings2 = new ObservableCollection <PhaidraAttributeField2CsvColumn2>(); PhaidraAttributeFields = new ObservableCollection <PhaidraAttributeField>(); SelectedMappingPhaidraAttributesField2CsvColumns = new ObservableCollection <PhaidraAttributeField2CsvColumn>(); CsvColumns.Add(CsvColumn.Empty); foreach (var header in _headers) { CsvColumns.Add(new CsvColumn { Name = header.Value, Header = header }); } SetCsvColumnValues(); var attributes = PhaidraAttribute.GetPhaidraAttributes(); var attributeFields = new List <PhaidraAttributeField>(); attributeFields.Add(PhaidraAttributeField.Empty); foreach (var attribute in attributes) { PhaidraAttributes.Add(attribute); var set = new PhaidraMetadataSet(); //marks belonging fields (used when duplicating field sets) foreach (var field in attribute.Fields) { attributeFields.Add(new PhaidraAttributeField() { PhaidraAttribute = attribute, Field = field, Set = set }); } } foreach (var attributeField in attributeFields.OrderBy(i => i.DisplayName)) { PhaidraAttributeFields.Add(attributeField); } //PhaidraAttributes.Add(new FilenamePhaidraAttribute()); //PhaidraAttributes.Add(new CollectionPhaidraAttribute()); //PhaidraAttributes.Add(new AssociationPhaidraAttribute()); //PhaidraAttributes.Add(new AccessRestrictionPhaidraAttribute()); //PhaidraAttributes.Add(new TitlePhaidraAttribute()); //PhaidraAttributes.Add(new DescriptionPhaidraAttribute()); //PhaidraAttributes.Add(new DateArrayPhaidraAttribute("Creation date", "Creation date", "dcterms:created")); //PhaidraAttributes.Add(new DateArrayPhaidraAttribute("Date of production", "Date of production", "rdau:P60071")); //PhaidraAttributes.Add(new RolePhaidraAttribute("Photographer", "role:pht")); //PhaidraAttributes.Add(new RolePhaidraAttribute("Author", "role:aut")); ResetMappings(); }