EPUB3_EXPORT const IRI IRIForDCType(DCType type) { auto found = IDToNameMap.find(type); if ( found == IDToNameMap.end() ) return IRI(); return IRI(DCMES_uri + found->second); }
IRI PropertyHolder::MakePropertyIRI(const string &reference, const string& prefix) const { auto found = _vocabularyLookup.find(prefix); if ( found == _vocabularyLookup.end() ) { auto parent = _parent.lock(); if ( parent ) return parent->MakePropertyIRI(reference, prefix); return IRI(); } return IRI(found->second + reference); }
bool Property::ParseMetaElement(shared_ptr<xml::Node> node) { if ( !bool(node) ) return false; if ( !node->IsElementNode() ) return false; auto ns = node->Namespace(); if ( ns != nullptr && ns->URI() == DCMES_uri ) { auto found = NameToIDMap.find(node->Name()); if ( found == NameToIDMap.end() ) return false; _type = found->second; _identifier = IRI(string(DCMES_uri) + node->Name()); _value = node->Content(); _language = node->Language(); SetXMLIdentifier(_getProp(node, "id")); return true; } else if ( node->Name() == MetaTagName ) { string property = _getProp(node, "property"); if ( property.empty() ) return false; _type = DCType::Custom; _identifier = OwnedBy::Owner()->PropertyIRIFromString(property); _value = node->Content(); _language = node->Language(); SetXMLIdentifier(_getProp(node, "id")); return true; } else if ( ns != nullptr ) { _type = DCType::Custom; _identifier = IRI(string(ns->URI()) + node->Name()); _value = node->Content(); _language = node->Language(); SetXMLIdentifier(_getProp(node, "id")); return true; } return false; }
IRI PackageBase::MakePropertyIRI(const string &reference, const string& prefix) const { auto found = _vocabularyLookup.find(prefix); if ( found == _vocabularyLookup.end() ) throw UnknownPrefix(_Str("Unknown prefix '", prefix, "'")); return IRI(found->second + reference); }
void Property::SetDCType(DCType type) { _type = type; if ( type == DCType::Invalid ) { _identifier = IRI(); } else if ( type != DCType::Custom ) { _identifier = IRIForDCType(type); } }
IRI Library::EPubURLForPublicationID(const string &identifier) const { return IRI(IRI::gEPUBScheme, identifier, "/"); }