Search in sources :

Example 6 with OWLDataFactoryImpl

use of uk.ac.manchester.cs.owl.owlapi.OWLDataFactoryImpl in project webprotege by protegeproject.

the class SuppliedNameSuffixEntityCrudKitHandlerTestCase method setUp.

@Before
public void setUp() throws Exception {
    dataFactory = new OWLDataFactoryImpl();
    when(prefixSettings.getIRIPrefix()).thenReturn(PREFIX);
    when(suffixSettings.getWhiteSpaceTreatment()).thenReturn(whiteSpaceTreatment);
    when(crudContext.getDataFactory()).thenReturn(dataFactory);
    when(crudContext.getTargetOntology()).thenReturn(ontology);
    when(crudContext.getPrefixedNameExpander()).thenReturn(PrefixedNameExpander.builder().withNamespaces(Namespaces.values()).build());
    when(crudContext.getTargetLanguage()).thenReturn(Optional.empty());
    when(ontology.containsEntityInSignature(any(OWLEntity.class))).thenReturn(true);
    handler = new SuppliedNameSuffixEntityCrudKitHandler(prefixSettings, suffixSettings);
}
Also used : OWLDataFactoryImpl(uk.ac.manchester.cs.owl.owlapi.OWLDataFactoryImpl) Before(org.junit.Before)

Example 7 with OWLDataFactoryImpl

use of uk.ac.manchester.cs.owl.owlapi.OWLDataFactoryImpl in project webprotege by protegeproject.

the class ProjectViewPlaceTokenizer method getPlace.

public ProjectViewPlace getPlace(String token) {
    GWT.log("[ProjectViewPlaceTokenizer] Parsing: " + token);
    token = URL.decode(token);
    GWT.log("[ProjectViewPlaceTokenizer] Decoded: " + token);
    MatchResult result = regExp.exec(token);
    GWT.log("[ProjectViewPlaceTokenizer] MatchResult: " + result);
    String projectId = result.getGroup(1);
    String perspectiveId = result.getGroup(2);
    String selectionString = result.getGroup(4);
    GWT.log("[ProjectViewPlaceTokenizer] Parsed: ProjectId: " + projectId);
    GWT.log("[ProjectViewPlaceTokenizer] Parsed: PerspectiveId: " + perspectiveId);
    GWT.log("[ProjectViewPlaceTokenizer] Parsed: Selection: " + selectionString);
    ProjectViewPlace.Builder builder = new ProjectViewPlace.Builder(ProjectId.get(projectId), new PerspectiveId(perspectiveId));
    if (selectionString != null) {
        ItemTokenizer tokenizer = new ItemTokenizer();
        List<ItemToken> tokenList = tokenizer.parseTokens(selectionString);
        for (ItemToken t : tokenList) {
            OWLDataFactoryImpl dataFactory = new OWLDataFactoryImpl();
            ItemTokenParser parser = new ItemTokenParser();
            DefaultPrefixManager prefixManager = new DefaultPrefixManager();
            prefixManager.setPrefix("owl:", Namespaces.OWL.getPrefixIRI());
            List<Item<?>> entity = parser.parse(t, new DefaultItemTypeMapper(dataFactory, prefixManager));
            for (Item<?> item : entity) {
                builder.withSelectedItem(item);
            }
        }
    }
    return builder.build();
}
Also used : DefaultPrefixManager(org.semanticweb.owlapi.util.DefaultPrefixManager) PerspectiveId(edu.stanford.bmir.protege.web.shared.perspective.PerspectiveId) MatchResult(com.google.gwt.regexp.shared.MatchResult) OWLDataFactoryImpl(uk.ac.manchester.cs.owl.owlapi.OWLDataFactoryImpl)

Aggregations

OWLDataFactoryImpl (uk.ac.manchester.cs.owl.owlapi.OWLDataFactoryImpl)7 CollectionIdConverter (edu.stanford.bmir.protege.web.server.collection.CollectionIdConverter)2 Before (org.junit.Before)2 Morphia (org.mongodb.morphia.Morphia)2 MatchResult (com.google.gwt.regexp.shared.MatchResult)1 MongoClient (com.mongodb.MongoClient)1 AccessManager (edu.stanford.bmir.protege.web.server.access.AccessManager)1 AccessManagerImpl (edu.stanford.bmir.protege.web.server.access.AccessManagerImpl)1 CollectionItemConverter (edu.stanford.bmir.protege.web.server.collection.CollectionItemConverter)1 ColorConverter (edu.stanford.bmir.protege.web.server.color.ColorConverter)1 FormDataConverter (edu.stanford.bmir.protege.web.server.form.FormDataConverter)1 FormDataValueConverter (edu.stanford.bmir.protege.web.server.form.FormDataValueConverter)1 FormIdConverter (edu.stanford.bmir.protege.web.server.form.FormIdConverter)1 ChangeHistoryFileProvider (edu.stanford.bmir.protege.web.server.inject.project.ChangeHistoryFileProvider)1 TagIdConverter (edu.stanford.bmir.protege.web.server.tag.TagIdConverter)1 PerspectiveId (edu.stanford.bmir.protege.web.shared.perspective.PerspectiveId)1 ImportedOntologyMetadata (edu.stanford.bmir.protege.web.shared.project.ImportedOntologyMetadata)1 BufferedInputStream (java.io.BufferedInputStream)1 File (java.io.File)1 Nonnull (javax.annotation.Nonnull)1