org.semanticweb.owlapi.model.OWLProperty Java Examples

The following examples show how to use org.semanticweb.owlapi.model.OWLProperty. 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: OntologySolrLoader.java    From owltools with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public SolrInputDocument collect(OWLObject obj, OWLGraphWrapper graph) {

		SolrInputDocument cls_doc = new SolrInputDocument();

		// General for all ontology objects.
		cls_doc.addField("id", graph.getIdentifier(obj));
		cls_doc.addField("label", graph.getLabel(obj));
		cls_doc.addField("description", graph.getDef(obj));
		
		if (obj instanceof OWLClass)
			 collectClass(cls_doc, graph, (OWLClass)obj);
		else if (obj instanceof OWLIndividual)
			 collectIndividual(cls_doc, (OWLIndividual)obj);
		else if (obj instanceof OWLProperty)
			 collectProperty(cls_doc, (OWLProperty)obj);
		return cls_doc; 
	}
 
Example #2
Source File: XgmmlWriter.java    From owltools with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private void writeEdges(XMLStreamWriter writer, OWLObject c, List<OWLObject> allClasses, OWLGraphWrapper graph, List<GafDocument> gafs) throws XMLStreamException {

		String id = getId(graph.getIdentifier(c));
		Set<OWLGraphEdge> edges = graph.getOutgoingEdges(c);
		for (OWLGraphEdge owlGraphEdge : edges) {
			OWLObject target = owlGraphEdge.getTarget();
			if (!allClasses.contains(target))
				continue;
			String tid = getId(graph.getIdentifier(target));
			OWLQuantifiedProperty qp = owlGraphEdge.getSingleQuantifiedProperty();
			OWLProperty p = qp.getProperty();
			String pid;
			if (p == null) {
				pid = qp.getQuantifier().toString();
			}
			else {
				pid = getId(graph.getIdentifier(p));
				if (pid == null) {
					pid = "UNK";
				}
			}
			String eid = id+" ("+pid+") "+tid;
			writer.writeStartElement("edge");
			writer.writeAttribute("id", eid);
			writer.writeAttribute("label", eid);
			writer.writeAttribute("source", id);
			writer.writeAttribute("target", tid);
			writer.writeStartElement("att");
			writer.writeAttribute("name","interaction");
			writer.writeAttribute("value",pid);
			writer.writeEndElement(); // att

			writer.writeEndElement(); // edge

		}
	}
 
Example #3
Source File: PropertyExtractor.java    From owltools with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * 
 * @param newIRI
 * @return ontology
 * @throws OWLOntologyCreationException
 */
public OWLOntology extractPropertyOntology(IRI newIRI) throws OWLOntologyCreationException {
	Set<OWLProperty> props = new HashSet<OWLProperty>();
	for (OWLObjectProperty p : mainOntology.getObjectPropertiesInSignature(Imports.INCLUDED)) {
		LOG.info("mainOntology contains: "+p);
		props.add(p);
	}
	return extractPropertyOntology(newIRI, props);
}
 
Example #4
Source File: DeleteRuleWithConceptOrPropertyNotInAbox.java    From quetzal with Eclipse Public License 2.0 5 votes vote down vote up
public OWLProperty getNamedProperty(OWLPropertyExpression propexp) {
	OWLProperty ret;
	if (!propexp.isAnonymous()) {
		if (propexp.isDataPropertyExpression()) {
			ret = ((OWLDataPropertyExpression) propexp).asOWLDataProperty();;
		} else {
			ret = ((OWLObjectPropertyExpression) propexp).asOWLObjectProperty();
		}
	} else {
		assert propexp.isObjectPropertyExpression();
		ret = ((OWLObjectPropertyExpression) propexp).getNamedProperty();
	}
	return ret;
}
 
Example #5
Source File: PropertyVisitor.java    From OWL2VOWL with MIT License 4 votes vote down vote up
public PropertyVisitor(VowlData vowlData, OWLProperty owlObjectProperty) {
	this.vowlData = vowlData;
	this.owlObjectProperty = owlObjectProperty;
}
 
Example #6
Source File: OntologySolrLoader.java    From owltools with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
private void collectProperty(SolrInputDocument d, OWLProperty obj) {
}
 
Example #7
Source File: OWLView.java    From relex with Apache License 2.0 4 votes vote down vote up
public void initOntology()
{
	try
	{
		//Auxiliar structures
		//map_owl_relexwords = new HashMap<String,OWLIndividual>();
		map_owl_properties = new HashMap<String,OWLProperty>();

		// OWLOntologyManager that manages a set of ontologies
		manager = OWLManager.createOWLOntologyManager();

		// URI of the ontology
		ontologyURI = URI.create("http://student.dei.uc.pt/~racosta/relex/owl_format.owl");

		// Pphysical URI
		physicalURI = URI.create("file:/media/Docs/uc/MSc-2/SW/Project/ontologies/relex2.owl");

		// Set up a mapping, which maps the ontology URI to the physical URI
		OWLOntologyIRIMapper mapper = new SimpleIRIMapper(IRI.create(ontologyURI),IRI.create(physicalURI));
		manager.addIRIMapper(mapper);

		// Now create the ontology - we use the ontology URI
		ontology = manager.createOntology(IRI.create(physicalURI));
		//Data factory, allows to manipulate ontology data
		factory = manager.getOWLDataFactory();

		sentence = factory.getOWLClass(IRI.create(ontologyURI + "#Sentence"));
		word = factory.getOWLClass(IRI.create(ontologyURI + "#Word"));
		//relex_word = factory.getOWLClass(IRI.create(ontologyURI + "#Relex_word"));

		//Generic properties for classes
		has = factory.getOWLObjectProperty(IRI.create(ontologyURI + "#relex_has"));
		//map_owl_properties.put("type",factory.getOWLObjectProperty(IRI.create(ontologyURI + "#type")));

		// word is subclass of phrase
		//OWLAxiom subclassing = factory.getOWLSubClassAxiom(word, sentence);

		// Add the axiom to the ontology
		//AddAxiom addAxiom = new AddAxiom(ontology, subclassing);
		// We now use the manager to apply the change
		//manager.applyChange(addAxiom);

		//2ยบ Add the predefined properties

		/*map_owl_properties.put("tense",factory.getOWLObjectProperty(IRI.create(ontologyURI + * "#p_tense")));
		map_owl_properties.put("index",factory.getOWLDataProperty(IRI.create(ontologyURI + "#p_index")));
		//Add possible relex words
		map_owl_relexwords.put("masculine",factory.getOWLNamedIndividual(IRI.create(ontologyURI + "#rw_masculine")));
		map_owl_relexwords.put("feminine",factory.getOWLNamedIndividual(IRI.create(ontologyURI + "#rw_feminine")));
		map_owl_relexwords.put("person",factory.getOWLNamedIndividual(IRI.create(ontologyURI + "#rw_person")));
		map_owl_relexwords.put("neuter",factory.getOWLNamedIndividual(IRI.create(ontologyURI + "#rw_neuter")));*/

		/*OWLObjectProperty number = factory.getOWLObjectProperty(IRI.create(ontologyURI + "#number"));
		OWLObjectProperty tense = factory.getOWLObjectProperty(IRI.create(ontologyURI + "#tense"));
		OWLObjectProperty query = factory.getOWLObjectProperty(IRI.create(ontologyURI + "#query"));
		OWLObjectProperty quantification = factory.getOWLObjectProperty(IRI.create(ontologyURI + "#quantification"));*/

		// Add axioms to the ontology
		//OWLAxiom genderax = factory.getOWLObjectProperty(infinitive);

		//Phrase Individuals
		/*phr_type_map_owl = new HashMap<String,OWLIndividual>();
		phr_type_map_owl.put("Adverbial Phrase", factory.getOWLNamedIndividual(IRI.create(ontologyURI + "#rw_adjective")));
		phr_type_map_owl.put("Adverbial Phrase", factory.getOWLNamedIndividual(IRI.create(ontologyURI + "#rw_adverb")));
		phr_type_map_owl.put("Noun Phrase",      factory.getOWLNamedIndividual(IRI.create(ontologyURI + "#rw_noun")));
		phr_type_map_owl.put("Prepositional Phrase", factory.getOWLNamedIndividual(IRI.create(ontologyURI + "#rw_prepositional")));
		phr_type_map_owl.put("Particle",         factory.getOWLNamedIndividual(IRI.create(ontologyURI + "#rw_particle")));
		phr_type_map_owl.put("Quantifier Phrase", factory.getOWLNamedIndividual(IRI.create(ontologyURI + "#rw_quantifier")));
		phr_type_map_owl.put("Clause",           factory.getOWLNamedIndividual(IRI.create(ontologyURI + "#rw_clause")));
		phr_type_map_owl.put("Subordinate Clause", factory.getOWLNamedIndividual(IRI.create(ontologyURI + "#rw_subordinate")));
		phr_type_map_owl.put("Subject Inverted", factory.getOWLNamedIndividual(IRI.create(ontologyURI + "#rw_inverted")));
		phr_type_map_owl.put("Sentence",         factory.getOWLNamedIndividual(IRI.create(ontologyURI + "#rw_root")));
		phr_type_map_owl.put("Verb Phrase",      factory.getOWLNamedIndividual(IRI.create(ontologyURI + "#rw_verb")));
		phr_type_map_owl.put("Wh-Adverb Phrase", factory.getOWLNamedIndividual(IRI.create(ontologyURI + "#rw_wh-adverb")));
		phr_type_map_owl.put("Wh-Noun Phrase",   factory.getOWLNamedIndividual(IRI.create(ontologyURI + "#rw_wh-noun")));
		phr_type_map_owl.put("Wh-Prepositional Phrase", factory.getOWLNamedIndividual(IRI.create(ontologyURI + "#rw_wh-prep")));*/

		//Add all the phr_type_map_owl Individuals to the Relex_word Class
		/*Set<String> s = phr_type_map_owl.keySet();
		for (Iterator<String> it = s.iterator(); it.hasNext();)
		{
			manager.applyChange(new AddAxiom(ontology, factory.getOWLClassAssertionAxiom(phr_type_map_owl.get(it.next()), relex_word)));
		}

		//Add all the map_owl_relexwords Individuals to the Relex_word Class
		s = map_owl_relexwords.keySet();
		for (Iterator<String> it = s.iterator(); it.hasNext();)
		{
			manager.applyChange(new AddAxiom(ontology, factory.getOWLClassAssertionAxiom(map_owl_relexwords.get(it.next()), relex_word)));
		}*/

	}
	catch (OWLException e)
	{
		e.printStackTrace();
	}
}