• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java DC类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.jena.vocabulary.DC的典型用法代码示例。如果您正苦于以下问题:Java DC类的具体用法?Java DC怎么用?Java DC使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DC类属于org.apache.jena.vocabulary包,在下文中一共展示了DC类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: get

import org.apache.jena.vocabulary.DC; //导入依赖的package包/类
@Override
public RESTResource get(URI uri, Map<String, String> parameters) throws RESTException {
	RESTResource resource = new RESTResource(uri.toString(),this);

	Dataset dataset = ThingDirectory.get().dataset;
	dataset.begin(ReadWrite.READ);

	try {
		String q = "SELECT ?str WHERE { <" + uri + "> <" + DC.source + "> ?str }";
		QueryExecution qexec = QueryExecutionFactory.create(q, dataset);
		ResultSet result = qexec.execSelect();

		if (result.hasNext()) {
			resource.contentType = "application/ld+json";
			resource.content = result.next().get("str").asLiteral().getLexicalForm();
		} else {
			throw new RESTException();
		}
	} finally {
		dataset.end();
	}
	
	return resource;
}
 
开发者ID:thingweb,项目名称:thingweb-directory,代码行数:25,代码来源:ThingDescriptionHandler.java


示例2: get

import org.apache.jena.vocabulary.DC; //导入依赖的package包/类
@Override
public RESTResource get(URI uri, Map<String, String> parameters) throws RESTException {
	RESTResource resource = new RESTResource(uri.toString(),this);

	Dataset dataset = Repository.get().dataset;
	dataset.begin(ReadWrite.READ);

	try {
		String q = "SELECT ?str WHERE { <" + uri + "> <" + DC.source + "> ?str }";
		QueryExecution qexec = QueryExecutionFactory.create(q, dataset);
		ResultSet result = qexec.execSelect();

		if (result.hasNext()) {
			resource.contentType = "application/ld+json";
			resource.content = result.next().get("str").asLiteral().getLexicalForm();
		} else {
			throw new RESTException();
		}
	} finally {
		dataset.end();
	}
	
	return resource;
}
 
开发者ID:thingweb,项目名称:thingweb-repository,代码行数:25,代码来源:ThingDescriptionHandler.java


示例3: createModel

import org.apache.jena.vocabulary.DC; //导入依赖的package包/类
public static Model createModel()
{
    Model model = ModelFactory.createDefaultModel() ;
    
    Resource r1 = model.createResource("http://example.org/book#1") ;
    Resource r2 = model.createResource("http://example.org/book#2") ;
    Resource r3 = model.createResource("http://example.org/book#3") ;
    
    r1.addProperty(DC.title, "SPARQL - the book")
      .addProperty(DC.description, "A book about SPARQL") ;
    
    r2.addProperty(DC.title, "Advanced techniques for SPARQL") ;

    r3.addProperty(DC.title, "Jena - an RDF framework for Java")
      .addProperty(DC.description, "A book about Jena") ;

    return model ;
}
 
开发者ID:xcurator,项目名称:xcurator,代码行数:19,代码来源:ExProg1.java


示例4: write

import org.apache.jena.vocabulary.DC; //导入依赖的package包/类
@Override
public void write(StringWriter writer, String format) {
    Model rdfModel = ModelFactory.createDefaultModel();
    if (this.value != null) {
        rdfModel.createResource(this.baseURI)
            .addLiteral(DC.description, this.value);
    }
    rdfModel.write(writer, format);
}
 
开发者ID:DTL-FAIRData,项目名称:ODEX-FAIRDataPoint,代码行数:10,代码来源:Description.java


示例5: main

