private Integer getNumId ( String idString , boolean isUri ) { String numString ; if ( isUri ) { if ( ! idString . startsWith ( "http://www.wikidata.org/entity/" ) ) { return 0 ; } numString = idString . substring ( "http://www.wikidata.org/entity/Q" . length ( ) ) ; } else { numString = idString . substring ( 1 ) ; } return Integer . parseInt ( numString ) ; }
Extracts a numeric id from a string which can be either a Wikidata entity URI or a short entity or property id .