Package org.apache.stanbol.entityhub.servicesapi.defaults

Examples of org.apache.stanbol.entityhub.servicesapi.defaults.NamespaceEnum


                Map<String,String> prefixMap = getPrefixMap();
                String defaultprefix;
                if(nsPrefixService != null){
                    defaultprefix = nsPrefixService.getPrefix(namespace);
                } else {
                    NamespaceEnum defaultMapping = NamespaceEnum.forNamespace(namespace);
                    defaultprefix = defaultMapping != null ? defaultMapping.getPrefix() : null;
                }
                /*
                 * NOTE: we need to check here also if the default prefix is not yet taken, because the Solr
                 * Index used to store the prefixes might be older than the latest change within the
                 * NamespaceEnum. Therefore there might be cases where a default prefix configured by this
View Full Code Here


                Map<String,String> prefixMap = getPrefixMap();
                String defaultprefix;
                if(nsPrefixService != null){
                    defaultprefix = nsPrefixService.getPrefix(namespace);
                } else {
                    NamespaceEnum defaultMapping = NamespaceEnum.forNamespace(namespace);
                    defaultprefix = defaultMapping != null ? defaultMapping.getPrefix() : null;
                }
                /*
                 * NOTE: we need to check here also if the default prefix is not yet taken, because the Solr
                 * Index used to store the prefixes might be older than the latest change within the
                 * NamespaceEnum. Therefore there might be cases where a default prefix configured by this
View Full Code Here

     * @param uri the URI to add MUST NOT be NULL
     */
    private static void appendUri(StringBuilder builder, String uri) {
        String[] namespaceLocal = ModelUtils.getNamespaceLocalName(uri);
        if(namespaceLocal[0]!=null){
            NamespaceEnum namespace = NamespaceEnum.forNamespace(namespaceLocal[0]);
            if(namespace != null){
                builder.append(namespace.getPrefix()).append(':');
            } else {
                builder.append(namespaceLocal[0]);
            }
        } //else no name space to add (e.g. if the pattern is "*")
        builder.append(namespaceLocal[1]);
View Full Code Here

     * @return the QName
     */
    public static QName getQName(String uri){
        String[] nsln = getNamespaceLocalName(uri);
        if(nsln[0] != null){
            NamespaceEnum entry = NamespaceEnum.forNamespace(nsln[0]);
            if(entry != null){
                return new QName(nsln[0], nsln[1],entry.getPrefix());
            } else {
                return new QName(nsln[0], nsln[1]);
            }
        } else {
            return new QName(nsln[1]);
View Full Code Here

     * @param uri the URI to add MUST NOT be NULL
     */
    private static void appendUri(StringBuilder builder, String uri) {
        String[] namespaceLocal = ModelUtils.getNamespaceLocalName(uri);
        if(namespaceLocal[0]!=null){
            NamespaceEnum namespace = NamespaceEnum.forNamespace(namespaceLocal[0]);
            if(namespace != null){
                builder.append(namespace.getPrefix()).append(':');
            } else {
                builder.append(namespaceLocal[0]);
            }
        } //else no name space to add (e.g. if the pattern is "*")
        builder.append(namespaceLocal[1]);
View Full Code Here

        Map<String,String> prefixMap = getPrefixMap();
        String prefix = getNamespaceMap().get(namespace);
        if (prefix != null) {
            return prefix;
        } else if (create) { // only if not present and prefix is true
            NamespaceEnum defaultMapping = NamespaceEnum.forNamespace(namespace);
            if (defaultMapping != null && !prefixMap.containsKey(defaultMapping.getPrefix())) {
                /*
                 * NOTE: we need to check here also if the default prefix is not yet taken, because the Solr
                 * Index used to store the prefixes might be older than the latest change within the
                 * NamespaceEnum. Therefore there might be cases where a default prefix configured by this
                 * Enum is already assigned to a different namespace within the Solr index! In such cases, we
                 * need to create a new prefix for this namespace
                 */
                prefix = defaultMapping.getPrefix();
            } else {
                // need to generate a default mapping
                prefix = createPrefix(prefixMap);
            }
            addNamespaceMapping(prefix, namespace); // we need to add the new mapping
View Full Code Here

        Map<String,String> prefixMap = getPrefixMap();
        String prefix = getNamespaceMap().get(namespace);
        if (prefix != null) {
            return prefix;
        } else if (create) { // only if not present and prefix is true
            NamespaceEnum defaultMapping = NamespaceEnum.forNamespace(namespace);
            if (defaultMapping != null && !prefixMap.containsKey(defaultMapping.getPrefix())) {
                /*
                 * NOTE: we need to check here also if the default prefix is not yet taken, because the Solr
                 * Index used to store the prefixes might be older than the latest change within the
                 * NamespaceEnum. Therefore there might be cases where a default prefix configured by this
                 * Enum is already assigned to a different namespace within the Solr index! In such cases, we
                 * need to create a new prefix for this namespace
                 */
                prefix = defaultMapping.getPrefix();
            } else {
                // need to generate a default mapping
                prefix = createPrefix(prefixMap);
            }
            addNamespaceMapping(prefix, namespace); // we need to add the new mapping
View Full Code Here

TOP

Related Classes of org.apache.stanbol.entityhub.servicesapi.defaults.NamespaceEnum

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.