PrimitiveType(EntityType<?> entityType) { this(entityType.getShortForm(), entityType.getPrintName(), entityType.getPluralPrintName()); }
/** * Creates an {@link EntityLookupRequest} that specifies entities should be search for by the sepcified string * and search type. * @param searchString The search {@link String}. Not {@code null}. * @param searchType The type of search to be performed.. See {@link edu.stanford.bmir.protege.web.shared.search.SearchType}. * @throws NullPointerException if any parameters are {@code null}. */ public EntityLookupRequest(String searchString, SearchType searchType) { this(searchString, searchType, DEFAULT_MATCH_LIMIT, EntityType.values()); }
/** * Constructs an entity count metric that counts entities of the specified type. * @param rootOntology The project over which the value for the metric is computed. * @param entityType The entity type. */ public EntityCountMetricCalculator(OWLOntology rootOntology, EntityType<?> entityType) { super(rootOntology); this.entityType = entityType; StringBuilder sb = new StringBuilder(); String typeName = entityType.getName(); for(int i = 0; i < typeName.length(); i++) { char ch = typeName.charAt(i); if(Character.isUpperCase(ch)) { sb.append(" "); } sb.append(ch); } metricName = sb.toString().trim() + " count"; }
private static String toEntityTypePrintName(boolean singleEntityDeclaration, EntityType<?> entityType) { return singleEntityDeclaration ? entityType.getPrintName() : entityType.getPluralPrintName(); }
/** * @param entityType the OWL entity type * @return the name of the OWL entity type */ public static String getPrintName(EntityType entityType) { return entityType.getPrintName().toLowerCase(); }
/** * Returns the entity type of the given resource IRI, i.e. whether the resource * is a owl:Class, owl:ObjectProperty,owl:DatatypeProperty or owl:NamedIndividual. * @param iri the IRI of the entity * @return the entity type */ public EntityType<? extends OWLEntity> getOWLEntityType(String iri) { ParameterizedSparqlString query = new ParameterizedSparqlString("SELECT ?type WHERE {?s a ?type .}"); query.setIri("s", iri); ResultSet rs = executeSelectQuery(query.toString()); Set<EntityType<? extends OWLEntity>> entityTypes = new HashSet<>(); while(rs.hasNext()){ QuerySolution qs = rs.next(); String uri = qs.getResource("type").getURI(); for(EntityType<? extends OWLEntity> entityType : EntityType.values()){ if(entityType.getIRI().toString().equals(uri)){ entityTypes.add(entityType); break; } } } if(entityTypes.size() == 1){ return entityTypes.iterator().next(); } return null; }
/** * Adds triples to strong type an entity. Triples are only added if the useStrongTyping flag is * set to {@code true} and the entity is not a built in entity. * * @param entity The entity for which strong typing triples should be added. */ private void addStrongTyping(OWLEntity entity) { if (!useStrongTyping) { return; } if (!OWLDocumentFormat.isMissingType(entity, ont)) { return; } addTriple(entity, RDF_TYPE.getIRI(), entity.getEntityType().getIRI()); }
/** * Constructs a WizardPanel that will ask the user whether they want to make siblings disjoint. * @param owlEditorKit The relevant editor kit. * @param entityType The type of sibling. * @param recommendation Whether or not it is recommended that siblings be disjoint. */ public MakeSiblingsDisjointPanel(OWLEditorKit owlEditorKit, EntityType<?> entityType, Recommendation recommendation) { super(ID, String.format("Make sibling %s disjoint?", entityType.getPluralPrintName().toLowerCase()), owlEditorKit); this.checkBox = new JCheckBox(String.format("Do you want to make sibling %s disjoint? (%s)", entityType.getPluralPrintName().toLowerCase(), recommendation.getPrintName()), recommendation == Recommendation.RECOMMENDED); checkBox.setBackground(null); this.entityType = entityType; this.recommendation = recommendation; setInstructions(String.format("Make sibling %s disjoint (%s)", entityType.getPluralPrintName().toLowerCase(), recommendation.getPrintName())); JPanel parent = new JPanel(new BorderLayout()); parent.add(checkBox, BorderLayout.NORTH); setContent(parent); }
@Override public <E extends OWLEntity> E getOWLEntity(EntityType<E> entityType, IRI iri) { checkNotNull(entityType, ENTITY_TYPE_CANNOT_BE_NULL); checkNotNull(iri, IRI_CANNOT_BE_NULL); return entityType.buildEntity(iri, this); }
connection.add(rdfFactory.createURI(entity.getIRI().toString()), rdfFactory.createURI(OWLRDFVocabulary.RDF_TYPE.getIRI().toString()), rdfFactory.createURI(entity.getEntityType().getVocabulary().getIRI().toString()), translator.axiomResource);
private void generateMessage() { if (entities.size() == 1) { message = msgFormatter.format("Deleted {0}: {1}", entities.iterator().next().getEntityType().getPrintName().toLowerCase(), entities); } else { Collection<EntityType<?>> deletedTypes = entities.stream() .map(OWLEntity::getEntityType) .collect(Collectors.toSet()); if (deletedTypes.size() == 1) { message = msgFormatter.format("Deleted {0} {1}: {2}", entities.size(), deletedTypes.iterator().next().getPluralPrintName().toLowerCase(), entities); } else { message = msgFormatter.format("Deleted: {1}", entities); } } }
private static <T extends OWLEntity> String getTypeName(Class<T> type) { if(type.equals(OWLClass.class)) { return EntityType.CLASS.getPrintName(); } else if(type.equals(OWLObjectProperty.class)) { return EntityType.OBJECT_PROPERTY.getPrintName(); } else if(type.equals(OWLDataProperty.class)) { return EntityType.DATA_PROPERTY.getPrintName(); } else if(type.equals(OWLAnnotationProperty.class)) { return EntityType.ANNOTATION_PROPERTY.getPrintName(); } else if(type.equals(OWLDatatype.class)) { return EntityType.DATATYPE.getPrintName(); } else if(type.equals(OWLNamedIndividual.class)) { return EntityType.NAMED_INDIVIDUAL.getPrintName(); } else { return type.getSimpleName(); } }
/** * Adds triples to strong type an entity. Triples are only added if the useStrongTyping flag is * set to {@code true} and the entity is not a built in entity. * * @param entity The entity for which strong typing triples should be added. */ private void addStrongTyping(OWLEntity entity) { if (!useStrongTyping) { return; } if (!OWLDocumentFormat.isMissingType(entity, ont)) { return; } addTriple(entity, RDF_TYPE.getIRI(), entity.getEntityType().getIRI()); }
/** * Constructs a WizardPanel that will ask the user whether they want to make siblings disjoint. * @param owlEditorKit The relevant editor kit. * @param entityType The type of sibling. * @param recommendation Whether or not it is recommended that siblings be disjoint. */ public MakeSiblingsDisjointPanel(OWLEditorKit owlEditorKit, EntityType<?> entityType, Recommendation recommendation) { super(ID, String.format("Make sibling %s disjoint?", entityType.getPluralPrintName().toLowerCase()), owlEditorKit); this.checkBox = new JCheckBox(String.format("Do you want to make sibling %s disjoint? (%s)", entityType.getPluralPrintName().toLowerCase(), recommendation.getPrintName()), recommendation == Recommendation.RECOMMENDED); checkBox.setBackground(null); this.entityType = entityType; this.recommendation = recommendation; setInstructions(String.format("Do you want to make sibling %s disjoint? (%s)", entityType.getPluralPrintName().toLowerCase(), recommendation.getPrintName())); JPanel parent = new JPanel(new BorderLayout()); parent.add(checkBox, BorderLayout.NORTH); setContent(parent); }
@Override public <E extends OWLEntity> E getOWLEntity(EntityType<E> entityType, IRI iri) { checkNotNull(entityType, ENTITY_TYPE_CANNOT_BE_NULL); checkNotNull(iri, IRI_CANNOT_BE_NULL); return entityType.buildEntity(iri, this); }
connection.add(rdfFactory.createURI(entity.getIRI().toString()), rdfFactory.createURI(OWLRDFVocabulary.RDF_TYPE.getIRI().toString()), rdfFactory.createURI(entity.getEntityType().getVocabulary().getIRI().toString()), translator.axiomResource);
PrimitiveType(EntityType<?> entityType) { this(entityType.getShortForm(), entityType.getPrintName(), entityType.getPluralPrintName()); }
@Nonnull @Override public String getMessage(ChangeApplicationResult<Set<E>> result) { Set<E> entities = result.getSubject(); int entityCount = entities.size(); String mainMsg; if(entityCount == 1) { mainMsg = msg.format("Created {0} {1}", entityType.getPrintName().toLowerCase(), entities); if (!parents.isEmpty()) { mainMsg += msg.format(" {0} {1}", getSingularRelationship(), parents); } } else { mainMsg = msg.format("Created {0} {1}", entityType.getPluralPrintName().toLowerCase(), entities); if (!parents.isEmpty()) { mainMsg += msg.format(" {0} {1}", getPluralRelationship(), parents); } } return mainMsg; }
public boolean isFiltering() { return !showDefiningAxioms || !axiomTypes.containsAll(AxiomType.AXIOM_TYPES) || !entityTypes.containsAll(EntityType.values()); }