Skip to content

Commit

Permalink
Also allow for attribute anchors (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdvorak001 authored and chenejac committed Apr 23, 2024
1 parent 7a0929f commit 0f48308
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions tools/owl/src/main/java/org/eurocris/cerif2/owl/Model.java
Original file line number Diff line number Diff line change
Expand Up @@ -484,9 +484,6 @@ protected void handle() throws InterruptedException, ExecutionException {
}

protected void processAttributeNode( final IRI classIRI, final OWLClass owlClass, final Node node, BasedSequence text ) throws ParseException {
if ( text.startsWith( "<a name=\"" ) && text.endsWith( "</a>" ) ) {
text = text.subSequence( text.indexOf( ">" ) + 1, text.length() - "</a>".length() );
}
final int colonPosition = text.indexOf( ':' );
if ( colonPosition < 0 ) {
throw new ParseException( "No colon specified", node );
Expand All @@ -496,7 +493,8 @@ protected void processAttributeNode( final IRI classIRI, final OWLClass owlClass
final int endashPosition = rest.indexOf( '–' );
final BasedSequence datatypeSpec = ( endashPosition > 0 ) ? rest.subSequence( 0, endashPosition ).trim() : rest.trim();
final String datatypeLinkTarget = datatypeSpec.toString().replaceAll( "[^(]*\\(([^)]*)\\)[^)]*", "$1" );
final String attributeName = ( attributeText.contains( " " ) || Character.isUpperCase( attributeText.charAt( 0 ) ) ) ? CaseUtils.toCamelCase( attributeText, false, ' ', '-', '_', '.' ) : attributeText;
final String attributeName1 = attributeText.replaceFirst( "<a name=\"[^\"]*\">([^<]*)</a>", "$1" );
final String attributeName = ( attributeName1.contains( " " ) || Character.isUpperCase( attributeName1.charAt( 0 ) ) ) ? CaseUtils.toCamelCase( attributeName1, false, ' ', '-', '_', '.' ) : attributeName1;
log.info( "Attribute " + attributeName + ", datatype " + datatypeLinkTarget );
if ( !datatypeLinkTarget.startsWith( "../datatypes/" ) ) {
throw new ParseException( "Not referencing ../datatypes/", node );
Expand Down

0 comments on commit 0f48308

Please sign in to comment.