Public:Bwmeta service/Tutorial

From YaddaWiki

(Difference between revisions)
Jump to: navigation, search
Line 26: Line 26:
Name with type canonical for article is a main title. Additionally for article we could set sub and super title etc...  
Name with type canonical for article is a main title. Additionally for article we could set sub and super title etc...  
-
 
+
For defining keywords and setting unknown categorizations YTagList should be used.
-
 
+
              
              
             YTagList slowaKluczoweMim=new YTagList();
             YTagList slowaKluczoweMim=new YTagList();

Revision as of 17:03, 27 February 2013

Service details
NameBWmeta
Code location
(relative to SVN root)
projects/dir/bwmeta-core
Javadoc
Contact personJakub Jurkiewicz

This page describes how to create completly new bwmeta docuemnt using Y model. Docuemnt described in this example describes some article.

After setting all libraries, getting all imports, let's first create the new Empty YElement.

		YElement article = new YElement(); 

Elements are used for all bliographic objects - books, chapters, articles, journals etc...

When we got article let's assign id to it:

           article.setId("bwmeta1.element.element-form-pubmed-0000"/*PBMID*/+"22222");

Ids should be unique. They should be recognized by regexp: [A-Za-z0-9_./:@\-]+ Current practices applying to id are described here.


After setting id lets set title of article. For describing titles we use YName.

			 YName nam=new YName();
             nam.setText("Tytuł artykułu");
            nam.setLanguage(YLanguage.English);
             nam.setType(YConstants.NM_CANONICAL);
//            nam.setType(YConstants.NM_SUBTITLE);
            article.addName(nam);
              

Name with type canonical for article is a main title. Additionally for article we could set sub and super title etc...

For defining keywords and setting unknown categorizations YTagList should be used.

           YTagList slowaKluczoweMim=new YTagList();
           slowaKluczoweMim.setType("slowa_kluczowe_mim");
           slowaKluczoweMim.setType(YConstants.TG_KEYWORD);
           slowaKluczoweMim.setLanguage(YLanguage.Polish);
           slowaKluczoweMim.addValue("ala");
           slowaKluczoweMim.setValues(null);
          
           
           article.addCategoryRef(new YCategoryRef(YConstants.EXT_CLASSIFICATION_MSC_2010, "67.23.+"));
           
           YAffiliation aff=new YAffiliation("aff1", "Uniwesytet Rzeszowski");
           aff.setText("Uniwesrystet Rzeszowski");
           
           YContributor aut1=new YContributor(YConstants.CR_AUTHOR, false);
           aut1.addAffiliationRef("aff1");
           aut1.setRole(YConstants.CR_AUTHOR);
           aut1.addName(new YName(YLanguage.Undetermined, "A.G. Drag",YConstants.NM_CANONICAL));
           aut1.addName(new YName(YLanguage.Undetermined, "A. G.", YConstants.NM_FORENAMES));
           aut1.addName(new YName(YLanguage.Undetermined, "Drag", YConstants.NM_SURNAME));
           aut1.setIdentity("bwmeta1.person.person-000001"); 
           
       /** Z boku osoba */    
           YPerson per=new YPerson();
           per.setId("bwmeta1.person.person-000001");
           per.addName(new YName(YLanguage.Undetermined, "Aleksandra Genofewa", YConstants.NM_FORENAMES));
           per.addName(new YName(YLanguage.Undetermined, "Drag-Kowalska", YConstants.NM_SURNAME));
         
           article.addDescription(new YDescription(YLanguage.English, "yadda yadda  ", YConstants.DS_ABSTRACT));
           article.addDescription(new YDescription(YLanguage.English, "yadda yadda  ", YConstants.DS_SUMMARY));
           
           
           YRelation rel=new YRelation();
           rel.setType(YConstants.RL_REFERENCE_TO);
           rel.setTarget(new YId(YConstants.EXT_SCHEME_YADDA, "bwmeta1.element.element-docelowy-rel1"));
           rel.addAttribute(YConstants.AT_REFERENCE_TEXT, "text referencji 1");
           article.addRelation(rel);
           
           YStructure struct=new YStructure(YConstants.EXT_HIERARCHY_JOURNAL);
           
           YAncestor anc=new YAncestor(YConstants.EXT_LEVEL_JOURNAL_JOURNAL);
       //    anc.setIdentity("bwmeta1.element.journal-issn-00000032324");
  
           anc.addName(new YName(YLanguage.English,"Journal of bibliography learning",YConstants.NM_CANONICAL));
           struct.addAncestor(anc);
           
           YAncestor anc2=new YAncestor(YConstants.EXT_LEVEL_JOURNAL_YEAR);
           //    anc2.setIdentity("bwmeta1.element.year-00000032324-2000");
  
           anc2.addName(new YName("2000"));
           struct.addAncestor(anc2);
           
           
           YCurrent current=new YCurrent(YConstants.EXT_LEVEL_JOURNAL_ARTICLE);
           current.setPosition("p.1-20");
           struct.setCurrent(current);
           
           article.addStructure(struct);
           
          
           // jak zapisać  alternatywnie dla potrzbe przyszłego przetwarzania
           YAttribute st=new YAttribute("SOURCE", "JOU. B. LEARN.");            
           article.addAttribute(st);
           
           YDate dat=new YDate(YConstants.DT_PUBLISHED, 2000, 1, 12, "druga połowa XX wieku");
           article.addDate(dat);
Personal tools