Java Code Examples for com.hp.hpl.jena.vocabulary.RDFS

The following are top voted examples for showing how to use com.hp.hpl.jena.vocabulary.RDFS. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: DocIT   File: Containment.java   Source Code and License 6 votes vote down vote up
public static boolean checkContainment(CompanyModel c){
	String queryString = 
		"ASK" +
			// check whether any manager is an employee in any other department
			"{?dept1"        + " <" + c.MANAGER   + "> " + "?manager"         + ". " +
			" ?dept2"		 + " <" + c.EMPLOYEES + "> " + "?employees1"      + ". " +
			" ?employees1"   + " <" + RDFS.member + "> " + "?employee1"       + ". " +
			" FILTER (?manager = ?employee1) " +
			
			// check whether any employee occurs more than once
			" ?dept3 "		 + " <" + c.EMPLOYEES + "> " + "?employees2"      + ". " +
			" ?employees2"   + " <" + RDFS.member + "> " + "?employee2"       + ". " +
			" FILTER (?employee1 = ?employee2)" +
			
			// check whether any department occurs more than once
			" ?upperDept1"   + " <" + c.DEPTS     + "> " + "?dept4"           + ". " +
			" ?upperDept2"   + " <" + c.DEPTS     + "> " + "?dept5"           + ". " +
			" FILTER (?dept4 = ?dept5) " +
			"}";
	
	Query query = QueryFactory.create(queryString);
	QueryExecution qe = QueryExecutionFactory.create(query, c.getModel());
	boolean out = qe.execAsk();
	qe.close();
	return !out;
}
 
Example 2
Project: ontonethub   File: IndexingJob.java   Source Code and License 6 votes vote down vote up
private List<Statement> expandSubClasses(Model model){
	List<Statement> stmts = new ArrayList<Statement>();
	
	
	String sparql = "PREFIX rdfs: <" + RDFS.getURI() + ">"
			+ "SELECT DISTINCT ?class ?synonym "
			+ "WHERE { "
			+ "?class rdfs:subClassOf+ ?subClass . "
			+ "?subClass <" + synonym + "> ?synonym"
			+ "}";
	
	Query query = QueryFactory.create(sparql, Syntax.syntaxARQ);
	QueryExecution queryExecution = QueryExecutionFactory.create(query, model);
	ResultSet resultSet = queryExecution.execSelect();
	resultSet.forEachRemaining(querySolution -> {
		stmts.add(new StatementImpl(querySolution.getResource("class"), synonym, querySolution.getLiteral("synonym")));
	});
	return stmts;
}
 
Example 3
Project: ontonethub   File: IndexingJob.java   Source Code and License 6 votes vote down vote up
private List<Statement> expandSubProperties(Model model){
	List<Statement> stmts = new ArrayList<Statement>();
	
	String sparql = "PREFIX rdfs: <" + RDFS.getURI() + ">"
			+ "SELECT DISTINCT ?property ?synonym "
			+ "WHERE { "
			+ "?property rdfs:subPropertyOf+ ?subProperty . "
			+ "?subProperty <" + synonym + "> ?synonym"
			+ "}";
	
	Query query = QueryFactory.create(sparql, Syntax.syntaxARQ);
	QueryExecution queryExecution = QueryExecutionFactory.create(query, model);
	ResultSet resultSet = queryExecution.execSelect();
	resultSet.forEachRemaining(querySolution -> {
		stmts.add(new StatementImpl(querySolution.getResource("property"), synonym, querySolution.getLiteral("synonym")));
	});
	return stmts;
}
 
Example 4
Project: c4a_data_repository   File: ClassMapServlet.java   Source Code and License 6 votes vote down vote up
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
	D2RServer server = D2RServer.fromServletContext(getServletContext());
	server.checkMappingFileChanged();
	if (request.getPathInfo() == null) {
		new ModelResponse(classMapListModel(), request, response).serve();
		return;
	}
	String classMapName = request.getPathInfo().substring(1);
	Model resourceList = getClassMapLister().classMapInventory(classMapName);
	if (resourceList == null) {
		response.sendError(404, "Sorry, class map '" + classMapName + "' not found.");
		return;
	}
   	Resource classMap = resourceList.getResource(server.baseURI() + "all/" + classMapName);
   	Resource directory = resourceList.createResource(server.baseURI() + "all");
   	classMap.addProperty(RDFS.seeAlso, directory);
   	classMap.addProperty(RDFS.label, "List of all instances: " + classMapName);
   	directory.addProperty(RDFS.label, "D2R Server contents");
   	server.addDocumentMetadata(resourceList, classMap);
	new ModelResponse(resourceList, request, response).serve();
}
 
Example 5
Project: c4a_data_repository   File: ExprTransformTest2.java   Source Code and License 6 votes vote down vote up
public void testLang()
{
	List<Triple> pattern = new ArrayList<Triple>();
	pattern.add(Triple.create(Node.createVariable("s"), RDFS.label.asNode(), Node.createVariable("o")));
	NodeRelation[] rels = translate(pattern, "optimizer/filtertests.n3");
	
	NodeRelation label_fr_be  = search("table1", "label_fr_be", rels);
	NodeRelation label_en     = search("table1", "label_en", rels);
	NodeRelation label_noLang = search("table1", "label", rels);
	
	Expr filterFR    = new E_Equals(new E_Lang(new ExprVar("o")), NodeValue.makeString("fr"));
	Expr filterEN_TAG_EN = new E_Equals(new E_Lang(new ExprVar("o")), NodeValue.makeNode("en", "en", (String) null));
	Expr filterFR_BE = new E_Equals(new E_Lang(new ExprVar("o")), NodeValue.makeString("fr-BE"));
	Expr filter      = new E_Equals(new E_Lang(new ExprVar("o")), NodeValue.makeString(""));
	
	assertEquals("LANG(label_fr_be) = \"fr\" should be FALSE",   Expression.FALSE, TransformExprToSQLApplyer.convert(filterFR, label_fr_be));
	assertEquals("LANG(label_en) = \"fr\" should be FALSE",      Expression.FALSE, TransformExprToSQLApplyer.convert(filterFR, label_en));
	assertEquals("LANG(label_fr_be) = \"fr_be\" should be TRUE", Expression.TRUE,  TransformExprToSQLApplyer.convert(filterFR_BE, label_fr_be));
	assertEquals("LANG(label_en) = \"en\"@en should be FALSE",   Expression.FALSE, TransformExprToSQLApplyer.convert(filterEN_TAG_EN, label_en));
	assertEquals("LANG(label_noLang) = \"\" should be TRUE",     Expression.TRUE,  TransformExprToSQLApplyer.convert(filter, label_noLang));
}
 