import org.apache.jena.vocabulary.DC; //导入依赖的package包/类
public static void main(String[] args)
{
    // Create the data.
    // This wil be the background (unnamed) graph in the dataset.
    Model model = createModel() ;
    
    // First part or the query string 
    String prolog = "PREFIX dc: <"+DC.getURI()+">" ;
    
    // Query string.
    String queryString = prolog + NL +
        "SELECT ?title WHERE {?x dc:title ?title}" ; 
    
    Query query = QueryFactory.create(queryString) ;
    // Print with line numbers
    query.serialize(new IndentedWriter(System.out,true)) ;
    System.out.println() ;
    
    // Create a single execution of this query, apply to a model
    // which is wrapped up as a Dataset
    
    // Or QueryExecutionFactory.create(queryString, model) ;        
    try(QueryExecution qexec = QueryExecutionFactory.create(query, model)) {
        // A ResultSet is an iterator - any query solutions returned by .next()
        // are not accessible again.
        // Create a ResultSetRewindable that can be reset to the beginning.
        // Do before first use.
        
        ResultSetRewindable rewindable = ResultSetFactory.makeRewindable(qexec.execSelect()) ;
        ResultSetFormatter.out(rewindable) ;
        rewindable.reset() ;
        ResultSetFormatter.out(rewindable) ;
    }
}
 
开发者ID:xcurator,项目名称:xcurator,代码行数:35,代码来源:ExQuerySelect2.java


示例6: createModel

import org.apache.jena.vocabulary.DC; //导入依赖的package包/类
public static Model createModel()
{
    Model m = ModelFactory.createDefaultModel() ;
    
    Resource r1 = m.createResource("http://example.org/book#1") ;
    Resource r2 = m.createResource("http://example.org/book#2") ;
    
    r1.addProperty(DC.title, "SPARQL - the book")
      .addProperty(DC.description, "A book about SPARQL") ;
    
    r2.addProperty(DC.title, "Advanced techniques for SPARQL") ;
    
    return m ;
}
 
开发者ID:xcurator,项目名称:xcurator,代码行数:15,代码来源:ExQuerySelect2.java


示例7: createClassificationAndLevels

import org.apache.jena.vocabulary.DC; //导入依赖的package包/类
/**
 * Creates in the model the resources representing the classification and its levels.
 */
	public void createClassificationAndLevels() {

	// Create the resource representing the classification (skos:ConceptScheme)
	scheme = model.createResource(BASE_URI + "sbi", SKOS.ConceptScheme);
	scheme.addProperty(SKOS.prefLabel, model.createLiteral("Dutch Standaard Bedrijfsindeling (SBI) 2008", "en")); // TODO Not really English
	scheme.addProperty(SKOS.notation, "SBI 2008"); // TODO What distinguishes annual versions?
	scheme.addProperty(SKOS.definition, model.createLiteral("The Standard Industrial Classification is a classification of economic activities designed by the Central Bureau of Statistics of the Netherlands (CBS) that aims to provide a uniform classification of the economy for the benefit of detailed economic analyzes and statistics.", "en"));
	scheme.addProperty(DC.publisher, model.createResource("http://www.cbs.nl"));
	scheme.addProperty(DCTerms.issued, model.createTypedLiteral("2008-01-01", "http://www.w3.org/2001/XMLSchema#date"));
	scheme.addProperty(DCTerms.modified, model.createTypedLiteral("2016-01-01", "http://www.w3.org/2001/XMLSchema#date"));
	scheme.addProperty(FOAF.homepage, model.createResource("https://www.cbs.nl/en-gb/our-services/methods/classifications/activiteiten/standard-industrial-classifications--dutch-sbi-2008-nace-and-isic--"));
	scheme.addProperty(XKOS.covers, model.createResource("http://eurovoc.europa.eu/5992"));
	scheme.addProperty(XKOS.numberOfLevels, model.createTypedLiteral(5));

	// Create the resources representing the levels (xkos:ClassificationLevel)
	Resource level1 = model.createResource(BASE_URI + "/sections", XKOS.ClassificationLevel);
	level1.addProperty(SKOS.prefLabel, model.createLiteral("SBI 2008 - level 1 - Sections", "en"));
	level1.addProperty(XKOS.depth, model.createTypedLiteral(1));
	level1.addProperty(XKOS.notationPattern, "[A-U]");
	level1.addProperty(XKOS.organizedBy, model.createResource("http://stamina-project.org/concepts/sbi2008/section"));

	Resource level2 = model.createResource(BASE_URI + "/divisions", XKOS.ClassificationLevel);
	level2.addProperty(SKOS.prefLabel, model.createLiteral("SBI 2008 - level 2 - Divisions", "en"));
	level2.addProperty(XKOS.depth, model.createTypedLiteral(2));
	level2.addProperty(XKOS.notationPattern, "[0-9]{2}");
	level2.addProperty(XKOS.organizedBy, model.createResource("http://stamina-project.org/concepts/sbi2008/division"));

	Resource level3 = model.createResource(BASE_URI + "/groups", XKOS.ClassificationLevel);
	level3.addProperty(SKOS.prefLabel, model.createLiteral("SBI 2008 - level 3 - Groups", "en"));
	level3.addProperty(XKOS.depth, model.createTypedLiteral(3));
	level3.addProperty(XKOS.notationPattern, "[0-9]{3}");
	level3.addProperty(XKOS.organizedBy, model.createResource("http://stamina-project.org/concepts/sbi2008/group"));

	Resource level4 = model.createResource(BASE_URI + "/classes", XKOS.ClassificationLevel);
	level4.addProperty(SKOS.prefLabel, model.createLiteral("SBI 2008 - level 4 - Classes", "en"));
	level4.addProperty(XKOS.depth, model.createTypedLiteral(4));
	level4.addProperty(XKOS.notationPattern, "[0-9]{4}");
	level4.addProperty(XKOS.organizedBy, model.createResource("http://stamina-project.org/concepts/sbi2008/class"));

	Resource level5 = model.createResource(BASE_URI + "/subclasses", XKOS.ClassificationLevel);
	level5.addProperty(SKOS.prefLabel, model.createLiteral("SBI 2008 - level 5 - Subclasses", "en"));
	level5.addProperty(XKOS.depth, model.createTypedLiteral(5));
	level5.addProperty(XKOS.notationPattern, "[0-9]{5}");
	level5.addProperty(XKOS.organizedBy, model.createResource("http://stamina-project.org/concepts/sbi2008/subclass"));

	// Attach the level list to the classification
	levelList = model.createList(new RDFNode[] {level1, level2, level3, level4, level5});
	scheme.addProperty(XKOS.levels, levelList);
}
 
