com.hp.hpl.jena.vocabulary.OWL Java Examples

The following examples show how to use com.hp.hpl.jena.vocabulary.OWL. 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: Property.java    From xcurator with Apache License 2.0 6 votes vote down vote up
public Resource createRDFProperty(
        Model model, Resource parentResource, Element item, Document dataDoc) throws XPathExpressionException {

    com.hp.hpl.jena.rdf.model.Property jenaProperty = getJenaProperty(model);
    Resource res = null;
    NodeList nodeList = XMLUtils.getNodesByPath(path, item, dataDoc);
    for (int i = 0; i < nodeList.getLength(); i++) {
        Node node = nodeList.item(i);
        String value = node.getTextContent();
        res = parentResource.addProperty(jenaProperty, value);
    }

    for (String uri : ontologyTypes) {
        jenaProperty.addProperty(OWL.equivalentProperty, model.createResource(uri));
    }

    return res;
}
 
Example #2
Source File: OntologyTarget.java    From GeoTriples with Apache License 2.0 5 votes vote down vote up
public OntologyTarget() {
	model.setNsPrefix("rdf", RDF.getURI());
	model.setNsPrefix("rdfs", RDFS.getURI());
	model.setNsPrefix("owl", OWL.getURI());
	model.setNsPrefix("dc", DC.getURI());
	model.setNsPrefix("xsd", XSD.getURI());
}
 
Example #3
Source File: OntologyTarget.java    From GeoTriples with Apache License 2.0 5 votes vote down vote up
public 	void init(String baseIRI, Resource generatedOntology, 
		boolean serveVocabulary, boolean generateDefinitionLabels) {
	Resource ont = generatedOntology.inModel(model);
	ont.addProperty(RDF.type, OWL.Ontology);
	ont.addProperty(OWL.imports, 
			model.getResource(MappingGenerator.dropTrailingHash(DC.getURI())));
	ont.addProperty(DC.creator, CREATOR);
	this.generatedOntology = ont;
}
 
Example #4
Source File: OntologyTarget.java    From GeoTriples with Apache License 2.0 5 votes vote down vote up
public void generateEntities(Resource class_, TableName table,
		TemplateValueMaker iriTemplate, List<Identifier> blankNodeColumns, boolean isGeometryTable) {
	if (class_ == null) return;
	Resource c = class_.inModel(model);
	c.addProperty(RDF.type, RDFS.Class);
	c.addProperty(RDF.type, OWL.Class);
	c.addProperty(RDFS.label, getLabel(table));
	if (generatedOntology != null) {
		c.addProperty(RDFS.isDefinedBy, generatedOntology);
	}
	classes.put(table, c);
}
 
Example #5
Source File: OntologyTarget.java    From GeoTriples with Apache License 2.0 5 votes vote down vote up
public void generateColumnProperty(Property property, TableName table,
		Identifier column, DataType datatype) {
	Property p = property.inModel(model);
	p.addProperty(RDF.type, RDF.Property);
	p.addProperty(RDF.type, OWL.DatatypeProperty);
	p.addProperty(RDFS.label, getLabel(table, column));
	domains.put(p, table);
	if (datatype.rdfType() != null && XSD.xstring.getURI().equals(datatype.rdfType())) {
		p.addProperty(RDFS.range, model.getResource(datatype.rdfType()));
	}
	if (generatedOntology != null) {
		p.addProperty(RDFS.isDefinedBy, generatedOntology);
	}
}
 
Example #6
Source File: OntologyTarget.java    From GeoTriples with Apache License 2.0 5 votes vote down vote up
public void generateRefProperty(Property property, TableName table,
		ForeignKey foreignKey) {
	Property p = property.inModel(model);
	p.addProperty(RDF.type, RDF.Property);
	p.addProperty(RDF.type, OWL.ObjectProperty);
	p.addProperty(RDFS.label, getLabel(table, foreignKey.getLocalColumns()));
	domains.put(p, table);
	ranges.put(p, foreignKey.getReferencedTable());
	if (generatedOntology != null) {
		p.addProperty(RDFS.isDefinedBy, generatedOntology);
	}
}
 
Example #7
Source File: OntologyTarget.java    From GeoTriples with Apache License 2.0 5 votes vote down vote up
public void generateLinkProperty(Property property, TableName table,
		ForeignKey fk1, ForeignKey fk2) {
	Property p = property.inModel(model);
	p.addProperty(RDF.type, RDF.Property);
	p.addProperty(RDF.type, OWL.ObjectProperty);
	p.addProperty(RDFS.label, getLabel(table));
	domains.put(p, fk1.getReferencedTable());
	ranges.put(p, fk2.getReferencedTable());
	if (generatedOntology != null) {
		p.addProperty(RDFS.isDefinedBy, generatedOntology);
	}
}
 
Example #8
Source File: NeoGraph.java    From neo4jena with Apache License 2.0 5 votes vote down vote up
@Override
public PrefixMapping getPrefixMapping() {
	if(mapping==null)  {
		PrefixMapping standard = PrefixMapping.Factory.create()
			.setNsPrefix( "rdfs", RDFS.getURI() )
			.setNsPrefix( "rdf", RDF.getURI() )
			.setNsPrefix( "dc", DC_11.getURI() )
			.setNsPrefix( "owl", OWL.getURI() )
			.setNsPrefix( "xsd", XSD.getURI() );
		mapping = new NeoPrefixMapping(null, standard);
	}
	return mapping;
}
 
Example #9
Source File: AbstractMDRResource.java    From semanticMDR with GNU General Public License v3.0 4 votes vote down vote up
public AbstractMDRResource(Node n, EnhGraph g, MDRDatabase mdrDatabase) {
	super(n,g);
	this.setRDFType(OWL.Class);
	this.mdrDatabase = mdrDatabase;
}