Example 6
Project: c4a_data_repository   File: ExprTransformTest2.java   Source Code and License 6 votes vote down vote up
public void testDataType()
{
	List<Triple> pattern = new ArrayList<Triple>();
	pattern.add(Triple.create(Node.createVariable("s"), Node.createURI("http://example.org/value"), Node.createVariable("o")));
	NodeRelation[] rels = translate(pattern, "optimizer/filtertests.n3");
	
	NodeRelation intvalue = search("table2", "intvalue", rels);
	NodeRelation value = search("table2", "value", rels);
	
	pattern.clear();
	pattern.add(Triple.create(Node.createVariable("s"), RDFS.label.asNode(), Node.createVariable("o")));
	rels = translate(pattern, "optimizer/filtertests.n3");
	
	NodeRelation langliteral = search("table1", "label_en", rels);
	
	Expr filterint    = new E_Equals(new E_Datatype(new ExprVar("o")), NodeValueNode.makeNode(Node.createURI(XSDDatatype.XSDint.getURI())));
	Expr filterstring = new E_Equals(new E_Datatype(new ExprVar("o")), NodeValueNode.makeNode(Node.createURI(XSDDatatype.XSDstring.getURI())));
	
	assertEquals("DATATYPE(intliteral) = xsd:int should be TRUE",       Expression.TRUE, TransformExprToSQLApplyer.convert(filterint, intvalue));
	assertEquals("DATATYPE(simpleliteral) = xsd:string should be TRUE", Expression.TRUE, TransformExprToSQLApplyer.convert(filterstring, value));
	assertEquals("DATATYPE(langliteral) = xsd:string should be TRUE",   Expression.TRUE, TransformExprToSQLApplyer.convert(filterstring, langliteral));
}
 
Example 7
Project: Ifc2Rdf   File: Ifc2RdfSchemaExporter.java   Source Code and License 6 votes vote down vote up
private void exportEnumerationTypeInfo(IfcEnumerationTypeInfo typeInfo) {
		
		String typeUri = super.formatTypeName(typeInfo);
		Resource typeResource = createUriResource(typeUri);

		if (!context.isEnabledOption(Ifc2RdfConversionOptionsEnum.ForceConvertEnumerationValuesToString)) {
			adapter.exportTriple(typeResource, RDF.type, OWL.Class);
			List<Resource> nodes = new ArrayList<>();
			List<String> enumValues = typeInfo.getValues(); 
			for (String value : enumValues) {
				nodes.add(super.createUriResource(super.formatOntologyName(value)));
			}
			RDFList rdfList = super.createList(nodes);			
			adapter.exportTriple(typeResource, OWL.oneOf, rdfList);
		} else {
			adapter.exportTriple(typeResource, RDF.type, RDFS.Datatype);
			adapter.exportTriple(typeResource, RDFS.subClassOf, XSD.xstring);
			
//			List<String> values = typeInfo.getValues();
//			String valueString = StringUtils.collectionToString(values, "(", ")", String.format("\"%%s\"^^%s", RdfVocabulary.XSD_STRING.getShortForm()), " "); 
//			adapter.writeRdfTriple(ExportAdapter.CURRENT_SUBJECT, OWL.oneOf, valueString);			
		}
		
	}
 
Example 8
Project: Ifc2Rdf   File: Ifc2RdfSchemaExporter.java   Source Code and License 6 votes vote down vote up
private void exportEnumerationTypeInfo(IfcEnumerationTypeInfo typeInfo) {
		
		String typeUri = super.formatTypeName(typeInfo);
		Resource typeResource = createUriResource(typeUri);

		if (!context.isEnabledOption(Ifc2RdfConversionOptionsEnum.ForceConvertEnumerationValuesToString)) {
			adapter.exportTriple(typeResource, RDF.type, OWL.Class);
			List<Resource> nodes = new ArrayList<>();
			List<String> enumValues = typeInfo.getValues(); 
			for (String value : enumValues) {
				nodes.add(super.createUriResource(super.formatOntologyName(value)));
			}
			RDFList rdfList = super.createList(nodes);			
			adapter.exportTriple(typeResource, OWL.oneOf, rdfList);
		} else {
			adapter.exportTriple(typeResource, RDF.type, RDFS.Datatype);
			adapter.exportTriple(typeResource, RDFS.subClassOf, XSD.xstring);
			
//			List<String> values = typeInfo.getValues();
//			String valueString = StringUtils.collectionToString(values, "(", ")", String.format("\"%%s\"^^%s", RdfVocabulary.XSD_STRING.getShortForm()), " "); 
//			adapter.writeRdfTriple(ExportAdapter.CURRENT_SUBJECT, OWL.oneOf, valueString);			
		}
		
	}
 
Example 9
Project: Ifc2Rdf   File: Ifc2RdfSchemaExporter.java   Source Code and License 6 votes vote down vote up
private void exportLiteralTypeInfo(IfcLiteralTypeInfo typeInfo) {
		
		Resource typeResource = super.createUriResource(formatTypeName(typeInfo)); 
//		adapter.exportTriple(typeResource, RDF.type, RDFS.Datatype);
//		adapter.exportTriple(typeResource, OWL.sameAs, super.getXsdDataType(typeInfo));
		
		adapter.exportTriple(typeResource, RDF.type, OWL.Class);
		
		Resource xsdDataType = super.getXsdDataType(typeInfo);
		Property property = getHasProperty(typeInfo);		
		adapter.exportTriple(property, RDF.type, OWL.DatatypeProperty);
		if (owlProfileList.supportsRdfProperty(OWL.FunctionalProperty, null)) {
			adapter.exportTriple(property, RDF.type, RdfVocabulary.OWL.FunctionalDataProperty);
		}
		adapter.exportTriple(property, RDFS.subPropertyOf, Ifc2RdfVocabulary.EXPRESS.hasValue);
		adapter.exportTriple(property, RDFS.domain, typeResource);
		adapter.exportTriple(property, RDFS.range, xsdDataType);
		
//		if (owlProfileList.supportsRdfProperty(OWL.allValuesFrom, null)) {		
//			
//			writePropertyRestriction(typeResource, Ifc2RdfVocabulary.EXPRESS.value, OWL.allValuesFrom, super.getXsdDataType((IfcLiteralTypeInfo)baseTypeInfo));
//		
//		}
		
	}
 
