org.apache.jena.ontology.ObjectProperty Java Examples

The following examples show how to use org.apache.jena.ontology.ObjectProperty. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractRdfEntityGraphConsumer.java    From baleen with Apache License 2.0 6 votes vote down vote up
private ObjectProperty addRelationToModel(OntModel model, Edge e) {
  Individual source = model.getIndividual(namespace + e.outVertex().id());
  Individual target = model.getIndividual(namespace + e.inVertex().id());
  ObjectProperty property = model.getObjectProperty(namespace + e.label());

  if (source != null && target != null && property != null) {
    source.addProperty(property, target);
    return property;
  } else {
    getMonitor()
        .warn(
            "Missing individuals {} or {} or relation {}",
            e.outVertex(),
            e.inVertex(),
            e.label());
    return null;
  }
}
 
Example #2
Source File: ModelStorage.java    From FCA-Map with GNU General Public License v3.0 5 votes vote down vote up
private void acquireObjectProperties() {
  for (ExtendedIterator<ObjectProperty> it = ontModel.listObjectProperties(); it.hasNext(); ) {
    ObjectProperty p = it.next();
    if (isIgnoredObjectProperty(p)) continue;
    objectProperties.add(p);
  }
}
 
Example #3
Source File: OntModelWrapper.java    From FCA-Map with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Acquire object properties and skip the ignored one
 */
private void acquireObjectProperties() {
  for (ExtendedIterator<ObjectProperty> it = m_ontology.listObjectProperties(); it.hasNext(); ) {
    ObjectProperty p = it.next();
    if (isSkipProperty(p)) continue;
    m_object_properties.add(p);
  }
}
 
Example #4
Source File: RDFToManifest.java    From incubator-taverna-language with Apache License 2.0 5 votes vote down vote up
private List<Agent> getAgents(URI base, Individual in,
		ObjectProperty property) {
	List<Agent> creators = new ArrayList<>();
	for (Individual agent : listObjectProperties(in, property)) {
		Agent a = new Agent();

		// Check for any ORCIDs, note that "orcid" is mapped as
		// prov:alternateOf in our modified bundle.jsonld
		for (Individual alternate : listObjectProperties(agent, prov.alternateOf)) {
			if (alternate.isURIResource() && (
					alternate.getURI().startsWith("https://orcid.org/") ||
					alternate.getURI().startsWith("http://orcid.org/"))) {
				// TODO: Check against https://support.orcid.org/knowledgebase/articles/116780-structure-of-the-orcid-identifier
				a.setOrcid(URI.create(alternate.getURI()));
				break;
			}
		}
		if (agent.isURIResource()) {
			URI agentURI = relativizeFromBase(agent.getURI(), base);
			if ("orcid.org".equals(agentURI.getHost()) && a.getOrcid() == null) {
				a.setOrcid(agentURI);
			} else {
				a.setUri(agentURI);
			}
		}

		RDFNode name = agent.getPropertyValue(foaf.name);
		if (name != null && name.isLiteral())
			a.setName(name.asLiteral().getLexicalForm());
		creators.add(a);
	}
	return creators;
}
 
Example #5
Source File: RDFToManifest.java    From incubator-taverna-language with Apache License 2.0 5 votes vote down vote up
private Set<Individual> listObjectProperties(OntResource ontResource,
		ObjectProperty prop) {
	LinkedHashSet<Individual> results = new LinkedHashSet<>();
	try (ClosableIterable<RDFNode> props = iterate(ontResource
			.listPropertyValues(prop))) {
		for (RDFNode node : props) {
			if (!node.isResource() || !node.canAs(Individual.class))
				continue;
			results.add(node.as(Individual.class));
		}
	}
	return results;
}
 
Example #6
Source File: OwlSchemaFactory.java    From baleen with Apache License 2.0 5 votes vote down vote up
private void addRelation(
    OntModel ontModel, OntClass domain, OntClass range, String property, String comment) {
  ObjectProperty objectProperty = ontModel.createObjectProperty(namespace + property);
  objectProperty.addComment(comment, EN);
  objectProperty.setDomain(domain);
  objectProperty.setRange(range);
}
 
Example #7
Source File: AbstractRdfDocumentGraphConsumer.java    From baleen with Apache License 2.0 5 votes vote down vote up
private ObjectProperty addRelationToModel(OntModel model, Edge e) {
  Individual source = model.getIndividual(namespace + e.outVertex().id());
  Individual target = model.getIndividual(namespace + e.inVertex().id());

  ObjectProperty property = model.getObjectProperty(namespace + e.label());
  source.addProperty(property, target);

  return property;
}
 
Example #8
Source File: ModelStorage.java    From FCA-Map with GNU General Public License v3.0 4 votes vote down vote up
public Set<ObjectProperty> getObjectProperties() {
  return objectProperties;
}
 
Example #9
Source File: ModelStorage.java    From FCA-Map with GNU General Public License v3.0 4 votes vote down vote up
private static final boolean isIgnoredObjectProperty(ObjectProperty p) {
  // XXX:
  return false;
}
 
Example #10
Source File: OntModelWrapper.java    From FCA-Map with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Get the hash set of object properties
 *
 * @return m_object_properties
 */
public Set<ObjectProperty> getObjectProperties() {
  return m_object_properties;
}