RdfValueFactory valueFactory = RdfValueFactory.getInstance();
RdfRepresentation rep = valueFactory.createRepresentation(id);
String namespace = NamespaceEnum.entityhubModel.getNamespace();
rep.add(namespace+"localMode", site.supportsLocalMode());
rep.add(namespace+"supportsSearch", site.supportsSearch());
SiteConfiguration config = site.getConfiguration();
rep.add(NamespaceEnum.rdfs+"label", config.getName());
rep.add(NamespaceEnum.rdf+"type", valueFactory.createReference(namespace+"ReferencedSite"));
if(config.getDescription() != null){
rep.add(NamespaceEnum.rdfs+"description", config.getDescription());
}
if(config.getCacheStrategy() != null){
rep.add(namespace+"cacheStrategy", valueFactory.createReference(namespace+"cacheStrategy-"+config.getCacheStrategy().name()));
}
//add the accessUri and queryUri
if(config.getAccessUri() != null){
rep.add(namespace+"accessUri", valueFactory.createReference(config.getAccessUri()));
}
if(config.getQueryUri() != null){
rep.add(namespace+"queryUri", valueFactory.createReference(config.getQueryUri()));
}
if(config.getAttribution() != null){
rep.add(NamespaceEnum.cc.getNamespace()+"attributionName", config.getAttribution());
}
if(config.getAttributionUrl() != null){
rep.add(NamespaceEnum.cc.getNamespace()+"attributionURL", config.getAttributionUrl());
}
//add the licenses
if(config.getLicenses() != null){
int count = 0;
for(License license : config.getLicenses()){
String licenseUrl;
if(license.getUrl() != null){
licenseUrl = license.getUrl();
} else {
licenseUrl = id+(!id.endsWith("/")?"/":"")+
LICENSE_PATH+'/'+LICENSE_NAME+(count>0?count:"");
count++;
}
//if defined add the name to dc:license
if(license.getName() != null){
rep.add(NamespaceEnum.dcTerms.getNamespace()+"license", licenseUrl);
}
//link to the license via cc:license
rep.add(NamespaceEnum.cc.getNamespace()+"license", licenseUrl);
}
}
if(config.getEntityPrefixes() != null){
for(String prefix : config.getEntityPrefixes()){
rep.add(namespace+"entityPrefix", prefix);
}
} else { //all entities are allowed/processed
rep.add(namespace+"entityPrefix", "*");
}