Example 10
Project: OpenCollegeGraph   File: ExprTransformTest2.java   Source Code and License 6 votes vote down vote up
public void testDataType()
{
	List<Triple> pattern = new ArrayList<Triple>();
	pattern.add(Triple.create(Node.createVariable("s"), Node.createURI("http://example.org/value"), Node.createVariable("o")));
	NodeRelation[] rels = translate(pattern, "optimizer/filtertests.n3");
	
	NodeRelation intvalue = search("table2", "intvalue", rels);
	NodeRelation value = search("table2", "value", rels);
	
	pattern.clear();
	pattern.add(Triple.create(Node.createVariable("s"), RDFS.label.asNode(), Node.createVariable("o")));
	rels = translate(pattern, "optimizer/filtertests.n3");
	
	NodeRelation langliteral = search("table1", "label_en", rels);
	
	Expr filterint    = new E_Equals(new E_Datatype(new ExprVar("o")), NodeValueNode.makeNode(Node.createURI(XSDDatatype.XSDint.getURI())));
	Expr filterstring = new E_Equals(new E_Datatype(new ExprVar("o")), NodeValueNode.makeNode(Node.createURI(XSDDatatype.XSDstring.getURI())));
	
	assertEquals("DATATYPE(intliteral) = xsd:int should be TRUE",       Expression.TRUE, TransformExprToSQLApplyer.convert(filterint, intvalue));
	assertEquals("DATATYPE(simpleliteral) = xsd:string should be TRUE", Expression.TRUE, TransformExprToSQLApplyer.convert(filterstring, value));
	assertEquals("DATATYPE(langliteral) = xsd:string should be TRUE",   Expression.TRUE, TransformExprToSQLApplyer.convert(filterstring, langliteral));
}
 
Example 11
Project: Ifc2Rdf   File: Ifc2RdfSchemaExporter.java   Source Code and License 6 votes vote down vote up
private void exportSelectTypeInfo(IfcSelectTypeInfo typeInfo) {
	
	Resource typeResource = super.createUriResource(super.formatTypeName(typeInfo)); 
	adapter.exportTriple(typeResource, RDF.type, OWL.Class);
	adapter.exportTriple(typeResource, RDFS.subClassOf, Ifc2RdfVocabulary.EXPRESS.Select);
	

	List<String> subTypeNames = typeInfo.getSelectTypeInfoNames();
	List<Resource> subTypeResources = new ArrayList<>();
	for (String typeName : subTypeNames) {
		subTypeResources.add(super.createUriResource(super.formatOntologyName(typeName)));
	}
	
	if (owlProfileList.supportsRdfProperty(OWL.unionOf, EnumSet.of(RdfTripleObjectTypeEnum.ZeroOrOneOrMany)) && subTypeResources.size() > 1) {			
		RDFList rdfList = super.createList(subTypeResources);			
		// See samples: [2, p.250]
		adapter.exportTriple(typeResource, OWL.unionOf, rdfList);
	} else {
		subTypeResources.stream().forEach(subTypeResource ->
				adapter.exportTriple((Resource)subTypeResource, RDFS.subClassOf, typeResource));			
	}
	
}
 
Example 12
Project: StreamEventCoreference   File: SemTime.java   Source Code and License 6 votes vote down vote up
public void addToJenaModelDocTimeInterval(Model model) {
    if (this.getPhraseCounts().size() > 0) {
        OwlTime owlTime = new OwlTime();
        owlTime.parsePublicationDate(getPhrase());
        owlTime.addToJenaModelOwlTimeInstant(model);

        Resource resource = model.createResource(this.getURI());
        for (int i = 0; i < this.getPhraseCounts().size(); i++) {
            PhraseCount phraseCount = this.getPhraseCounts().get(i);
            if (!phraseCount.getPhrase().isEmpty()) {
                resource.addProperty(RDFS.label, model.createLiteral(phraseCount.getPhrase()));
            }
        }

        resource.addProperty(RDF.type, Sem.Time);
        Resource interval = model.createResource(ResourcesUri.owltime + "Interval");
        resource.addProperty(RDF.type, interval);

        Resource value = model.createResource(owlTime.getDateStringURI());
        Property property = model.createProperty(ResourcesUri.owltime + "inDateTime");
        resource.addProperty(property, value);
    }
}
 
Example 13
Project: GPML2RDF   File: Utils.java   Source Code and License 6 votes vote down vote up
public static void setModelPrefix(Model model){
	model.setNsPrefix("biopax", Biopax_level3.getURI());
	model.setNsPrefix("gpml", Gpml.getURI());
	model.setNsPrefix("wp", Wp.getURI());
	model.setNsPrefix("xsd", XSD.getURI());
	model.setNsPrefix("rdf", RDF.getURI());
	model.setNsPrefix("rdfs", RDFS.getURI());
	model.setNsPrefix("dcterms", DCTerms.getURI());
	model.setNsPrefix("wprdf", "http://rdf.wikipathways.org/");
	model.setNsPrefix("foaf", FOAF.getURI());
	model.setNsPrefix("dc", DC.getURI());
	model.setNsPrefix("skos", Skos.getURI());
	model.setNsPrefix("void", Void.getURI());
	model.setNsPrefix("wprdf", "http://rdf.wikipathways.org/");
	model.setNsPrefix("pav", Pav.getURI());
	model.setNsPrefix("prov", Prov.getURI());
	model.setNsPrefix("dcterms", DCTerms.getURI());
	model.setNsPrefix("freq", Freq.getURI());
}
 
Example 14
Project: mindraider   File: OutlineCustodian.java   Source Code and License 6 votes vote down vote up
private ResourceDescriptor[] getDescriptorsForNoteUris(boolean skipDiscarded, Model model, String[] conceptUris) {
    if(model==null) {
        return new ResourceDescriptor[0];
    }
    
    ArrayList<ResourceDescriptor> result = new ArrayList<ResourceDescriptor>();
    for (int i = 0; i < conceptUris.length; i++) {
        com.hp.hpl.jena.rdf.model.Resource conceptRdfResource = model.getResource(conceptUris[i]);
        
        try {
            if(skipDiscarded && model.contains(conceptRdfResource, MindRaiderVocabulary.isDiscarded, true)) {
                continue;
            } else {
                result.add(
                        new ResourceDescriptor(conceptRdfResource.getProperty(RDFS.label).getObject().toString(), 
                                conceptUris[i]));                            
            }
        }
        catch (Exception e) {
            logger.debug("Error: ", e);
        }
    }
    return result.toArray(new ResourceDescriptor[result.size()]);
}
 
