if (!p.isURIResource()) continue; if (!properties.containsKey(p.getURI())) properties.put(p.getURI(), ontHandler.getResourceLabel(p)); if (p.isDatatypeProperty() || !p.isObjectProperty()) if (!dataProperties.containsKey(p.getURI())) dataProperties.put(p.getURI(), ontHandler.getResourceLabel(p)); if (p.isObjectProperty() || !p.isDatatypeProperty()) if (p.getRange() != null && p.getRange().hasURI(Namespaces.RDFS + "Literal")) { if (!dataProperties.containsKey(p.getURI())) { dataProperties.put(p.getURI(), ontHandler.getResourceLabel(p)); } else if (!objectProperties.containsKey(p.getURI())) objectProperties.put(p.getURI(), ontHandler.getResourceLabel(p));
public static void main2( String[] args ) { final String NS = "http://stackoverflow.com/q/20194409/1281433/"; final OntModel model = ModelFactory.createOntologyModel( OntModelSpec.RDFS_MEM ); OntProperty p = model.createOntProperty( NS+"PropertyName" ); p.addDomain( model.getOntClass( NS+"ClassName" )); p.addRange( RDFS.Literal ); model.write( System.out, "RDF/XML-ABBREV" ); }
@Override public int getRatingForSemanticAnnotation( SemanticAnnotationProfile semanticAnnotationProfile) { OntProperty property = semanticAnnotationProfile.getPredicate(); if (property != null && property.isAnnotationProperty()) return 100; return MIN_VALUE; }
if (property == null || !property.isURIResource()) continue; ExtendedIterator<? extends OntResource> itrDomains = property.listDomain(); while (itrDomains.hasNext()) { d = itrDomains.next(); temp = propertyDirectDomains.get(property.getURI()); if (temp == null) propertyDirectDomains.put(property.getURI(), directDomainsUris); else temp.addAll(directDomainsUris); temp.add(property.getURI()); temp = propertyIndirectDomains.get(property.getURI()); if (temp == null) propertyIndirectDomains.put(property.getURI(), indirectDomainsUris); else temp.addAll(indirectDomainsUris); temp.add(property.getURI()); ExtendedIterator<? extends OntResource> itrRanges = property.listRange(); while (itrRanges.hasNext()) { r = itrRanges.next(); temp = propertyDirectRanges.get(property.getURI()); if (temp == null)
@Override public int getRatingForSemanticAnnotation( SemanticAnnotationProfile semanticAnnotationProfile) { OntProperty property = semanticAnnotationProfile.getPredicate(); if ((property != null) && property.isDatatypeProperty()) return 100; return MIN_VALUE; }
/** * Returns the individuals in the range of the predicate defined in the * ontology. * * @return the individuals in the range of the predicate defined in the * ontology */ public List<Individual> getIndividuals() { OntModel ontology = getOntology(); OntProperty prop = getPredicate(); if (ontology == null || prop == null) { return new ArrayList<Individual>(); } OntResource range = prop.getRange(); if (range == null) { return new ArrayList<Individual>(); } return ontology.listIndividuals(range).toList(); }
protected void createAndRegisterBeanEditor(OntProperty property, OntResource domain) { createAndRegisterBeanEditor(property.getLocalName(), extractClass(domain.asClass()), null); }
@Override public int getRatingForSemanticAnnotation( SemanticAnnotationProfile semanticAnnotationProfile) { OntProperty property = semanticAnnotationProfile.getPredicate(); if (property != null && property.isObjectProperty()) /* * && !semanticAnnotationProfile.getIndividuals().isEmpty() */ return 100; return MIN_VALUE; }
.hasNext();) { OntProperty p = i.next(); String fred = p.getURI(); @SuppressWarnings("unused") String bob = fred;
/** * <p>Add a sub-property of this property.</p> * @param prop A property that is a sub-property of this property. * @exception OntProfileException If the {@link Profile#SUB_PROPERTY_OF()} property is not supported in the current language profile. */ @Override public void addSubProperty( Property prop ) { prop.as( OntProperty.class ).addSuperProperty( this ); }
if (property == null || !property.isURIResource()) continue; ExtendedIterator<? extends OntResource> itrDomains = property.listDomain(); while (itrDomains.hasNext()) { d = itrDomains.next(); temp = propertyDirectDomains.get(property.getURI()); if (temp == null) propertyDirectDomains.put(property.getURI(), directDomainsUris); else temp.addAll(directDomainsUris); temp.add(property.getURI()); temp = propertyIndirectDomains.get(property.getURI()); if (temp == null) propertyIndirectDomains.put(property.getURI(), indirectDomainsUris); else temp.addAll(indirectDomainsUris); temp.add(property.getURI()); ExtendedIterator<? extends OntResource> itrRanges = property.listRange(); while (itrRanges.hasNext()) { r = itrRanges.next(); temp = propertyDirectRanges.get(property.getURI()); if (temp == null)
@Override public int getRatingForSemanticAnnotation( SemanticAnnotationProfile semanticAnnotationProfile) { OntProperty property = semanticAnnotationProfile.getPredicate(); if (property != null && property.isDatatypeProperty()) return 100; return MIN_VALUE; }
/** * Returns the individuals in the range of the predicate defined in the * ontology. * * @return the individuals in the range of the predicate defined in the * ontology */ public List<Individual> getIndividuals() { OntModel ontology = getOntology(); OntProperty prop = getPredicate(); if (ontology == null || prop == null) return new ArrayList<Individual>(); OntResource range = prop.getRange(); if (range == null) return new ArrayList<Individual>(); return ontology.listIndividuals(range).toList(); }
private void preprocessRestriction(Restriction restriction) { OntProperty ontProperty = restriction.getOnProperty(); Set<PropertyEditor> propertyEditors = propertyToEditorMap.get( ontProperty.getLocalName()); if (propertyEditors == null) { throw new IllegalBioPAXArgumentException("No editors for property " + ontProperty.getLocalName());
@Override public int getRatingForSemanticAnnotation( SemanticAnnotationProfile semanticAnnotationProfile) { OntProperty property = semanticAnnotationProfile.getPredicate(); if ((property != null) && property.isObjectProperty() /* * && * !semanticAnnotationProfile.getIndividuals * ().isEmpty() */) return 100; return MIN_VALUE; }
/** * Returns the inverseOf property of the property with given URI * @param uri * @return */ public Label getInverseOfProperty(String uri) { ObjectProperty op = ontModel.getObjectProperty(uri); if (op == null) return null; OntProperty inverseOfProp = null; try { inverseOfProp = op.getInverse(); } catch (ConversionException e) { logger.error(e.getMessage()); } if (inverseOfProp != null) { return getUriLabel(inverseOfProp.getURI()); } else return null; }
/** * <p>Assert that this property is super-property of the given property. Any existing * statements for <code>subPropertyOf</code> on <code>prop</code> will be removed.</p> * @param prop The property that is a sub-property of this property * @exception OntProfileException If the {@link Profile#SUB_PROPERTY_OF()} property is not supported in the current language profile. */ @Override public void setSubProperty( Property prop ) { // first we have to remove all of the inverse sub-prop links checkProfile( getProfile().SUB_PROPERTY_OF(), "SUB_PROPERTY_OF" ); for (StmtIterator i = getModel().listStatements( null, getProfile().SUB_PROPERTY_OF(), this ); i.hasNext(); ) { i.removeNext(); } prop.as( OntProperty.class ).addSuperProperty( this ); }
@Override public int getRatingForSemanticAnnotation( SemanticAnnotationProfile semanticAnnotationProfile) { OntProperty property = semanticAnnotationProfile.getPredicate(); if ((property != null) && property.isDatatypeProperty() && DateTimeString.equals(semanticAnnotationProfile .getClassString())) return 200; return MIN_VALUE; }
public OntClass getRangeClass() { String clazz = this.getClassString(); if (clazz != null) return componentProfile.getClass(clazz); OntProperty prop = getPredicate(); if (prop == null) return null; OntResource range = prop.getRange(); if (range != null && range.isClass()) return range.asClass(); return null; } }