开发者ID:FranckCo,项目名称:Stamina,代码行数:53,代码来源:SBIModelMaker.java


示例8: createClassificationAndLevels

import org.apache.jena.vocabulary.DC; //导入依赖的package包/类
/**
 * Creates in the model the resources representing the classification and its levels.
 */
	public void createClassificationAndLevels() {

	// Create the resource representing the classification (skos:ConceptScheme)
	scheme = model.createResource(SIC_BASE_URI + "sic", SKOS.ConceptScheme);
	scheme.addProperty(SKOS.prefLabel, model.createLiteral("UK Standard Industrial Classification of Economic Activities (SIC) 2007", "en"));
	scheme.addProperty(SKOS.notation, "UK SIC 2007");
	scheme.addProperty(SKOS.definition, model.createLiteral("The current Standard Industrial Classification (SIC) used in classifying business establishments and other statistical units by the type of economic activity in which they are engaged.", "en"));
	scheme.addProperty(DC.publisher, model.createResource("http://www.ons.gov.uk"));
	scheme.addProperty(DCTerms.issued, model.createTypedLiteral("2007-01-01", "http://www.w3.org/2001/XMLSchema#date"));
	scheme.addProperty(DCTerms.modified, model.createTypedLiteral("2007-01-01", "http://www.w3.org/2001/XMLSchema#date"));
	scheme.addProperty(FOAF.homepage, model.createResource("https://www.ons.gov.uk/methodology/classificationsandstandards/ukstandardindustrialclassificationofeconomicactivities/uksic2007"));
	scheme.addProperty(XKOS.covers, model.createResource("http://eurovoc.europa.eu/5992"));
	scheme.addProperty(XKOS.numberOfLevels, model.createTypedLiteral(5));

	// Create the resources representing the levels (xkos:ClassificationLevel)
	Resource level1 = model.createResource(SIC_BASE_URI + "/sections", XKOS.ClassificationLevel);
	level1.addProperty(SKOS.prefLabel, model.createLiteral("UK SIC 2007 - level 1 - Sections", "en"));
	level1.addProperty(XKOS.depth, model.createTypedLiteral(1));
	level1.addProperty(XKOS.notationPattern, "[A-U]");
	level1.addProperty(XKOS.organizedBy, model.createResource("http://stamina-project.org/concepts/sic2007/section"));

	Resource level2 = model.createResource(SIC_BASE_URI + "/divisions", XKOS.ClassificationLevel);
	level2.addProperty(SKOS.prefLabel, model.createLiteral("UK SIC 2007 - level 2 - Divisions", "en"));
	level2.addProperty(XKOS.depth, model.createTypedLiteral(2));
	level2.addProperty(XKOS.notationPattern, "[0-9]{2}");
	level2.addProperty(XKOS.organizedBy, model.createResource("http://stamina-project.org/concepts/sic2007/division"));

	Resource level3 = model.createResource(SIC_BASE_URI + "/groups", XKOS.ClassificationLevel);
	level3.addProperty(SKOS.prefLabel, model.createLiteral("UK SIC 2007 - level 3 - Groups", "en"));
	level3.addProperty(XKOS.depth, model.createTypedLiteral(3));
	level3.addProperty(XKOS.notationPattern, "[0-9]{2}\\.[0-9]");
	level3.addProperty(XKOS.organizedBy, model.createResource("http://stamina-project.org/concepts/sic2007/group"));

	Resource level4 = model.createResource(SIC_BASE_URI + "/classes", XKOS.ClassificationLevel);
	level4.addProperty(SKOS.prefLabel, model.createLiteral("UK SIC 2007 - level 4 - Classes", "en"));
	level4.addProperty(XKOS.depth, model.createTypedLiteral(4));
	level4.addProperty(XKOS.notationPattern, "[0-9]{2}\\.[0-9]{2}");
	level4.addProperty(XKOS.organizedBy, model.createResource("http://stamina-project.org/concepts/sic2007/class"));

	Resource level5 = model.createResource(SIC_BASE_URI + "/subclasses", XKOS.ClassificationLevel);
	level5.addProperty(SKOS.prefLabel, model.createLiteral("UK SIC 2007 - level 5 - Subclasses", "en"));
	level5.addProperty(XKOS.depth, model.createTypedLiteral(5));
	level5.addProperty(XKOS.notationPattern, "[0-9]{2}\\.[0-9]{2}\\/[0-9]");
	level5.addProperty(XKOS.organizedBy, model.createResource("http://stamina-project.org/concepts/sic2007/subclass"));

	// Attach the level list to the classification
	levelList = model.createList(new RDFNode[] {level1, level2, level3, level4, level5});
	scheme.addProperty(XKOS.levels, levelList);
}
 