Example 15
Project: mindraider   File: NoteCustodian.java   Source Code and License 6 votes vote down vote up
/**
 * Save concept resource and update metadata in the given model.
 * 
 * @param noteResource
 *            the concept resource to save.
 * @param model
 *            the metadata model.
 */
public void save(ConceptResource conceptResource, Model model) {
    if (conceptResource == null || model == null) {
        return;
    }

    URI conceptResourceUri = conceptResource.resource.getMetadata()
            .getUri();
    // build path
    String conceptFilename = getConceptResourceFilename(conceptResource
            .getNotebookUri(), conceptResourceUri.toString());
    conceptResource.resource.toXmlFile(conceptFilename);

    com.hp.hpl.jena.rdf.model.Resource conceptRdfResource = model
            .getResource(conceptResourceUri.toString());
    conceptRdfResource.removeAll(RDFS.label);
    conceptRdfResource.addProperty(RDFS.label,
            (conceptResource.getLabel() != null ? conceptResource
                    .getLabel() : ""));
    conceptRdfResource.removeAll(RDFS.comment);
    conceptRdfResource.addProperty(RDFS.comment,
            OutlineTreeInstance.getAnnotationCite(conceptResource
                    .getAnnotation()));

}
 
Example 16
Project: mindraider   File: LabelCustodian.java   Source Code and License 6 votes vote down vote up
/**
 * Get descriptors of all folders.
 *
 * @return folder descriptors.
 */
public ResourceDescriptor[] getLabelDescriptors() {
    ArrayList<ResourceDescriptor> result = new ArrayList<ResourceDescriptor>();
    Seq mindMap = labelsModel.getModel().getSeq(MindRaiderVocabulary.getMindMapUri());
    if (mindMap != null) {
        String folderUri;
        for (int i = 0; i < mindMap.size(); i++) {
            folderUri = mindMap.getResource(i + 1).toString();
            if (!LABEL_TRASH_URI.equals(folderUri)) {
                String folderLabel = labelsModel.getModel().getResource(folderUri).getProperty(RDFS.label)
                        .getString();
                result.add(new ResourceDescriptor(folderLabel, folderUri));
            }
        }
    }

    if (result.size() == 0) {
        return null;
    }

    return (ResourceDescriptor[]) (result.toArray(new ResourceDescriptor[result.size()]));
}
 
Example 17
Project: mindraider   File: LabelCustodian.java   Source Code and License 6 votes vote down vote up
/**
 * Rename folder.
 *
 * @param folderUri
 *            the folder Uri
 * @param newLabel
 *            the new label
 * @throws Exception
 *             a generic exception
 */
public void rename(String folderUri, String newLabel) throws Exception {
    logger.debug("Renaming folder '" + folderUri + "' to '" + newLabel + "'");
    if (folderUri != null && newLabel != null) {
        // rename folder resource
        FolderResource folderResource = new FolderResource(get(folderUri));
        folderResource.getLabelProperty().setLabelContent(newLabel);
        folderResource.save();

        // change label in the tree
        Seq folderSeq = labelsModel.getModel().getSeq(folderUri);
        if (folderSeq != null) {
            folderSeq.removeAll(RDFS.label);
            folderSeq.addProperty(RDFS.label, newLabel);
            labelsModel.save();
        }
    }
}
 
Example 18
Project: mindraider   File: LabelCustodian.java   Source Code and License 6 votes vote down vote up
/**
 * Rename notebook in the model.
 *
 * @param notebookUri
 *            the notebook uri
 * @param newLabel
 *            the new label
 * @throws Exception
 *             a generic exception
 */
public void renameNotebook(String notebookUri, String newLabel) throws Exception {
    if (notebookUri != null && newLabel != null) {
        // change label in the tree
        com.hp.hpl.jena.rdf.model.Resource notebookResource = labelsModel.getModel().getResource(notebookUri);
        if (notebookResource != null) {
            notebookResource.removeAll(RDFS.label);
            notebookResource.addProperty(RDFS.label, newLabel);
            labelsModel.save();
        }

        // rename also XML (if notebook is active)
        final OutlineResource activeNotebookResource = MindRaider.outlineCustodian.getActiveOutlineResource();
        if(MindRaider.profile!=null 
                && activeNotebookResource!=null
                && MindRaider.profile.getActiveOutline()!=null                     
                && notebookUri.equals(MindRaider.profile.getActiveOutline().toString())) {                
            activeNotebookResource.getLabelProperty().setLabelContent(newLabel);
            activeNotebookResource.getAnnotationProperty().setAnnotation("'"+newLabel+"' notebook.");
            
        }
    }
}
 
Example 19
Project: mindraider   File: LabelCustodian.java   Source Code and License 6 votes vote down vote up
/**
 * Initialize folders model helper.
 *
 * @param notebookUris
 * @param j
 * @param resource
 */
private void initializeFoldersModelHelper(String[] notebookUris, int j, Resource resource) {
    String notebookPath;
    com.hp.hpl.jena.rdf.model.Resource notebookRdfResource = labelsModel.getResource(notebookUris[j]);
    notebookRdfResource.addProperty(MindRaiderVocabulary.isDiscarded, true);
    // rdfs:label - specify label (it's not in the model)
    notebookRdfResource.addProperty(RDFS.label, new OutlineResource(resource).getLabel());
    // xlink:href - specify relative location (along with profile's
    // repository home it allows to construct full path
    notebookPath = MindRaider.outlineCustodian.getModelFilenameByDirectory(MindRaider.outlineCustodian
            .getOutlineDirectory(notebookUris[j]));
    notebookRdfResource.addProperty(MindRaiderVocabulary.xlinkHref, MindRaider.profile
            .getRelativePath(notebookPath));
    // add to the discarded sequence
    Seq discardedNotebooksFolder = labelsModel.getModel().getSeq(LABEL_TRASH_URI);
    discardedNotebooksFolder.add(notebookRdfResource);
}
 
