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);
}
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();
}
Aggregations