开发者ID:FranckCo,项目名称:Stamina,代码行数:53,代码来源:SICModelMaker.java


示例9: createClassificationAndLevels

import org.apache.jena.vocabulary.DC; //导入依赖的package包/类
/**
 * Creates in the model the resources representing the classification and its levels.
 */
	public void createClassificationAndLevels() {

	// Create the resource representing the classification (skos:ConceptScheme)
	scheme = model.createResource(BASE_URI + "skd", SKOS.ConceptScheme);
	scheme.addProperty(SKOS.prefLabel, model.createLiteral("SKD_2008 - Standardna klasifikacija dejavnosti 2008, V2", "si"));
	scheme.addProperty(SKOS.prefLabel, model.createLiteral("SKD_2008 - Standard classification of activities 2008, V2", "en"));
	scheme.addProperty(SKOS.notation, "SKD 2008");
	scheme.addProperty(SKOS.definition, model.createLiteral("Standardna klasifikacija dejavnosti (SKD) je obvezen nacionalni standard, ki se uporablja za določanje dejavnosti in za razvrščanje poslovnih subjektov in njihovih delov za potrebe uradnih in drugih administrativnih zbirk podatkov (registri, evidence, podatkovne baze ipd.) ter za potrebe statistike in analitike v državi in na mednarodni ravni. Skladno s 6. členom Uredbe o SKD 2008 je za razlago vsebine postavk klasifikacije dejavnosti pristojen Statistični urad Republike Slovenije. Za razvrščanje enot Poslovnega registra Slovenije po dejavnosti je odgovorna Agencija Republike Slovenije za javnopravne evidence in storitve (AJPES).", "si"));
	scheme.addProperty(SKOS.definition, model.createLiteral("The Standard Classification of Activities (SKD) is the obligatory national standard used for defining the main activity and for classifying business entities and their units for the needs of official and other administrative data collections (registers, records, databases, etc.) and for the needs of national and international statistics and analyses. In line with Article 6 of the Decree on the 2008 Standard Classification of Activities, the Statistical Office of the Republic of Slovenia is authorised to explain the content of classification items. Classification of units of the Business Register of Slovenia by activity is the responsibility of the Agency of the Republic of Slovenia for Public Legal Records and Related Services (AJPES).", "en"));
	scheme.addProperty(DC.publisher, model.createResource("http://www.stat.si"));
	 // TODO Confirm creation date and obtain last modification date
	scheme.addProperty(DCTerms.issued, model.createTypedLiteral("2008-02-07", "http://www.w3.org/2001/XMLSchema#date"));
	scheme.addProperty(DCTerms.modified, model.createTypedLiteral("2008-02-07", "http://www.w3.org/2001/XMLSchema#date"));
	scheme.addProperty(FOAF.homepage, model.createResource("http://www.stat.si/klasje/tabela.aspx?cvn=5531"));
	scheme.addProperty(XKOS.covers, model.createResource("http://eurovoc.europa.eu/5992"));
	scheme.addProperty(XKOS.numberOfLevels, model.createTypedLiteral(5));

	// TODO: check the names of the levels
	// Create the resources representing the levels (xkos:ClassificationLevel)
	Resource level1 = model.createResource(BASE_URI + "/sections", XKOS.ClassificationLevel);
	level1.addProperty(SKOS.prefLabel, model.createLiteral("SKD 2008 - level 1 - Sections", "en"));
	level1.addProperty(XKOS.depth, model.createTypedLiteral(1));
	level1.addProperty(XKOS.notationPattern, "[A-U]");
	level1.addProperty(XKOS.organizedBy, model.createResource("http://stamina-project.org/concepts/skd2008/section"));

	Resource level2 = model.createResource(BASE_URI + "/divisions", XKOS.ClassificationLevel);
	level2.addProperty(SKOS.prefLabel, model.createLiteral("SKD 2008 - level 2 - Divisions", "en"));
	level2.addProperty(XKOS.depth, model.createTypedLiteral(2));
	level2.addProperty(XKOS.notationPattern, "[0-9]{2}");
	level2.addProperty(XKOS.organizedBy, model.createResource("http://stamina-project.org/concepts/skd2008/division"));

	Resource level3 = model.createResource(BASE_URI + "/groups", XKOS.ClassificationLevel);
	level3.addProperty(SKOS.prefLabel, model.createLiteral("SKD 2008 - level 3 - Groups", "en"));
	level3.addProperty(XKOS.depth, model.createTypedLiteral(3));
	level3.addProperty(XKOS.notationPattern, "[0-9]{2}\\.[0-9]");
	level3.addProperty(XKOS.organizedBy, model.createResource("http://stamina-project.org/concepts/skd2008/group"));

	Resource level4 = model.createResource(BASE_URI + "/classes", XKOS.ClassificationLevel);
	level4.addProperty(SKOS.prefLabel, model.createLiteral("SKD 2008 - level 4 - Classes", "en"));
	level4.addProperty(XKOS.depth, model.createTypedLiteral(4));
	level4.addProperty(XKOS.notationPattern, "[0-9]{2}\\.[0-9]{2}");
	level4.addProperty(XKOS.organizedBy, model.createResource("http://stamina-project.org/concepts/skd2008/class"));

	Resource level5 = model.createResource(BASE_URI + "/subclasses", XKOS.ClassificationLevel);
	level5.addProperty(SKOS.prefLabel, model.createLiteral("SKD 2008 - level 5 - Subclasses", "en"));
	level5.addProperty(XKOS.depth, model.createTypedLiteral(5));
	level5.addProperty(XKOS.notationPattern, "[0-9]{2}\\.[0-9]{3}");
	level5.addProperty(XKOS.organizedBy, model.createResource("http://stamina-project.org/concepts/skd2008/subclass"));

	// Attach the level list to the classification
	levelList = model.createList(new RDFNode[] {level1, level2, level3, level4, level5});
	scheme.addProperty(XKOS.levels, levelList);
}
 