Example 20
Project: mindraider   File: LabelCustodian.java   Source Code and License 6 votes vote down vote up
/**
 * Add notebook to the model.
 *
 * @param folderSequence
 *            the folder sequence.
 * @param notebookType
 *            the notebook type resource.
 * @param nResource
 *            the resource.
 * @param notebookPath
 *            the notebook path String.
 * @return Returns the added resource.
 */
private com.hp.hpl.jena.rdf.model.Resource addOutlineToModel(Seq folderSequence,
        com.hp.hpl.jena.rdf.model.Resource notebookType, Resource nResource, String notebookPath) {
    com.hp.hpl.jena.rdf.model.Resource notebookRdfResource = (com.hp.hpl.jena.rdf.model.Resource) labelsModel
            .newResource(nResource.getMetadata().getUri().toString(), false);
    // rdf:type - it's notebook
    notebookRdfResource.addProperty(RDF.type, notebookType);
    // xlink:href - specify relative location (along with profile's
    // repository home it allows to construct full path
    notebookRdfResource.addProperty(MindRaiderVocabulary.xlinkHref, MindRaider.profile
            .getRelativePath(notebookPath));
    // rdfs:label
    notebookRdfResource.addProperty(RDFS.label, new OutlineResource(nResource).getLabel());
    // add notebook to the folder's sequence
    folderSequence.add(notebookRdfResource);

    return notebookRdfResource;
}
 
Example 21
Project: mindraider   File: LabelCustodian.java   Source Code and License 6 votes vote down vote up
/**
 * Add folder to the model.
 *
 * @param mindMapSequence
 *            the mind map sequence.
 * @param folderType
 *            the folder type.
 * @param fResource
 *            the resource.
 * @param folderResourcePath
 *            the folder resource path String
 * @return the resource
 */
private com.hp.hpl.jena.rdf.model.Resource addFolderToModel(
        Seq mindMapSequence,
        com.hp.hpl.jena.rdf.model.Resource folderType, 
        Resource fResource, 
        String folderResourcePath) {
    
    com.hp.hpl.jena.rdf.model.Resource folderRdfResource;
    folderRdfResource 
        = (com.hp.hpl.jena.rdf.model.Resource) labelsModel.newResource(fResource.getMetadata().getUri().toString(), false);
    // rdf:type - it's sequence
    folderRdfResource.addProperty(RDF.type, RDF.Seq);
    // rdf:type - it's folder
    folderRdfResource.addProperty(RDF.type, folderType);
    // xlink:href - specify relative location (along with profile's
    // repository home it allows to construct full path
    folderRdfResource.addProperty(MindRaiderVocabulary.xlinkHref, MindRaider.profile.getRelativePath(folderResourcePath));
    // rdfs:label
    folderRdfResource.addProperty(RDFS.label, new FolderResource(fResource).getLabel());
    // add folder to the parent sequence
    mindMapSequence.add(folderRdfResource);
    return folderRdfResource;
}
 
Example 22
Project: mindraider   File: BriefFacet.java   Source Code and License 6 votes vote down vote up
public boolean showThisStatement(Statement statement) {
    Property predicate = statement.getPredicate();
    if (predicate.equals(RDF.type) || predicate.equals(DC.date) || predicate.equals(RDFS.label)
            || predicate.equals(RDFS.comment) || predicate.equals(MindRaiderVocabulary.isDiscarded)
            || predicate.equals(MindRaiderVocabulary.xlinkHref)
            || predicate.equals(MindRaiderVocabulary.flagProperty)) {
        return false;
    }

    // do not show trash content
    String uri = statement.getSubject().getURI();
    if (uri != null && uri.endsWith(NoteCustodian.NOTEBOOK_TRASH_LOCAL_NAME)) {
        return false;
    }

    return true;
}
 
Example 23
Project: entityclassifier-core   File: YagoOntologyManager.java   Source Code and License 6 votes vote down vote up
public Model getHierarchyModel(String uri){
    
    // returns all subclasses for given URI
    Model m = ModelFactory.createDefaultModel();
    OntoRecord initRecord = new OntoRecord();
    initRecord.setUri(uri);
    
    while(initRecord !=null){
        
        initRecord = getSuperclass(initRecord.getUri());
        
        if(initRecord != null){
            StmtIterator iter1 = model.listStatements( new SimpleSelector(ResourceFactory.createResource(uri), RDFS.subClassOf,  (RDFNode)null));                
            m.add(iter1);
        }
    }
     
    return m;
}
 
Example 24
Project: statistics2cubes   File: Table2CubeConverter.java   Source Code and License 6 votes vote down vote up
private Resource createDataset() {
    Resource ds = model.createResource(localNS.DATASET + "-" + id);
    ds.addProperty(RDF.type, QB.DATASET);
    ds.addProperty(RDFS.label, table.getMetadata().getLabel());
    ds.addProperty(RDFS.comment, table.getMetadata().getDescription());
    ds.addProperty(DC.relation, RELATION);

    if (Config.GENERATE_1_2) {
        ds.addProperty(DC.format, VERSION_1_2);
    } else {
        ds.addProperty(DC.format, VERSION_1_1);
    }

    for (String source : table.getMetadata().getSources()) {
        ds.addProperty(DC.source, source);
    }

    Literal l = model.createTypedLiteral(GregorianCalendar.getInstance());
    ds.addProperty(DC.date, l);

    return ds;
}
 
Example 25
Project: statistics2cubes   File: Converter.java   Source Code and License 6 votes vote down vote up
private Resource createDataset() {
    Resource ds = model.createResource(localNS.DATASET + "-" + id);
    ds.addProperty(RDF.type, QB.DATASET);
    ds.addProperty(RDFS.label, table.getMetadata().getLabel());
    ds.addProperty(RDFS.comment, table.getMetadata().getDescription());
    ds.addProperty(DC.relation, RELATION);

    if (version.equals("1.1")) {
        ds.addProperty(DC.format, VERSION_1_1);
    } else {
        ds.addProperty(DC.format, VERSION_1_2);
    }

    for (String source : table.getMetadata().getSources()) {
        ds.addProperty(DC.source, source);
    }

    Literal l = model.createTypedLiteral(GregorianCalendar.getInstance());
    ds.addProperty(DC.date, l);

    return ds;
}
 
Example 26
Project: p3-osm-transformer   File: JenaTextConfig.java   Source Code and License 6 votes vote down vote up
/**
 * Creates a persistent Jena TDB data set and Lucene index. 
 * @return
 * @throws IOException 
 */
public Dataset createPersistentDatasetFromCode() throws IOException{
    log.info("Construct a persistent Jena data set with lucene index using code") ;
    // Build a text dataset by code.
    TextQuery.init();
    // Remove old files and folders
    deleteFiles(JENA_TDB_TEMP_FOLDER);
    deleteFiles(LUCENE_INDEX_TEMP_FOLDER);
    // Creates new folders
    JENA_TDB_TEMP_FOLDER.mkdirs();
    LUCENE_INDEX_TEMP_FOLDER.mkdirs();
    // Creates persisted Jena data set and Lucene index
    Dataset jenaDataset = TDBFactory.createDataset(JENA_TDB_TEMP_FOLDER.getAbsolutePath()) ;
    // Lucene, persisted.
    Directory luceneIndex = FSDirectory.open(LUCENE_INDEX_TEMP_FOLDER);
    // Define the index mapping
    EntityDefinition entDef = new EntityDefinition("uri", "text", RDFS.label.asNode()) ;
    
    
    // Join together into a dataset
    return TextDatasetFactory.createLucene(jenaDataset, luceneIndex, entDef) ;
}
 
Example 27
Project: ExpertFinder   File: OntologyIndex.java   Source Code and License 6 votes vote down vote up
/**
 * Look up <code>uri</code> in the ontology and return a list of parent
 * concepts (URIs). Synonyms are not considered. The list contains no
 * duplicates. Never returns <code>null</code>.
 * 
 * @param term
 *            term to be looked up
 * @return a list of parent concepts URIs
 */
// TODO add all synonyms of the parents to the result
public List<String> getParents(String uri) {
	Resource resource = model.getResource(uri);
	if (resource == null)
		return Collections.emptyList();
	
	List<String> result = new ArrayList<String>();

	StmtIterator parent = resource.listProperties(RDFS.subClassOf);
	while(parent.hasNext()) {
		RDFNode child = parent.nextStatement().getObject();

		if (child.isResource() && !child.isAnon() /*&& !((Resource)child).hasLiteral(Jura.invisible, true)*/) {
			result.add(((Resource)child).getURI());
		}
	}

	return result;
}
 
Example 28
Project: ExpertFinder   File: OntologyIndex.java   Source Code and License 6 votes vote down vote up
/**
	 * Look up <code>uri</code> in the ontology and return a list of child
	 * concepts (URIs). Synonyms are not considered. The list contains no
	 * duplicates. Never returns <code>null</code>.
	 * 
	 * @param term
	 *            term to be looked up
	 * @return a list of child concepts URIs
	 */
	// TODO add all synonyms of the children to the result
	public List<String> getChildren(String uri) {
		Resource resource = model.getResource(uri);
		if (resource == null)
			return Collections.emptyList();
		
		List<String> result = new ArrayList<String>();

		ResIterator child = model.listResourcesWithProperty(RDFS.subClassOf, resource);
		while(child.hasNext()) {
			Resource parent = child.nextResource();
//			if (!parent.hasLiteral(Jura.invisible, true)) {
				result.add(parent.getURI());
//			}
		}

		return result;
	}
 
Example 29
Project: Cetus   File: YagoBasedTypeSearcher.java   Source Code and License 6 votes vote down vote up
protected static Set<Resource> findUnlinkedDolceClasses(Model classesModel, Model dolceClassModel) {
    Set<Resource> unlinkedClasses = new HashSet<Resource>();
    StmtIterator stmtIterator = dolceClassModel.listStatements(null, RDF.type, RDFS.Class);
    Statement statement;
    Resource resource;
    while (stmtIterator.hasNext()) {
        statement = stmtIterator.next();
        resource = statement.getSubject();
        // If this class has no equivalent class and no sub classes
        if ((!classesModel.contains(resource, OWL.equivalentClass))
                && (!classesModel.contains(null, OWL.equivalentClass, resource))
                && (!classesModel.contains(null, RDFS.subClassOf, resource))) {
            unlinkedClasses.add(resource);
        }
    }
    // We are searching the higher classes on the complete model to make
    // sure, that higher DOLCE classes are only added to the list of
    // unlinked classes, if they do not have a YAGO sub class
    // FIXME If a DOLCE class has an equal YAGO class and both have no
    // children, the DOLCE class will be added to the list of unlinked
    // classes. (very unlikely, but possible)
    addHigherIncludedDolceClass(unlinkedClasses, classesModel, unlinkedClasses);

    return unlinkedClasses;
}
 
Example 30
Project: Cetus   File: DolceClassHierarchyLoader.java   Source Code and License 6 votes vote down vote up
protected void copyAllowedProperties(Model readModel, Model model, Set<Resource> classes,
        Set<Property> allowedProperties) {
    StmtIterator stmtIterator = readModel.listStatements();
    Statement s;
    Literal label;
    while (stmtIterator.hasNext()) {
        s = stmtIterator.next();
        if (classes.contains(s.getSubject()) && allowedProperties.contains(s.getPredicate())
                && (!s.getObject().isAnon())) {
            if (s.getPredicate().equals(RDFS.label)) {
                label = s.getObject().asLiteral();
                if (label.getLanguage().equals("en")) {
                    model.add(s.getSubject(), RDFS.label,
                            model.createLiteral(label.getString().toLowerCase(), "en"));
                }
            } else {
                model.add(s);
            }
        }
    }
}
 
Example 31
Project: Cetus   File: DolceClassHierarchyLoader.java   Source Code and License 6 votes vote down vote up
protected Set<Resource> getClasses(Model readModel) {
    ResIterator iterator = readModel.listSubjectsWithProperty(RDF.type, RDFS.Class);
    Resource r;
    Set<Resource> classes = new HashSet<Resource>();
    while (iterator.hasNext()) {
        r = iterator.next();
        if (!r.isAnon()) {
            classes.add(r);
        }
    }
    iterator = readModel.listSubjectsWithProperty(RDF.type, OWL.Class);
    while (iterator.hasNext()) {
        r = iterator.next();
        if (!r.isAnon()) {
            classes.add(r);
        }
    }
    return classes;
}
 
Example 32
Project: OpenCollegeGraph   File: ExprTransformTest2.java   Source Code and License 6 votes vote down vote up
public void testLang()
{
	List<Triple> pattern = new ArrayList<Triple>();
	pattern.add(Triple.create(Node.createVariable("s"), RDFS.label.asNode(), Node.createVariable("o")));
	NodeRelation[] rels = translate(pattern, "optimizer/filtertests.n3");
	
	NodeRelation label_fr_be  = search("table1", "label_fr_be", rels);
	NodeRelation label_en     = search("table1", "label_en", rels);
	NodeRelation label_noLang = search("table1", "label", rels);
	
	Expr filterFR    = new E_Equals(new E_Lang(new ExprVar("o")), NodeValue.makeString("fr"));
	Expr filterEN_TAG_EN = new E_Equals(new E_Lang(new ExprVar("o")), NodeValue.makeNode("en", "en", (String) null));
	Expr filterFR_BE = new E_Equals(new E_Lang(new ExprVar("o")), NodeValue.makeString("fr-BE"));
	Expr filter      = new E_Equals(new E_Lang(new ExprVar("o")), NodeValue.makeString(""));
	
	assertEquals("LANG(label_fr_be) = \"fr\" should be FALSE",   Expression.FALSE, TransformExprToSQLApplyer.convert(filterFR, label_fr_be));
	assertEquals("LANG(label_en) = \"fr\" should be FALSE",      Expression.FALSE, TransformExprToSQLApplyer.convert(filterFR, label_en));
	assertEquals("LANG(label_fr_be) = \"fr_be\" should be TRUE", Expression.TRUE,  TransformExprToSQLApplyer.convert(filterFR_BE, label_fr_be));
	assertEquals("LANG(label_en) = \"en\"@en should be FALSE",   Expression.FALSE, TransformExprToSQLApplyer.convert(filterEN_TAG_EN, label_en));
	assertEquals("LANG(label_noLang) = \"\" should be TRUE",     Expression.TRUE,  TransformExprToSQLApplyer.convert(filter, label_noLang));
}
 
Example 33
Project: Cetus   File: ExtendedYagoBasedTypeSearcherTest.java   Source Code and License 6 votes vote down vote up
public static List<ExtendedTypedNamedEntity> extractMarkings(Document document) {
    MarkingFilter<TypedNamedEntity> filter = new TypeBasedMarkingFilter<TypedNamedEntity>(true, RDFS.Class.getURI(),
            OWL.Class.getURI());
    List<TypedNamedEntity> namedEntities = document.getMarkings(TypedNamedEntity.class);
    List<ExtendedTypedNamedEntity> extendedMarkings = new ArrayList<ExtendedTypedNamedEntity>();
    int start, length, end;
    for (TypedNamedEntity tne : namedEntities) {
        if (filter.isMarkingGood(tne)) {
            start = tne.getStartPosition();
            length = tne.getLength();
            end = start + length;
            extendedMarkings.add(new ExtendedTypedNamedEntity(start, length, tne.getUris(), new HashSet<String>(),
                    document.getText().substring(start, end)));
        }
    }
    return extendedMarkings;
}
 
Example 34
Project: Tapioca   File: SpecialClassExtractorTest.java   Source Code and License 6 votes vote down vote up
@Parameters
public static Collection<Object[]> data() {
	return Arrays
			.asList(new Object[][] {
					{
							"<http://example.org/entity1> <http://example.org/hasLabel> \"entity 1\" .\n"
									+ "<http://example.org/entity1> <" + RDF.type.getURI()
									+ "> <http://example.org/Class1> .\n" + "<http://example.org/Class2> <"
									+ RDF.type.getURI() + "> <" + RDFS.Class.getURI() + "> .\n", new String[] {},
							new int[] {} },
					{
							"<http://example.org/concept1> <"
									+ RDF.type.getURI()
									+ "> <http://www.w3.org/2004/02/skos/core#Concept> .\n"
									+ "<http://example.org/conceptScheme1> <"
									+ RDF.type.getURI()
									+ "> <http://www.w3.org/2004/02/skos/core#ConceptScheme> .\n"
									+ "<http://example.org/concept1> <http://www.w3.org/2004/02/skos/core#inScheme> <http://example.org/conceptScheme1> .",
							new String[] { "http://example.org/concept1", "http://example.org/conceptScheme1" },
							new int[] { 0, 0 } } });
}
 
Example 35
Project: OpenCollegeGraph   File: ClassMapServlet.java   Source Code and License 6 votes vote down vote up
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
	D2RServer server = D2RServer.fromServletContext(getServletContext());
	server.checkMappingFileChanged();
	if (request.getPathInfo() == null) {
		new ModelResponse(classMapListModel(), request, response).serve();
		return;
	}
	String classMapName = request.getPathInfo().substring(1);
	Model resourceList = getClassMapLister().classMapInventory(classMapName);
	if (resourceList == null) {
		response.sendError(404, "Sorry, class map '" + classMapName + "' not found.");
		return;
	}
   	Resource classMap = resourceList.getResource(server.baseURI() + "all/" + classMapName);
   	Resource directory = resourceList.createResource(server.baseURI() + "all");
   	classMap.addProperty(RDFS.seeAlso, directory);
   	classMap.addProperty(RDFS.label, "List of all instances: " + classMapName);
   	directory.addProperty(RDFS.label, "D2R Server contents");
   	server.addDocumentMetadata(resourceList, classMap);
	new ModelResponse(resourceList, request, response).serve();
}
 
Example 36
Project: harvesters   File: MonthlyRdfActions.java   Source Code and License 5 votes vote down vote up
/**
    * Add to the model the the Organization Unit that is related to the Organization
    * 
    * @param Model the model we are currently working with
    * @param Resource the resource of the related organization
    * @param Unit the list of the organization units
    */
private void addOrganizationUnitToModel(Model model, Resource orgResource, Units unitsList) {
	
	for (Unit unit : unitsList.getUnits()) {
		Resource orgUnitResource = model.createResource(Ontology.instancePrefix + "OrganizationalUnit/" + unit.getUid(), Ontology.organizationalUnitResource);
		orgUnitResource.addLiteral(Ontology.organizationUnitId, unit.getUid());
		//orgUnitResource.addLiteral(Ontology.organizationUnitActive, unit.isActive());
		orgUnitResource.addProperty(RDFS.label, model.createLiteral(hm.cleanInputData(unit.getLabel()), "el"));
		
		if (unit.getAbbreviation() != null) {
			orgUnitResource.addLiteral(Ontology.organizationUnitAbbreviation, unit.getAbbreviation());
		}
			
		if ((unit.getCategory() != null) && (unit.getCategory() != "")) {
			orgUnitResource.addProperty(Ontology.hasOrgUnitCategory, model.getResource(Ontology.instancePrefix + "OrganizationalUnitCategory/" + unit.getCategory()));
		}
		
		if (unit.getUnitDomains() != null) {
			for (String unitDomain : unit.getUnitDomains()) {
				orgUnitResource.addProperty(Ontology.orgActivity, model.getResource(Ontology.instancePrefix + "OrganizationDomain/" + unitDomain));
			}
		}
		/** Organization - OrganizationalUnit **/
		orgResource.addProperty(Ontology.hasUnit, orgUnitResource);
		/** OrganizationalUnit - Organization **/
		orgUnitResource.addProperty(Ontology.unitOf, orgResource);
	}
	
}
 
