diff --git a/src/sparqlunicorn_ontdoc/export/pages/personpage.py b/src/sparqlunicorn_ontdoc/export/pages/personpage.py
index c54846e7..b5115600 100644
--- a/src/sparqlunicorn_ontdoc/export/pages/personpage.py
+++ b/src/sparqlunicorn_ontdoc/export/pages/personpage.py
@@ -1,9 +1,74 @@
-from doc.docconfig import DocConfig
-from doc.docutils import DocUtils
-import json
+from ...doc.docutils import DocUtils
+from ...sparqlutils import SPARQLUtils
+
class PersonPage:
+ vcardTohCard={
+ "http://xmlns.com/foaf/0.1/birthday":"dt-bday",
+ "http://xmlns.com/foaf/0.1/familyName":"p-family-name",
+ "http://xmlns.com/foaf/0.1/family_name": "p-family-name",
+ "http://xmlns.com/foaf/0.1/firstName": "p-given-name",
+ "http://xmlns.com/foaf/0.1/lastName": "p-family-name",
+ "http://xmlns.com/foaf/0.1/fullName":"FN",
+ "http://xmlns.com/foaf/0.1/givenname": "p-given-name",
+ "http://xmlns.com/foaf/0.1/givenName":"p-given-name",
+ "http://xmlns.com/foaf/0.1/homePage":"u-url",
+ "http://xmlns.com/foaf/0.1/gender": "p-sex",
+ "http://xmlns.com/foaf/0.1/img":"u-photo",
+ "http://xmlns.com/foaf/0.1/logo":"u-logo",
+ "http://xmlns.com/foaf/0.1/mbox":"u-email",
+ "http://xmlns.com/foaf/0.1/name":"N",
+ "http://xmlns.com/foaf/0.1/nick":"p-nickname",
+ "http://xmlns.com/foaf/0.1/phone":"p-tel",
+ "http://xmlns.com/foaf/0.1/surname":"p-family-name",
+ "http://xmlns.com/foaf/0.1/title":"p-job-title",
+ "http://www.w3.org/2000/10/swap/pim/contact#address": "p-street-address",
+ "http://www.w3.org/2000/10/swap/pim/contact#birthday": "dt-bday",
+ "http://www.w3.org/2000/10/swap/pim/contact#emailAddress": "u-email",
+ "http://www.w3.org/2000/10/swap/pim/contact#fax":"p-fax",
+ "http://www.w3.org/2000/10/swap/pim/contact#firstName": "p-given-name",
+ "http://www.w3.org/2000/10/swap/pim/contact#homepage": "u-url",
+ "http://www.w3.org/2000/10/swap/pim/contact#knownAs": "p-nickname",
+ "http://www.w3.org/2000/10/swap/pim/contact#lastName": "p-family-name",
+ "http://www.w3.org/2000/10/swap/pim/contact#personalTitle": "p-job-title",
+ "http://www.w3.org/2000/10/swap/pim/contact#phone":"p-tel",
+ "http://www.w3.org/2006/vcard/ns#additional-name":"p-additional-name",
+ "http://www.w3.org/2006/vcard/ns#anniversary":"dt-anniversary",
+ "http://www.w3.org/2006/vcard/ns#bday":"dt-bday",
+ "http://www.w3.org/2006/vcard/ns#email":"u-email",
+ "http://www.w3.org/2006/vcard/ns#family-name":"p-family-name",
+ "http://www.w3.org/2006/vcard/ns#fax":"p-fax",
+ "http://www.w3.org/2006/vcard/ns#geo":"p-geo",
+ "http://www.w3.org/2006/vcard/ns#given-name":"p-given-name",
+ "http://www.w3.org/2006/vcard/ns#hasAddress":"p-street-address",
+ "http://www.w3.org/2006/vcard/ns#hasEmail":"u-email",
+ "http://www.w3.org/2006/vcard/ns#hasGeo":"p-geo",
+ "http://www.w3.org/2006/vcard/ns#hasGender":"p-sex",
+ "http://www.w3.org/2006/vcard/ns#hasLogo":"u-logo",
+ "http://www.w3.org/2006/vcard/ns#hasName":"N",
+ "http://www.w3.org/2006/vcard/ns#hasPhoto":"u-photo",
+ "http://www.w3.org/2006/vcard/ns#hasSound":"u-sound",
+ "http://www.w3.org/2006/vcard/ns#hasTelephone":"p-tel",
+ "http://www.w3.org/2006/vcard/ns#hasURL":"u-url",
+ "http://www.w3.org/2006/vcard/ns#homeTel":"p-tel",
+ "http://www.w3.org/2006/vcard/ns#honorific-prefix":"p-honorific-prefix",
+ "http://www.w3.org/2006/vcard/ns#honorific-suffix":"p-honorific-suffix",
+ "http://www.w3.org/2006/vcard/ns#latitude":"p-latitude",
+ "http://www.w3.org/2006/vcard/ns#longitude":"p-longitude",
+ "http://www.w3.org/2006/vcard/ns#logo":"u-logo",
+ "http://www.w3.org/2006/vcard/ns#mobileEmail":"u-email",
+ "http://www.w3.org/2006/vcard/ns#mobileTel":"p-tel",
+ "http://www.w3.org/2006/vcard/ns#role":"p-role",
+ "http://www.w3.org/2006/vcard/ns#street-address": "p-street-address",
+ "http://www.w3.org/2006/vcard/ns#sound":"u-sound",
+ "http://www.w3.org/2006/vcard/ns#tel":"p-tel",
+ "http://www.w3.org/2006/vcard/ns#title":"p-job-title",
+ "http://www.w3.org/2006/vcard/ns#url":"u-url",
+ "http://www.w3.org/2006/vcard/ns#workEmail":"u-email",
+ "http://www.w3.org/2006/vcard/ns#workTel":"p-tel"
+ }
+
vcardprops={
"http://xmlns.com/foaf/0.1/birthday":"BDAY",
"http://xmlns.com/foaf/0.1/familyName":"N",
@@ -53,7 +118,7 @@ class PersonPage:
"http://www.w3.org/2006/vcard/ns#hasURL":"URL",
"http://www.w3.org/2006/vcard/ns#homeTel":"TEL",
"http://www.w3.org/2006/vcard/ns#honorific-prefix":"TITLE",
- "http://www.w3.org/2006/vcard/ns#honorific-suffix"
+ "http://www.w3.org/2006/vcard/ns#honorific-suffix":"",
"http://www.w3.org/2006/vcard/ns#latitude":"LATITUDE",
"http://www.w3.org/2006/vcard/ns#longitude":"LONGITUDE",
"http://www.w3.org/2006/vcard/ns#logo":"LOGO",
@@ -69,43 +134,54 @@ class PersonPage:
"http://www.w3.org/2006/vcard/ns#workTel":"TEL"
}
+ def createNameProperty(self,vcard):
+ print("create the name from differently mapped N values")
+
+
def extractPersonMetadata(self,subject,graph):
thevcard={}
for pprop in graph.predicate_objects(subject, True):
if str(pprop[0]) in self.vcardprops:
- thevcard[self.vcardprops[str(pprop[0])]]={"value":str(pprop[1]),"prop":str(pprop[0])}
+ if self.vcardprops[str(pprop[0])] in thevcard:
+ thevcard[self.vcardprops[str(pprop[0])]]["value"]+=" "+str(pprop[1])
+ else:
+ thevcard[self.vcardprops[str(pprop[0])]]={"value":str(pprop[1]),"prop":str(pprop[0])}
return thevcard
def vcardToHTML(self,vcard):
- result="
Property Value "
+ result="Download VCard "
+ if vcard[prop]["prop"] in self.vcardTohCard:
+ result += "" + str(vcard[prop]["value"]) + " "
+ else:
+ result += "" + str(vcard[prop]["value"]) + " "
+ result+="
Download VCard "
return result
+
@staticmethod
def collectionConstraint():
- return DocConfig.collectionclasses
+ return SPARQLUtils.collectionclasses
@staticmethod
def pageWidgetConstraint():
return ["http://xmlns.com/foaf/0.1/Person","http://www.w3.org/2006/vcard/ns#Individual","http://schema.org/Person","http://dbpedia.org/ontology/Person","http://www.wikidata.org/entity/Q5"]
def generatePageWidget(self, graph, subject, templates, f=None, pageWidget=False):
+ print("PageWidget")
vcard=self.extractPersonMetadata(subject,graph)
if pageWidget and f!=None:
f.write(self.vcardToHTML(vcard))
return vcard
-
-
def generateCollectionWidget(self, graph, templates, subject, f=None):
+ print("CollectionWidget")
vcards=[]
for person in graph.predicate_objects(subject):
- if str(person[0]) in DocConfig.collectionrelationproperties:
+ if str(person[0]) in SPARQLUtils.collectionrelationproperties:
vcards.append(self.generatePageWidget(graph,person[1],templates,f,True))
return vcards
\ No newline at end of file