开发者ID:FranckCo,项目名称:Stamina,代码行数:57,代码来源:SKDModelMaker.java


示例10: createClassificationAndLevels

import org.apache.jena.vocabulary.DC; //导入依赖的package包/类
/**
 * Creates in the model the resources representing the classification and its levels.
 */
	public void createClassificationAndLevels() {

	// Create the resource representing the classification (skos:ConceptScheme)
	scheme = model.createResource(BASE_URI + "naics", SKOS.ConceptScheme);
	scheme.addProperty(SKOS.prefLabel, model.createLiteral("North American Industry Classification System (NAICS) 2012", "en"));
	scheme.addProperty(SKOS.notation, "NAICS 2012");
	scheme.addProperty(SKOS.definition, model.createLiteral("The North American Industry Classification System (NAICS) is the standard used by Federal statistical agencies in classifying business establishments for the purpose of collecting, analyzing, and publishing statistical data related to the U.S. business economy.", "en"));
	scheme.addProperty(DC.publisher, model.createResource("http://www.census.gov"));
	scheme.addProperty(DC.date, model.createTypedLiteral("2012-01-01", "http://www.w3.org/2001/XMLSchema#date"));
	scheme.addProperty(FOAF.homepage, model.createResource("http://www.census.gov/eos/www/naics/"));
	scheme.addProperty(XKOS.covers, model.createResource("http://eurovoc.europa.eu/5992"));
	scheme.addProperty(XKOS.numberOfLevels, model.createTypedLiteral(5));

	// Create the resources representing the levels (xkos:ClassificationLevel)
	Resource level1 = model.createResource(BASE_URI + "/sectors", XKOS.ClassificationLevel);
	level1.addProperty(SKOS.prefLabel, model.createLiteral("NAICS 2012 - level 1 - Sectors", "en"));
	level1.addProperty(XKOS.depth, model.createTypedLiteral(1));
	level1.addProperty(XKOS.notationPattern, "[1-9]{2}");
	level1.addProperty(XKOS.organizedBy, model.createResource("http://stamina-project.org/concepts/naics2012/sector"));

	Resource level2 = model.createResource(BASE_URI + "/subsectors", XKOS.ClassificationLevel);
	level2.addProperty(SKOS.prefLabel, model.createLiteral("NAICS 2012 - level 2 - Subsectors", "en"));
	level2.addProperty(XKOS.depth, model.createTypedLiteral(2));
	level2.addProperty(XKOS.notationPattern, "[1-9]{3}");
	level2.addProperty(XKOS.organizedBy, model.createResource("http://stamina-project.org/concepts/naics2012/subsector"));

	Resource level3 = model.createResource(BASE_URI + "/groups", XKOS.ClassificationLevel);
	level3.addProperty(SKOS.prefLabel, model.createLiteral("NAICS 2012 - level 3 - Groups", "en"));
	level3.addProperty(XKOS.depth, model.createTypedLiteral(3));
	level3.addProperty(XKOS.notationPattern, "[1-9]{4}");
	level3.addProperty(XKOS.organizedBy, model.createResource("http://stamina-project.org/concepts/naics2012/group"));

	Resource level4 = model.createResource(BASE_URI + "/naics-industries", XKOS.ClassificationLevel);
	level4.addProperty(SKOS.prefLabel, model.createLiteral("NAICS 2012 - level 4 - NAICS Industries", "en"));
	level4.addProperty(XKOS.depth, model.createTypedLiteral(4));
	level4.addProperty(XKOS.notationPattern, "[1-9]{5}");
	level4.addProperty(XKOS.organizedBy, model.createResource("http://stamina-project.org/concepts/naics2012/naics-industry"));

	Resource level5 = model.createResource(BASE_URI + "/national-industries", XKOS.ClassificationLevel);
	level5.addProperty(SKOS.prefLabel, model.createLiteral("NAICS 2012 - level 5 - National Industries", "en"));
	level5.addProperty(XKOS.depth, model.createTypedLiteral(5));
	level5.addProperty(XKOS.notationPattern, "[1-9]{5}[0-9]");
	level5.addProperty(XKOS.organizedBy, model.createResource("http://stamina-project.org/concepts/naics2012/national-industry"));

	// Attach the level list to the classification
	levelList = model.createList(new RDFNode[] {level1, level2, level3, level4, level5});
	scheme.addProperty(XKOS.levels, levelList);
}
 