Example 37
Project: harvesters   File: MonthlyRdfActions.java   Source Code and License 5 votes vote down vote up
/**
 * Add to the model the the Organization Unit that is related to the
 * Organization
 * 
 * @param Model
 *            the model we are currently working with
 * @param Resource
 *            the resource of the related organization
 * @param Unit
 *            the list of the organization units
 */
private void addOrganizationUnitToModel(Model model, Resource orgResource, Units unitsList) {

	for (Unit unit : unitsList.getUnits()) {
		Resource orgUnitResource = model.createResource(
				Ontology.instancePrefix + "OrganizationalUnit/" + unit.getUid(),
				Ontology.organizationalUnitResource);
		orgUnitResource.addLiteral(Ontology.organizationUnitId, unit.getUid());
		// orgUnitResource.addLiteral(Ontology.organizationUnitActive,
		// unit.isActive());
		orgUnitResource.addProperty(RDFS.label, model.createLiteral(hm.cleanInputData(unit.getLabel()), "el"));

		if (unit.getAbbreviation() != null) {
			orgUnitResource.addLiteral(Ontology.organizationUnitAbbreviation, unit.getAbbreviation());
		}

		if ((unit.getCategory() != null) && (unit.getCategory() != "")) {
			orgUnitResource.addProperty(Ontology.hasOrgUnitCategory, model
					.getResource(Ontology.instancePrefix + "OrganizationalUnitCategory/" + unit.getCategory()));
		}

		if (unit.getUnitDomains() != null) {
			for (String unitDomain : unit.getUnitDomains()) {
				orgUnitResource.addProperty(Ontology.orgActivity,
						model.getResource(Ontology.instancePrefix + "OrganizationDomain/" + unitDomain));
			}
		}
		/** Organization - OrganizationalUnit **/
		orgResource.addProperty(Ontology.hasUnit, orgUnitResource);
		/** OrganizationalUnit - Organization **/
		orgUnitResource.addProperty(Ontology.unitOf, orgResource);
	}

}
 
Example 38
Project: r2rml-kit   File: Mapping.java   Source Code and License 5 votes vote down vote up
/**
 * Helper method to add definitions from a ResourceMap to its underlying resource
 * @param map
 * @param targetResource
 */
private void addDefinitions(ResourceMap map, Resource targetResource) {
	/* Infer rdfs:Class or rdf:Property type */
	Statement s = vocabularyModel.createStatement(targetResource, RDF.type, map instanceof ClassMap ? RDFS.Class : RDF.Property);
	if (!this.vocabularyModel.contains(s))
		this.vocabularyModel.add(s);

	/* Apply labels */
	for (Literal propertyLabel: map.getDefinitionLabels()) {
		s = vocabularyModel.createStatement(targetResource, RDFS.label, propertyLabel);
		if (!this.vocabularyModel.contains(s))
			this.vocabularyModel.add(s);
	}

	/* Apply comments */
	for (Literal propertyComment: map.getDefinitionComments()) {
		s = vocabularyModel.createStatement(targetResource, RDFS.comment, propertyComment);
		if (!this.vocabularyModel.contains(s))
			this.vocabularyModel.add(s);
	}

	/* Apply additional properties */
	for (Resource additionalProperty: map.getAdditionalDefinitionProperties()) {
		s = vocabularyModel.createStatement(targetResource, 
					(Property)(additionalProperty.getProperty(D2RQ.propertyName).getResource().as(Property.class)),
					additionalProperty.getProperty(D2RQ.propertyValue).getObject());
		if (!this.vocabularyModel.contains(s))
			this.vocabularyModel.add(s);				
	}
}
 
Example 39
Project: r2rml-kit   File: ResourceCollection.java   Source Code and License 5 votes vote down vote up
private Collection<TripleRelation> filterTripleRelations(Collection<TripleRelation> entityDescription) {
	List<TripleRelation> result = new ArrayList<TripleRelation>();
	for (TripleRelation triples: entityDescription) {
		triples = triples.orderBy(TripleRelation.SUBJECT, true);
		if (!OpUtil.isEmpty(triples.selectTriple(new Triple(Node.ANY, RDF.Nodes.type, Node.ANY)).getBaseTabular())) {
			result.add(triples);
		}
		// TODO: The list of label properties is redundantly specified in PageServlet
		if (!OpUtil.isEmpty(triples.selectTriple(new Triple(Node.ANY, RDFS.label.asNode(), Node.ANY)).getBaseTabular())) {
			result.add(triples);
		} else if (!OpUtil.isEmpty(triples.selectTriple(new Triple(Node.ANY, SKOS.prefLabel.asNode(), Node.ANY)).getBaseTabular())) {
			result.add(triples);
		} else if (!OpUtil.isEmpty(triples.selectTriple(new Triple(Node.ANY, DC.title.asNode(), Node.ANY)).getBaseTabular())) {
			result.add(triples);					
		} else if (!OpUtil.isEmpty(triples.selectTriple(new Triple(Node.ANY, DCTerms.title.asNode(), Node.ANY)).getBaseTabular())) {
			result.add(triples);					
		} else if (!OpUtil.isEmpty(triples.selectTriple(new Triple(Node.ANY, FOAF.name.asNode(), Node.ANY)).getBaseTabular())) {
			result.add(triples);					
		}
	}
	if (result.isEmpty()) {
		result.add(new TripleRelation(sqlConnection, entityTable, 
				entityMaker, 
				new FixedNodeMaker(RDF.type.asNode()), 
				new FixedNodeMaker(RDFS.Resource.asNode())));
	}
	return result;
}
 
Example 40
Project: r2rml-kit   File: OntologyTarget.java   Source Code and License 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());
}