Advertisement
Mitko_jos

za Filip vbs lab1 od 15 do 17

Oct 25th, 2015
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. //od 15 do 17
  2.  
  3. static final String inputFileName = "C:\\Users\\Mitko\\Documents\\lab1_vbs\\mitko2.xml";
  4. static String MitkoJosifoskiUri="http://somewhere/MitkoJosifoski";
  5. public static void main(String[] args) {
  6.  
  7. Model model = ModelFactory.createDefaultModel();
  8.  
  9. InputStream in = FileManager.get().open( inputFileName );
  10. if (in == null) {
  11. throw new IllegalArgumentException( "File: " + inputFileName + " not found");
  12. }
  13.  
  14. model.read(in, "", "RDF/XML");
  15.  
  16.  
  17. Resource vcard = model.getResource(MitkoJosifoskiUri);
  18.  
  19.  
  20. Resource name = (Resource) vcard.getRequiredProperty(VCARD.N)
  21. .getObject();
  22.  
  23. String fullName = vcard.getRequiredProperty(VCARD.FN)
  24. .getString();
  25.  
  26. vcard.addProperty(VCARD.NICKNAME, "Mitce")
  27. .addProperty(VCARD.NICKNAME, "Mite");
  28.  
  29.  
  30. System.out.println("The nicknames of \"" + fullName + "\" are:");
  31.  
  32. StmtIterator iter = vcard.listProperties(VCARD.NICKNAME);
  33. while (iter.hasNext()) {
  34. System.out.println(" " + iter.nextStatement().getObject()
  35. .toString());
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement