public SchemaEntry extractResourceLocation ( SchemaEntry entry ) { Optional < String > actualResourceUri = Optional . empty ( ) ; if ( ! entry . getVocabularyDefinedBy ( ) . equals ( entry . getVocabularyNamespace ( ) ) ) actualResourceUri = getContentLocation ( entry . getVocabularyDefinedBy ( ) , GENERALFORMAT , Lists . newArrayList ( ) ) ; if ( ! actualResourceUri . isPresent ( ) ) actualResourceUri = getContentLocation ( entry . getVocabularyURI ( ) , GENERALFORMAT , Lists . newArrayList ( ) ) ; // if still nothing was found, we try to pretend to be a browser and do it over again, since some resources have really bad redirecting if ( ! actualResourceUri . isPresent ( ) && ! entry . getVocabularyDefinedBy ( ) . equals ( entry . getVocabularyNamespace ( ) ) ) actualResourceUri = getContentLocation ( entry . getVocabularyDefinedBy ( ) , TEXTHTML , Lists . newArrayList ( ) ) ; if ( ! actualResourceUri . isPresent ( ) ) actualResourceUri = getContentLocation ( entry . getVocabularyURI ( ) , TEXTHTML , Lists . newArrayList ( ) ) ; if ( ! actualResourceUri . isPresent ( ) ) { log . info ( "Could not find resource for " + entry . getVocabularyURI ( ) ) ; return entry ; } return new SchemaEntry ( entry . getPrefix ( ) , entry . getVocabularyURI ( ) , entry . getVocabularyNamespace ( ) , actualResourceUri . get ( ) ) ; }
Will try to get a responsive content location trying 1 . VocabularyDefinedBy location 2 . VocabularyURI location