-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/termMed/rf2-to-owl.git
- Loading branch information
Showing
4 changed files
with
192 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
src/com/termmed/owl/OWLFunctionalSyntaxRefsetRenderer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* | ||
* * Copyright (C) 2014 termMed IT | ||
* * www.termmed.com | ||
* * | ||
* * Licensed under the Apache License, Version 2.0 (the "License"); | ||
* * you may not use this file except in compliance with the License. | ||
* * You may obtain a copy of the License at | ||
* * | ||
* * http://www.apache.org/licenses/LICENSE-2.0 | ||
* * | ||
* * Unless required by applicable law or agreed to in writing, software | ||
* * distributed under the License is distributed on an "AS IS" BASIS, | ||
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* * See the License for the specific language governing permissions and | ||
* * limitations under the License. | ||
* | ||
*/ | ||
|
||
package com.termmed.owl; | ||
|
||
import org.semanticweb.owlapi.functional.renderer.FunctionalSyntaxObjectRenderer; | ||
import org.semanticweb.owlapi.io.AbstractOWLRenderer; | ||
import org.semanticweb.owlapi.io.OWLRendererException; | ||
import org.semanticweb.owlapi.io.OWLRendererIOException; | ||
import org.semanticweb.owlapi.model.OWLOntology; | ||
import org.semanticweb.owlapi.model.OWLRuntimeException; | ||
|
||
import java.io.PrintWriter; | ||
|
||
/** | ||
* Created by alo on 4/17/17. | ||
*/ | ||
public class OWLFunctionalSyntaxRefsetRenderer extends AbstractOWLRenderer { | ||
@Override | ||
public void render(OWLOntology ontology, PrintWriter writer) throws OWLRendererException { | ||
try { | ||
OWLFuncionalSyntaxRefsetObjetRenderer ren = new OWLFuncionalSyntaxRefsetObjetRenderer(ontology, | ||
writer); | ||
ontology.accept(ren); | ||
writer.flush(); | ||
} catch (OWLRuntimeException e) { | ||
throw new OWLRendererIOException(e); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* | ||
* * Copyright (C) 2014 termMed IT | ||
* * www.termmed.com | ||
* * | ||
* * Licensed under the Apache License, Version 2.0 (the "License"); | ||
* * you may not use this file except in compliance with the License. | ||
* * You may obtain a copy of the License at | ||
* * | ||
* * http://www.apache.org/licenses/LICENSE-2.0 | ||
* * | ||
* * Unless required by applicable law or agreed to in writing, software | ||
* * distributed under the License is distributed on an "AS IS" BASIS, | ||
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* * See the License for the specific language governing permissions and | ||
* * limitations under the License. | ||
* | ||
*/ | ||
|
||
package com.termmed.owl; | ||
|
||
import org.semanticweb.owlapi.apibinding.OWLManager; | ||
import org.semanticweb.owlapi.dlsyntax.renderer.DLSyntaxObjectRenderer; | ||
import org.semanticweb.owlapi.functional.renderer.OWLFunctionalSyntaxRenderer; | ||
import org.semanticweb.owlapi.io.OWLObjectRenderer; | ||
import org.semanticweb.owlapi.model.OWLOntology; | ||
import org.semanticweb.owlapi.model.OWLOntologyManager; | ||
|
||
import java.io.File; | ||
import java.io.PrintWriter; | ||
|
||
/** | ||
* Created by alo on 4/17/17. | ||
*/ | ||
public class TestRenderer { | ||
|
||
private static long startTime = 0; | ||
private static long stopTime = 0; | ||
private static OWLFunctionalSyntaxRefsetRenderer fr = new OWLFunctionalSyntaxRefsetRenderer(); | ||
|
||
public static void main(String[] args) throws Exception { | ||
startTime = System.currentTimeMillis(); | ||
OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); | ||
// File testOntology = new File("/Users/alo/Downloads/termspace-owl (39).xml"); | ||
File testOntology = new File("/Users/alo/Downloads/conceptsOwlComplete-cd-alo.xml"); | ||
System.out.println("testOntology: " + testOntology.getName()); | ||
OWLOntology ontology = manager.loadOntologyFromOntologyDocument(testOntology); | ||
System.out.println("Terminology loaded in: " + (System.currentTimeMillis() - startTime) + " ms."); | ||
startTime = System.currentTimeMillis(); | ||
PrintWriter writer2 = new PrintWriter("owlRefset-complete.txt", "UTF-8"); | ||
fr.render(ontology,writer2); | ||
writer2.close(); | ||
System.out.println("OWL Refset created in: " + (System.currentTimeMillis() - startTime) + " ms."); | ||
} | ||
|
||
} |