createLiteral($fullName); $johnSmith = $model->createResource($personURI); $vcard_FN= $model->createProperty(VCARD_NS.'FN'); $vcard_NICKNAME= $model->createProperty(VCARD_NS.'NICKNAME'); // Add the property $johnSmith->addProperty($vcard_FN, $fullNameLiteral); // Retrieve the John Smith vcard resource from the model $vCard = $model->createResource($personURI); // Retrieve the value of the FN property $statement = $vCard->getProperty($vcard_FN); $value = $statement->getObject(); // Add two nickname properties to vcard $literal1 = $model->createLiteral("Smithy"); $literal2 = $model->createLiteral("Adman"); $vCard->addProperty($vcard_NICKNAME, $literal1); $vCard->addProperty($vcard_NICKNAME, $literal2); // List the nicknames echo 'Known nicknames for '.$fullNameLiteral->getLabel().':
'; foreach ($vCard->listProperties($vcard_NICKNAME) as $currentResource) { echo $currentResource->getLabelObject().'
'; }; echo '
Iterate over all subjects which having FN property:
'; // Iterate over all subjects which having FN property $iter = $model->listSubjectsWithProperty($vcard_FN); for ($iter->rewind(); $iter->valid(); $iter->next()) { $currentResource=$iter->current(); echo $currentResource->getLabel().'
'; }; // Create a bag $bag_smiths = $model->createBag(); $beckySmith = $model->createResource('http://somewhere/BeckySmith'); $beckySmithFN = $model->createLiteral('Becky Smith'); $beckySmith->addProperty($vcard_FN,$beckySmithFN ); // Add persons to bag $bag_smiths->add($beckySmith); $bag_smiths->add($johnSmith); // Print out the full names of the members of the bag echo '

Print out the full names of the members of the bag:
'; foreach ($bag_smiths->getMembers() as $resResource) { // Retrieve the value of the FN property $statement = $resResource->getProperty($vcard_FN); echo $statement->getLabelObject().'
'; }; echo '

All Statements as HTML table'; $model->writeAsHTMLTable(); ?>