Пример #1
0
 public function map(\Prototype\ContactInformation $contact)
 {
     $query = 'PREFIX ' . $this->vocabulary->name . ': <' . $this->vocabulary->prefix . '> ' . 'SELECT ?familyName ?firstName ' . 'WHERE { ' . '{<' . $this->url . '> ' . $this->vocabulary->name . ':' . $this->vocabulary->attributes->lastname . ' ?familyName .} UNION ' . '{<' . $this->url . '> ' . $this->vocabulary->name . ':' . $this->vocabulary->attributes->firstname . ' ?firstName .} ' . '}';
     $result = $this->store->sparqlQuery($query);
     if (!empty($result[0]['familyName'])) {
         $contact->setLastname($result[0]['familyName']);
     }
     if (!empty($result[0]['firstName'])) {
         $contact->setFirstname($result[0]['firstName']);
     }
 }
 public function NAttribute()
 {
     $vcard = new VObject\Component\VCard();
     $vcard->add('N', ['Werner', 'Lukas', ['Roland', 'Thomas', 'Alfred', 'Joseph'], 'B.Sc.', 'Informatik']);
     $contact = new ContactInformation();
     $contact->setLastname('Werner');
     $contact->setFirstname('Lukas');
     $contact->setAdditionalNames(['Roland', 'Thomas', 'Alfred', 'Joseph']);
     $contact->setHonorificPrefixes('B.Sc.');
     $contact->setHonorificSuffixes('Informatik');
     $this->assertEquals($vcard->serialize(), $this->object->convert($contact)->serialize());
 }