Examples of BidirectionalShortFormProvider


Examples of org.semanticweb.owlapi.util.BidirectionalShortFormProvider

        String expression = "yearValue some ";
        OWLOntology wine = loadOntologyFromString(onto);
        Set<OWLOntology> ontologies = m.getOntologies();
        ShortFormProvider sfp = new ManchesterOWLSyntaxPrefixNameShortFormProvider(
                wine.getOWLOntologyManager().getOntologyFormat(wine));
        BidirectionalShortFormProvider shortFormProvider = new BidirectionalShortFormProviderAdapter(
                ontologies, sfp);
        ManchesterOWLSyntaxParser parser = OWLManager.createManchesterParser();
        parser.setStringToParse(expression);
        parser.setDefaultOntology(wine);
        parser.setOWLEntityChecker(new ShortFormEntityChecker(shortFormProvider));
View Full Code Here

Examples of org.semanticweb.owlapi.util.BidirectionalShortFormProvider

        m.addAxiom(o, annotation(dateTime, "dateTime"));
        // select a short form provider that uses annotations
        ShortFormProvider sfp = new AnnotationValueShortFormProvider(
                Arrays.asList(df.getRDFSLabel()),
                Collections.<OWLAnnotationProperty, List<String>> emptyMap(), m);
        BidirectionalShortFormProvider shortFormProvider = new BidirectionalShortFormProviderAdapter(
                m.getOntologies(), sfp);
        ManchesterOWLSyntaxParser parser = OWLManager.createManchesterParser();
        parser.setStringToParse(text1);
        ShortFormEntityChecker owlEntityChecker = new ShortFormEntityChecker(
                shortFormProvider);
View Full Code Here

Examples of org.semanticweb.owlapi.util.BidirectionalShortFormProvider

        m.addAxiom(o, df.getOWLSubClassOfAxiom(expected, d));
        // select a short form provider that uses annotations
        ShortFormProvider sfp = new AnnotationValueShortFormProvider(
                Arrays.asList(df.getRDFSLabel()),
                Collections.<OWLAnnotationProperty, List<String>> emptyMap(), m);
        BidirectionalShortFormProvider shortFormProvider = new BidirectionalShortFormProviderAdapter(
                m.getOntologies(), sfp);
        ManchesterOWLSyntaxParser parser = OWLManager.createManchesterParser();
        parser.setStringToParse(text1);
        ShortFormEntityChecker owlEntityChecker = new ShortFormEntityChecker(
                shortFormProvider);
View Full Code Here

Examples of org.semanticweb.owlapi.util.BidirectionalShortFormProvider

        m.addAxiom(o, annotation(p, "p"));
        // select a short form provider that uses annotations
        ShortFormProvider sfp = new AnnotationValueShortFormProvider(
                Arrays.asList(df.getRDFSLabel()),
                Collections.<OWLAnnotationProperty, List<String>> emptyMap(), m);
        BidirectionalShortFormProvider shortFormProvider = new BidirectionalShortFormProviderAdapter(
                m.getOntologies(), sfp);
        ManchesterOWLSyntaxParser parser = OWLManager.createManchesterParser();
        parser.setStringToParse(text1);
        ShortFormEntityChecker owlEntityChecker = new ShortFormEntityChecker(
                shortFormProvider);
View Full Code Here

Examples of org.semanticweb.owlapi.util.BidirectionalShortFormProvider

        m.addAxiom(o, df.getOWLSubClassOfAxiom(expected, d));
        // select a short form provider that uses annotations
        ShortFormProvider sfp = new AnnotationValueShortFormProvider(
                Arrays.asList(df.getRDFSLabel()),
                Collections.<OWLAnnotationProperty, List<String>> emptyMap(), m);
        BidirectionalShortFormProvider shortFormProvider = new BidirectionalShortFormProviderAdapter(
                m.getOntologies(), sfp);
        ManchesterOWLSyntaxParser parser = OWLManager.createManchesterParser();
        parser.setStringToParse(text1);
        ShortFormEntityChecker owlEntityChecker = new ShortFormEntityChecker(
                shortFormProvider);
View Full Code Here

Examples of org.semanticweb.owlapi.util.BidirectionalShortFormProvider

        m.addAxiom(o, df.getOWLDeclarationAxiom(b));
        // select a short form provider that uses annotations
        ShortFormProvider sfp = new AnnotationValueShortFormProvider(
                Arrays.asList(df.getRDFSLabel()),
                Collections.<OWLAnnotationProperty, List<String>> emptyMap(), m);
        BidirectionalShortFormProvider shortFormProvider = new BidirectionalShortFormProviderAdapter(
                m.getOntologies(), sfp);
        ManchesterOWLSyntaxParser parser = OWLManager.createManchesterParser();
        parser.setStringToParse(in);
        ShortFormEntityChecker owlEntityChecker = new ShortFormEntityChecker(
                shortFormProvider);
