Examples of Person


Examples of org.ontoware.semweb4j.lessons.lesson5.gen.Person

  }

  private static void run() throws ModelRuntimeException {
    // use the rdfs class Person from peopletag.rdfs.n3 here
    // via lesson5.gen package (generated by rdfreactor)
    Person max = new Person(model, "http://xam.de/foaf.rdf.xml#i");
    Person konrad = new Person(model);

    max.addName("Max Völkel");
    konrad.addName("Konrad Völkel");
    max.addKnows(konrad);

    Tag java = new Tag(model);
    Tag python = new Tag(model);
    java.addName("Java related");
    python.addName("Python related");
    python.addName("pythonic stuff");

    max.addTag(java);
    konrad.addTag(python);

    System.out.println("the instance model:");
    model.dump();
    System.out.println("-----------------\n\n");

    System.out.println("konrad's tags:");
    for (Tag tag : konrad.getAllTag()) {
      for (String name : tag.getAllName()) {
        System.out.println(name);
      }
    }
    System.out.println("-----------------\n\n");
View Full Code Here

Examples of org.openfriendsbudget.model.Person

     * Test of resolveBudget method, of class BudgetService.
     */
    public void testResolveBudget() {
        System.out.println("resolveBudget");
               
        Person p1 = new Person();
        p1.setAlias("p1");
        p1.setGivenname("p1");
        p1.setMail("p1@mail.com");
        p1.setSurname("p1");

        Person p2 = new Person();
        p2.setAlias("p2");
        p2.setGivenname("p2");
        p2.setMail("p2@mail.com");
        p2.setSurname("p2");

        Person p3 = new Person();
        p3.setAlias("p3");
        p3.setGivenname("p3");
        p3.setMail("p3@mail.com");
        p3.setSurname("p3");

        Person p4 = new Person();
        p4.setAlias("p4");
        p4.setGivenname("p4");
        p4.setMail("p4@mail.com");
        p4.setSurname("p4");


        Budget budget = new Budget();
        budget.setCurrency("euro");

        Map<String,Float> change = new HashMap<String,Float>(2);
        change.put("USD",(float)2.0);
        change.put("YEN",(float)4.0);
        budget.setChange(change);

        budget.addPerson(p1);
        budget.addPerson(p2);
        budget.addPerson(p3);
        budget.addPerson(p4);

        Expenditure exp1 = new Expenditure();
        exp1.setOwner(p1);
        exp1.addRecipient(p1, 1); // p1 : 0
        exp1.addRecipient(p2, 2); // p2 : -200 / p1 : +200
        exp1.setAmount(300);

        Expenditure exp2 = new Expenditure();
        exp2.setOwner(p3);
        exp2.addRecipient(p2, 1); // p2 : -40 / p3 : + 40
        exp2.addRecipient(p3, 1); // p3 : 0
        exp2.setAmount(20); // 20 YEN * 4 = 80 EUR
        exp2.setCurrency("YEN");

        Expenditure exp3 = new Expenditure();
        exp3.setOwner(p1);
        exp3.addRecipient(p1, 1); // p1 : 0
        exp3.addRecipient(p2, 1); // p2 : -100 / p1 : +100
        exp3.addRecipient(p3, 1); // p3 : -100 / p1 : +100
        exp3.setAmount(300);

        Expenditure exp4 = new Expenditure();
        exp4.setOwner(p2);
        exp4.addRecipient(p2, 1); // p2 : 0
        exp4.addRecipient(p3, 1); // p3 : -100 / p2 : +100
        exp4.addRecipient(p1, 2); // p1 : -200 / p2 : +200
        exp4.setAmount(400);

        Expenditure exp5 = new Expenditure();
        exp5.setOwner(p4);
        exp5.addRecipient(p2, 1); // p2 : -50 / p4 : +50
        exp5.addRecipient(p1, 1); // p1 : -50 / p4 : +50
        exp5.addRecipient(p3, 1); // p3 : -50 / p4 : +50
        exp5.addRecipient(p4, 1); // p4 : 0
        exp5.setAmount(200);

        Expenditure exp6 = new Expenditure();
        exp6.setOwner(p3);
        exp6.addRecipient(p1, 2); // p1 : -80 / p3 : +80
        exp6.addRecipient(p4, 1); // p4 : -40 / p3 : +40
        exp6.setAmount(60);
        exp6.setCurrency("USD");


        // Total:
        // p1 : +70
        // p2 : -90
        // p3 : -90
        // p4 : +110
        try {

            budget.addExpenditure(exp1);
            budget.addExpenditure(exp2);
            budget.addExpenditure(exp3);
            budget.addExpenditure(exp4);
            budget.addExpenditure(exp5);
            budget.addExpenditure(exp6);

            BudgetService bs = new BudgetService(new AdjacencyMatrixGraphFactory());

            Graph graph = bs.resolveBudget(budget);
            assertEquals(graph.getVertexSet().size(), 4);

            Set<String> personIdSet = new HashSet<String>(4);
            personIdSet.add(p1.getId());
            personIdSet.add(p2.getId());
            personIdSet.add(p3.getId());
            personIdSet.add(p4.getId());

            for(Vertex vertex : graph.getVertexSet()) {
                assertTrue(personIdSet.contains(vertex.getId()));
                if(vertex.getId().equals(p1.getId())){
                    assertEquals(vertex.getDegree(),7000);
                }
                if(vertex.getId().equals(p2.getId())){
                    assertEquals(vertex.getDegree(),-9000);
                }
                if(vertex.getId().equals(p3.getId())){
                    assertEquals(vertex.getDegree(),-9000);
                }
                if(vertex.getId().equals(p4.getId())){
                    assertEquals(vertex.getDegree(),11000);
                }
                assertTrue(vertex.getId().equals(p1.getId())
                        || vertex.getId().equals(p2.getId())
                        || vertex.getId().equals(p3.getId())
                        || vertex.getId().equals(p4.getId()));
            }

           

        } catch (Exception e) {
View Full Code Here

Examples of org.openmrs.Person

   * @param post
   * @return
   */
  private Relationship createRelationshipFromPost(SimpleObject post) throws ResponseException {
    Relationship relationship = new Relationship();
    Person a, b;
    try {
      Method method = service.getClass().getMethod("getPersonByUuidSafeSearch", String.class);
      a = (Person) method.invoke(service, post.get("fromPerson").toString());
      b = (Person) method.invoke(service, post.get("toPerson").toString());
    }
View Full Code Here

Examples of org.opensocial.models.Person

      Client client = new Client(new OrkutProvider(useRest),
          new OAuth2LeggedScheme(ORKUT_KEY, ORKUT_SECRET, ORKUT_ID));
      Request request = PeopleService.getViewer();
      Response response = client.send(request);

      Person self = response.getEntry();
      assertTrue(self.getId() != null);
      assertTrue(self.getDisplayName() != null);
    } catch (Exception e) {
      fail("Exception occurred while processing request");
    }
  }
View Full Code Here

Examples of org.openuri.mytest.Person

        CustomerDocument doc =
            CustomerDocument.Factory.parse(
                TestEnv.xbeanCase("schema/simple/person.xml"), null);

        // Move from the root to the root customer element
        Person person = doc.getCustomer();
        Assert.assertEquals("Howdy", person.getFirstname());
        Assert.assertEquals(4,   person.sizeOfNumberArray());
        Assert.assertEquals(436, person.getNumberArray(0));
        Assert.assertEquals(123, person.getNumberArray(1));
        Assert.assertEquals(44,  person.getNumberArray(2));
        Assert.assertEquals(933, person.getNumberArray(3));
        Assert.assertEquals(2,   person.sizeOfBirthdayArray());
        Assert.assertEquals(new Date("Tue Aug 25 17:00:00 PDT 1998"), person.getBirthdayArray(0));

        Person.Gender.Enum g = person.getGender();
        Assert.assertEquals(Person.Gender.MALE, g);

        Assert.assertEquals("EGIQTWYZJ", new String(person.getHex()));
        Assert.assertEquals("This string is base64Binary encoded!",
                            new String(person.getBase64()));

        Assert.assertEquals("GGIQTWYGG", new String(person.getHexAtt()));
        Assert.assertEquals("This string is base64Binary encoded!",
                            new String(person.getBase64Att()));

        person.setFirstname("George");
        Assert.assertEquals("George", person.getFirstname());

        person.setHex("hex encoding".getBytes());
        Assert.assertEquals("hex encoding", new String(person.getHex()));

        person.setBase64("base64 encoded".getBytes());
        Assert.assertEquals("base64 encoded",
                            new String(person.getBase64()));

        //person.setHexAtt("hex encoding in attributes".getBytes());
        //Assert.assertEquals("hex encoding in attributes",
        //                    new String(person.getHexAtt()));
View Full Code Here

Examples of org.ops4j.pax.exam.sample2.model.Person

        Map<String, ?> data = loadPersonData(personId);
        if (data.containsKey("not_found")) {
            throw new RuntimeException("Data for Person " + personId + " not found.");
        }
        movieDbJsonMapper.mapToPerson(data, person);
        Person persistentPerson = em.find(Person.class, person.getId());
        if (persistentPerson == null) {
            em.persist(person);
        }
    }
View Full Code Here

Examples of org.parse4j.custom.Person

 
  @Test
  public void save() {
    System.out.println("save(): initializing...");
    ParseRegistry.registerSubclass(Person.class);
    Person parseObject = new Person();
    parseObject.setAge(15);
    parseObject.setGender("male");
    parseObject.getString("age");
   
    try {
      parseObject.save();
      System.out.println("save(): objectId: " + parseObject.getObjectId());
      System.out.println("save(): createdAt: " + parseObject.getCreatedAt());
      System.out.println("save(): updatedAt: " + parseObject.getUpdatedAt());
      assertNotNull("objectId should not be null", parseObject.getObjectId());
      assertNotNull("createdAt should not be null", parseObject.getCreatedAt());
      assertNotNull("updatedAt should not be null", parseObject.getUpdatedAt());
    }
    catch(ParseException pe) {
      assertNull("save(): should not have thrown ParseException", pe);
    }
  }
View Full Code Here

Examples of org.pathways.openciss.info.hmis.schema._3_0.hud_hmis.Person

    System.out.println("GET client called");
    String client;
    JAXBContext jc;
    try {
      //jc = JAXBContext.newInstance("info.hmis.schema._3_0.hud_hmis");
      Person p = new Person();
      jc = JAXBContext.newInstance(p.getClass());
      PathClientService pcs = new PathClientService();
      PathClient pc = pcs.getPathClient(clientID);
      if (pc  != null) {
       
        HashingChoiceStamped hcs_fn = new HashingChoiceStamped();
        String50 s50_fn = (new String50());
        s50_fn.setValue(pc.getNameFirst());
        hcs_fn.setUnhashed(s50_fn);
        p.setLegalFirstName(hcs_fn)
       
        HashingChoiceStamped hcs_ln = new HashingChoiceStamped();
        String50 s50_ln = (new String50());
        s50_ln.setValue(pc.getNameLast());
        hcs_ln.setUnhashed(s50_ln);; 
        p.setLegalLastName(hcs_ln)
       
        String50 s50_mn = new String50();
        HashingChoiceStamped hcs_mn = new HashingChoiceStamped();
        s50_mn.setValue(pc.getNameMiddle());
        hcs_mn.setUnhashed(s50_mn);
        p.setLegalMiddleName(hcs_mn);
       
        int eth = pc.getEthnicityCode().intValue();
        if (Integer.valueOf(eth) != null ) {
          FourValDKRefusedHashingChoice fourVal_hc = new FourValDKRefusedHashingChoice();
          FourValDKRefusedStatic fourVal_Static = new FourValDKRefusedStatic();
          eth = EthnicityMap.map(eth);
          if (eth != -1) {
            fourVal_Static.setValue((long)eth);
            fourVal_hc.setUnhashed(fourVal_Static);
            p.setEthnicity(fourVal_hc);
          }
        }
       
        int gen = pc.getGenderCode().intValue();
        if (Integer.valueOf(gen) != null ) {
          SevenValDKRefusedHashingChoice sevenValDKRef_hc = new SevenValDKRefusedHashingChoice();
          SevenValDKRefused sevenValDKRef = new SevenValDKRefused();
          gen = GenderMap.map(gen);
          if (gen != -1) {
            sevenValDKRef.setValue((long)gen);
            sevenValDKRef_hc.setUnhashed(sevenValDKRef);
            p.setGender(sevenValDKRef_hc);
          }
        }
       
        try {
          int race = pc.getRaceCode().intValue();
          if (Integer.valueOf(race) != null ) {
            SevenValDKRefused2HashingChoiceStatic sevenValDKRef_hcs = new SevenValDKRefused2HashingChoiceStatic();
            SevenValDKRefused2Static sevenValDKRef2S = new SevenValDKRefused2Static();
            race = RaceMap.map(race);
            if (race != -1) {
              sevenValDKRef2S.setValue((long)race);
              sevenValDKRef_hcs.setUnhashed(sevenValDKRef2S);
              p.getRace().add(sevenValDKRef_hcs);
            }
          }
        } catch (Exception e){e.printStackTrace();}
        if (pc.getDateOfBirth() !=null) {
          DOBHashingChoice dobhc = new DOBHashingChoice();
          DateStatic ds = new DateStatic();
          GregorianCalendar c = new GregorianCalendar();
          c.setTime(pc.getDateOfBirth());
          try {
            XMLGregorianCalendar gc = DatatypeFactory.newInstance().newXMLGregorianCalendar(c);
            gc.setTimezone(DatatypeConstants.FIELD_UNDEFINED)
            gc.setTime(DatatypeConstants.FIELD_UNDEFINED, DatatypeConstants.FIELD_UNDEFINED, DatatypeConstants.FIELD_UNDEFINED)
            ds.setValue(gc);
          } catch (DatatypeConfigurationException e) {e.printStackTrace();
          dobhc.setUnhashed(ds);
          p.setDateOfBirth(dobhc);
       
        Marshaller marshaller = jc.createMarshaller();
        marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
        //NamespacePrefixMapper namespacePrefixMapper = new NamespacePrefixMapper();
        //marshaller.setProperty(  "com.sun.xml.bind.namespacePrefixMapper", namespacePrefixMapper);
View Full Code Here

Examples of org.plugtree.examples.model.Person

        // Engine
        KnowledgeRuntimeLoggerFactory.newConsoleLogger(ksession);


        // Create a Person
        Person person = new Person("Salaboy!");
        // Create a Pet
        Pet pet = new Pet("mittens", "on a limb", Pet.PetType.CAT);
        // Set the Pet to the Person
        person.setPet(pet);

        // Now we will insert the Pet and the Person into the KnowledgeSession
        ksession.insert(pet);
        ksession.insert(person);
View Full Code Here

Examples of org.plugtree.training.model.Person

    ksession = kagent.getKnowledgeBase().newStatefulKnowledgeSession();
  }

  public void testExecution() {
    Vehicle car1 = new Vehicle(new Person(20), VehicleType.CAR, 2006, 35000f);
    Vehicle car2 = new Vehicle(new Person(60), VehicleType.CAR, 1960, 50000f);
    Vehicle car3 = new Vehicle(new Person(34), VehicleType.CAR, 1994, 4000f);
    Vehicle moto1 = new Vehicle(new Person(16), VehicleType.MOTORCYCLE, 1993, 3230F);
    Vehicle moto2 = new Vehicle(new Person(19), VehicleType.MOTORCYCLE, 2001, 8400F);
    Vehicle moto3 = new Vehicle(new Person(29), VehicleType.MOTORCYCLE, 2010, 10000F);

    ksession.insert(car1);
    ksession.insert(car2);
    ksession.insert(car3);
    ksession.insert(moto1);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.