开发者ID:FranckCo,项目名称:Stamina,代码行数:52,代码来源:NAICSModelMaker.java


示例11: main

import org.apache.jena.vocabulary.DC; //导入依赖的package包/类
public static void main(String[] args)
{
    // Create the data.
    // This wil be the background (unnamed) graph in the dataset.
    Model model = createModel() ;
    
    // First part or the query string 
    String prolog = "PREFIX dc: <"+DC.getURI()+">" ;
    
    // Query string.
    String queryString = prolog + NL +
        "SELECT ?title WHERE {?x dc:title ?title}" ; 
    
    Query query = QueryFactory.create(queryString) ;
    // Print with line numbers
    query.serialize(new IndentedWriter(System.out,true)) ;
    System.out.println() ;
    
    // Create a single execution of this query, apply to a model
    // which is wrapped up as a Dataset
    
    try(QueryExecution qexec = QueryExecutionFactory.create(query, model)){
        // Or QueryExecutionFactory.create(queryString, model) ;

        System.out.println("Titles: ") ;

        // Assumption: it's a SELECT query.
        ResultSet rs = qexec.execSelect() ;

        // The order of results is undefined. 
        for ( ; rs.hasNext() ; )
        {
            QuerySolution rb = rs.nextSolution() ;

            // Get title - variable names do not include the '?' (or '$')
            RDFNode x = rb.get("title") ;

            // Check the type of the result value
            if ( x.isLiteral() )
            {
                Literal titleStr = (Literal)x  ;
                System.out.println("    "+titleStr) ;
            }
            else
                System.out.println("Strange - not a literal: "+x) ;

        }
    }
}
 
