Package ru.spbu.math.ontologycomparison.zhukova.logic.ontologygraph

Examples of ru.spbu.math.ontologycomparison.zhukova.logic.ontologygraph.IOntologyGraph


    public void testItBuildsAnything() throws FileNotFoundException, /*OWLTransformationException,*/ OWLReasonerException {
        new OntologyManager(new FileInputStream(OntologyTestConstants.ONTOPL_URL)).load();
    }

    public void testConceptsNumber() throws FileNotFoundException, /*OWLTransformationException,*/ OWLReasonerException {
        IOntologyGraph graph = new OntologyManager(new FileInputStream(OntologyTestConstants.ONTOPL_URL)).load();
        assertEquals(OntologyTestConstants.ONTO_PL_CONCEPTS_COUNT, graph.getConcepts().size());
    }
View Full Code Here


        IOntologyGraph graph = new OntologyManager(new FileInputStream(OntologyTestConstants.ONTOPL_URL)).load();
        assertEquals(OntologyTestConstants.ONTO_PL_CONCEPTS_COUNT, graph.getConcepts().size());
    }

    public void testConceptsContent() throws FileNotFoundException, /*OWLTransformationException,*/ OWLReasonerException {
        IOntologyGraph graph = new OntologyManager(new FileInputStream(OntologyTestConstants.ONTOPL_URL)).load();
        for (IOntologyConcept concept : graph.getConcepts()) {
            if (concept.getLabelCollection().contains(OntologyTestConstants.JAVA)) {
                return;
            }
        }
        fail();
View Full Code Here

        }
        fail();
    }

    public void testChildParentRelation() throws FileNotFoundException, /*OWLTransformationException,*/ OWLReasonerException {
        IOntologyGraph graph = new OntologyManager(new FileInputStream(OntologyTestConstants.ONTOPL_URL)).load();
        for (IOntologyConcept concept : graph.getConcepts()) {
            if (concept.getLabelCollection().contains(OntologyTestConstants.JAVA)) {
                for (IOntologyConcept parent : concept.getParents()) {
                    if (parent.getLabelCollection().contains(OntologyTestConstants.PROGRAMMING_LANGUAGE)) {
                        return;
                    }
View Full Code Here

                }
            });
            firstGraphThread.start();
            final OntologyManager secondOntologyManager = new OntologyManager(secondFile, this.main);
            Open.this.main.log(String.format("Loading %s...", secondFile.getName()));
            IOntologyGraph secondOntologyGraph = secondOntologyManager.load(new ClassAnnotationVisitor(), new PropertyVisitor());
            try {
                firstGraphThread.join();
            } catch (InterruptedException e) {
                // ignore;
            }
            if (firstOntologyGraph[0] == null) {
                return;
            }
            this.main.log("Merging ontologies...");
            IOntologyComparator ontologyComparator = new OntologyComparator(firstOntologyGraph[0], secondOntologyGraph, this.main);
            IOntologyGraph ontologyGraph = ontologyComparator.mapOntologies().getFirst();
            int similarity = (int) (ontologyComparator.getSimilarity() * 100);
            final IGraphModelBuilder myGraphModelBuilder =
                    new GraphModelBuilder(firstOntologyGraph[0], secondOntologyGraph, ontologyGraph, similarity, this.main);
            this.main.log("Visualising ontologies...");
            GraphModel graphModel = myGraphModelBuilder.buildGraphModel(main.getGraphPane(), main.areUnmappedConceptsVisible(), main.areUnmappedConceptsWithSynsetsVisible());
View Full Code Here

            PrintWriter writer = null;
            try {
                File firstOwl = new File(args[0]);
                File secondOwl = new File(args[1]);
                File output = new File(args[2]);
                IOntologyGraph ontologyGraph = main.buildGraph(firstOwl, secondOwl);
                main.log("Saving alignment");
                output.createNewFile();
                writer = new PrintWriter(output);
                Collection<IOntologyConcept> concepts = ontologyGraph.getConcepts();
                    for (IOntologyConcept concept : concepts) {
                        Collection<IOntologyConcept> similarConcepts = concept.getSimilarConcepts();
                        if (similarConcepts != null && !similarConcepts.isEmpty()) {
                            writer.println(String.format("%s %s", concept, similarConcepts.iterator().next()));
                        }
View Full Code Here

            }
        });
        firstGraphThread.start();
        final OntologyManager secondOntologyManager = new OntologyManager(secondFile, this);
        log(String.format("Loading %s...", secondFile.getName()));
        IOntologyGraph secondOntologyGraph = secondOntologyManager.load(new ClassAnnotationVisitor(), new PropertyVisitor());
        try {
            firstGraphThread.join();
        } catch (InterruptedException e) {
            // ignore;
        }
View Full Code Here

        }
        return propertyIntersectionSize / (double) propertyUnionSize;
    }

    public IPair<IOntologyGraph, Collection<IOntologyProperty>> mapOntologies() {
        IOntologyGraph mappedConcepts = mapConcepts();
        return new Pair<IOntologyGraph, Collection<IOntologyProperty>>(mappedConcepts, mapProperties(mappedConcepts.getConcepts()));
    }
View Full Code Here

        this.firstGraph.setSynsetToConcept(firstSynsetMapper.getSynsetToConceptTable());
        SynsetMapper secondSynsetMapper = new SynsetMapper(new HashSet<IOntologyConcept>(this.secondGraph.getConcepts()), logger);
        Collection<IOntologyConcept> secondConcepts = secondSynsetMapper.map();
        this.secondGraph.setSynsetToConcept(secondSynsetMapper.getSynsetToConceptTable());
        int secondConceptsSize = secondConcepts.size();
        IOntologyGraph result = (new OntologyConceptMapper(firstConcepts, secondConcepts, this.firstGraph, this.secondGraph, logger)).map();
        this.conceptIntersectionSize = secondConceptsSize - secondConcepts.size();
        this.conceptUnionSize = result.getConcepts().size();
        return result;
    }
View Full Code Here

TOP

Related Classes of ru.spbu.math.ontologycomparison.zhukova.logic.ontologygraph.IOntologyGraph

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.