View Full Code Here

Examples of org.semanticweb.owlapi.util.BidirectionalShortFormProvider

  public OWLClassExpression runManchesterQuery(String manchesterQuery) throws ManchesterQueryException{
    ManchesterOWLSyntaxEditorParser parser = new ManchesterOWLSyntaxEditorParser(manager.getOWLDataFactory(), manchesterQuery);
        parser.setDefaultOntology(oldOntology);
        ShortFormProvider shortFormProvider = new SimpleShortFormProvider();
        Set<OWLOntology> importsClosure = oldOntology.getImportsClosure();
        BidirectionalShortFormProvider bidiShortFormProvider = new BidirectionalShortFormProviderAdapter(manager, importsClosure, shortFormProvider);
        // Specify an entity checker that wil be used to check a class expression contains the correct names.
        OWLEntityChecker entityChecker = new ShortFormEntityChecker(bidiShortFormProvider);
        parser.setOWLEntityChecker(entityChecker);

        OWLClassExpression classExp=null;
View Full Code Here

Examples of org.semanticweb.owlapi.util.BidirectionalShortFormProvider



    private List<EntityLookupResult> lookupEntities(final OWLAPIProject project, final EntityLookupRequest entityLookupRequest) {
        final RenderingManager rm = project.getRenderingManager();
        BidirectionalShortFormProvider sfp = rm.getShortFormProvider();
        Set<OWLEntityDataMatch> matches = new TreeSet<OWLEntityDataMatch>();
        EntityNameMatcher matcher = new EntityNameMatcher(entityLookupRequest.getSearchString());
        for(String shortForm : sfp.getShortForms()) {
            Optional<EntityNameMatchResult> result = matcher.findIn(shortForm);
            if(result.isPresent()) {
                Set<OWLEntity> entities = sfp.getEntities(shortForm);
                for(OWLEntity matchingEntity : entities) {
                    Optional<OWLEntityData> match = toOWLEntityData(matchingEntity, entityLookupRequest, rm);
                    if(match.isPresent()) {
                        EntityNameMatchResult resultValue = result.get();
                        matches.add(new OWLEntityDataMatch(match.get(), resultValue));
View Full Code Here

Examples of org.semanticweb.owlapi.util.BidirectionalShortFormProvider

    private List<AutoCompletionChoice> getEntityAutocompletionChoices(GetManchesterSyntaxFrameCompletionsAction action, OWLAPIProject project, ParserException e, EditorPosition fromPos, EditorPosition toPos, String lastWordPrefix) {
        List<AutoCompletionMatch> matches = Lists.newArrayList();
        Set<EntityType<?>> expectedEntityTypes = Sets.newHashSet(ManchesterSyntaxFrameParser.getExpectedEntityTypes(e));
        if(!expectedEntityTypes.isEmpty()) {
            BidirectionalShortFormProvider shortFormProvider = project.getRenderingManager().getShortFormProvider();
            for(String shortForm : shortFormProvider.getShortForms()) {
                EntityNameMatcher entityNameMatcher = new EntityNameMatcher(lastWordPrefix);
                Optional<EntityNameMatchResult> match = entityNameMatcher.findIn(shortForm);
                if(match.isPresent()) {
                    Set<OWLEntity> entities = shortFormProvider.getEntities(shortForm);
                    for(OWLEntity entity : entities) {
                        if(expectedEntityTypes.contains(entity.getEntityType())) {
                            EscapingShortFormProvider escapingShortFormProvider = new EscapingShortFormProvider(shortFormProvider);
                            AutoCompletionChoice choice = new AutoCompletionChoice(escapingShortFormProvider.getShortForm(entity), shortForm, "", fromPos, toPos);
                            AutoCompletionMatch autoCompletionMatch = new AutoCompletionMatch(
View Full Code Here

Examples of org.semanticweb.owlapi.util.BidirectionalShortFormProvider

            normalizedSearchString = search;
        }
        List<EntityData> result = new ArrayList<EntityData>();

        RenderingManager rm = project.getRenderingManager();
        BidirectionalShortFormProvider sfp = rm.getShortFormProvider();
        // Needs to be more efficient, but will do for now
        Set<String> shortForms = sfp.getShortForms();
        Pattern pattern = Pattern.compile(normalizedSearchString, Pattern.CASE_INSENSITIVE);

       
        for(String shortForm : shortForms) {
            Matcher matcher = pattern.matcher(shortForm);
            if(matcher.find()) {
                Set<OWLEntity> entities = sfp.getEntities(shortForm);
                for(OWLEntity entity : entities) {
                    EntityData entityData = rm.getEntityData(entity);
                    result.add(entityData);
                }
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.