开发者ID:xcurator,项目名称:xcurator,代码行数:50,代码来源:ExQuerySelect1.java


示例12: main

import org.apache.jena.vocabulary.DC; //导入依赖的package包/类
public static void main(String[] args)
{
    Model model = createModel() ;
    
    Query query = QueryFactory.make() ;

    query.setQuerySelectType() ;
    
    // Build pattern
    
    ElementGroup elg = new ElementGroup() ;
    
    Var varTitle = Var.alloc("title") ;
    Var varX = Var.alloc("x") ;
    
    Triple t1 = new Triple(varX, DC.title.asNode(),  varTitle) ;
    elg.addTriplePattern(t1) ;
    
    // Don't use bNodes for anon variables.  The conversion is done in parsing.
    // BNodes here are assumed to be values from the target graph.
    Triple t2 = new Triple(varX, DC.description.asNode(), Var.alloc("desc")) ;
    elg.addTriplePattern(t2) ;
    
    // Attach the group to query.  
    query.setQueryPattern(elg) ;

    // Choose what we want - SELECT *
    //query.setQueryResultStar(true) ;
    query.addResultVar(varTitle) ;
    
    // Print query with line numbers
    // Prefix mapping just helps serialization
    query.getPrefixMapping().setNsPrefix("dc" , DC.getURI()) ;
    query.serialize(new IndentedWriter(System.out,true)) ;
    System.out.println() ;
    
    try ( QueryExecution qexec = QueryExecutionFactory.create(query, model) ) {
        // Assumption: it's a SELECT query.
        ResultSet rs = qexec.execSelect() ;
        
        // The order of results is undefined.
        System.out.println("Titles: ") ;
        for ( ; rs.hasNext() ; )
        {
            QuerySolution rb = rs.nextSolution() ;
            
            // Get title - variable names do not include the '?' (or '$')
            RDFNode x = rb.get("title") ;
            
            // Check the type of the result value
            if ( x instanceof Literal )
            {
                Literal titleStr = (Literal)x  ;
                System.out.println("    "+titleStr) ;
            }
            else
                System.out.println("Strange - not a literal: "+x) ;
                
        }
    }
}
 
开发者ID:xcurator,项目名称:xcurator,代码行数:62,代码来源:ExProg1.java


示例13: main

import org.apache.jena.vocabulary.DC; //导入依赖的package包/类
public static void main(String[] args)
{
    Model model = createModel() ;
    
    Query query = QueryFactory.make() ;
    query.setQuerySelectType() ;
    
    // See also ExProg1
    
    ElementGroup elg = new ElementGroup() ;
    
    Var varTitle = Var.alloc("title") ;
    Var varX = Var.alloc("x") ;
    
    Triple t1 = new Triple(varX, DC.title.asNode(),  varTitle) ;
    elg.addTriplePattern(t1) ;
    
    // Adds a filter.  Need to wrap variable in a NodeVar.
    Expr expr = new E_Regex(new ExprVar(varTitle), "sparql", "i") ;
    ElementFilter filter = new  ElementFilter(expr) ;
    elg.addElementFilter(filter) ;
    
    // Attach the group to query.  
    query.setQueryPattern(elg) ;
    
    // Choose what we want - SELECT ?title
    query.addResultVar(varTitle) ;
    
    // Print query with line numbers
    // Prefix mapping just helps serialization
    query.getPrefixMapping().setNsPrefix("dc" , DC.getURI()) ;
    query.serialize(new IndentedWriter(System.out,true)) ;
    System.out.println() ;
    
    try(QueryExecution qexec = QueryExecutionFactory.create(query, model)) {
        // Assumption: it's a SELECT query.
        ResultSet rs = qexec.execSelect() ;
        
        // The order of results is undefined.
        System.out.println("Titles: ") ;
        for ( ; rs.hasNext() ; )
        {
            QuerySolution rb = rs.nextSolution() ;
            
            // Get title - variable names do not include the '?' (or '$')
            RDFNode x = rb.get("title") ;
            
            // Check the type of the result value
            if ( x instanceof Literal )
            {
                Literal titleStr = (Literal)x  ;
                System.out.println("    "+titleStr) ;
            }
            else
                System.out.println("Strange - not a literal: "+x) ;
                
        }
    }
}
 
开发者ID:xcurator,项目名称:xcurator,代码行数:60,代码来源:ExProg2.java


示例14: testSuccess2

import org.apache.jena.vocabulary.DC; //导入依赖的package包/类
@Test
public void testSuccess2() {
	prefixes.setNsPrefix("dc", DC.NS);
	assertEval(stringNode(DC.NS), "tarql:expandPrefix('dc')");
}
 
开发者ID:tarql,项目名称:tarql,代码行数:6,代码来源:ExpandPrefixTest.java


示例15: testSuccess2

import org.apache.jena.vocabulary.DC; //导入依赖的package包/类
@Test
public void testSuccess2() {
	prefixes.setNsPrefix("dc", DC.NS);
	assertEval(createURI(DC.NS + "title"), "tarql:expandPrefixedName('dc:title')");
}
 
开发者ID:tarql,项目名称:tarql,代码行数:6,代码来源:ExpandPrefixedNameTest.java



注:本文中的org.apache.jena.vocabulary.DC类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ScheduleContract类代码示例发布时间:2022-05-23
下一篇:
Java Message类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap