All Downloads are FREE. Search and download functionalities are using the official Maven repository.

it.uniroma2.art.owlart.model.syntax.manchester.ObjectIntersectionOf Maven / Gradle / Ivy

package it.uniroma2.art.owlart.model.syntax.manchester;

import it.uniroma2.art.owlart.models.OWLModel;
import it.uniroma2.art.owlart.exceptions.ModelUpdateException;
import it.uniroma2.art.owlart.model.*;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;


public class ObjectIntersectionOf {
	private int numb;//numero degli oggetti che sono in and tra loro
	private Uri uriThat;
	private List and;
	public OWLModel model;
	public ARTResource resource;

	public ObjectIntersectionOf(int number,OWLModel mod) {
		numb=number;
		uriThat=null;
		and=new LinkedList();
		model=mod;
	}

	public ObjectIntersectionOf(OWLModel mod) {
		and=new LinkedList();
		model=mod;
		//System.out.print("Creata intersezione ");
	}

	public int getElements() {
		return numb;
	}

	public String toString() {
	    return "intersection";
	}

	public Uri getUriThat() {
		return uriThat;
	}


	public void setUriThat(Uri uriThat) throws ModelUpdateException {
		this.uriThat = uriThat;
		Atomic thatAto= new Atomic(uriThat,model);
		and.add(new Primary(false,thatAto,model));
	}

	public void addPrimary(Primary p) {
		and.add(p);
	}

	public ARTResource computeIntersection() throws ModelUpdateException  {
		ARTBNode b=model.createBNode();
		ListIterator andIterator=and.listIterator();
		ArrayList res=new ArrayList();
		if(and.size()==1) {
		    resource=andIterator.next().resource;
		    return resource;
		}
		while(andIterator.hasNext()) {
			ARTResource art=andIterator.next().resource;
			res.add(art);
		}
		model.addIntersectionOf(b.getID(), res);

		resource=b;

		return b;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy