当前位置: 首页>>代码示例>>Java>>正文


Java VCARD类代码示例

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


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

示例1: main

import com.hp.hpl.jena.vocabulary.VCARD; //导入依赖的package包/类
/**
 * 
 * @param args
 */
public static void main(String args[])
{
	// Create an empty model
	Model model = ModelFactory.createDefaultModel();
			
	String fullName = "John Smith";
	String johnURI = ns+"JohnSmith";
	
	// ** TASK 2.1: Create the resource John Smith
	Resource johnSmith = ResourceFactory.createResource("John Smith");

	// Add to johnSmith the datatype property full name (from the VCARD vocabulary)
	johnSmith.addProperty(VCARD.FN, fullName);
	
	// ** TASK 2.2: Create a new resource for Jane Smith, specifying her full name and email **
	Resource janeSmith = ResourceFactory.createResource("Jane Smith");
	janeSmith.addProperty(VCARD.FN, "Jane Smith");
	janeSmith.addProperty(VCARD.EMAIL, "[email protected]");		
	
	// ** TASK 2.3: Add Jane as a person who John knows through an object property from the FOAF vocabulary**
	johnSmith.addProperty(FOAF.knows, janeSmith);
	
	
	model.write(System.out, "RDF/XML-ABBREV");
}
 
开发者ID:FacultadInformatica-LinkedData,项目名称:Curso2014-2015,代码行数:30,代码来源:Task02.java

示例2: exibirCidadesCadastradasRDF

import com.hp.hpl.jena.vocabulary.VCARD; //导入依赖的package包/类
public void exibirCidadesCadastradasRDF() {
List<Cidade> cidades = listaCidadeBean;
recurso = new StringWriter();
	
// create an empty model
Model model = ModelFactory.createDefaultModel();

for (Cidade cidade : cidades) {
    
    Resource recursoCidade = model.createResource();
    try {
	recursoCidade.addProperty(VCARD.NAME, cidade.getNome());

	recursoCidade.addProperty(VCARD.LABEL, cidade.getDescricao());
	
    
	recursoCidade.addProperty(VCARD.Country, cidade.getPais().getNome());	    }
    catch (Throwable e) {
	System.out.println("Erro ao transformar dados em RDF: " + e.getMessage());
    }
		    
}
    model.write(recurso, "RDF/XML-ABBREV");		
    model.write(System.out, "Turtle");	    
   }
 
开发者ID:dwws-ufes,项目名称:2014-infotur,代码行数:26,代码来源:TurismoController.java

示例3: testFindAnonymousNode

import com.hp.hpl.jena.vocabulary.VCARD; //导入依赖的package包/类
@Test
	public void testFindAnonymousNode() {
		find(null, VCARD.Pcode, createPlainLiteral("BS34 8QZ"));
//		dump();
		assertStatement(
				createAnonResource(new AnonId("map:[email protected]@7")),
				VCARD.Pcode, createPlainLiteral("BS34 8QZ"));
		assertStatementCount(1);
	}
 
开发者ID:d2rq,项目名称:r2rml-kit,代码行数:10,代码来源:FindTest.java

示例4: testMatchAnonymousSubject

import com.hp.hpl.jena.vocabulary.VCARD; //导入依赖的package包/类
@Test
	public void testMatchAnonymousSubject() {
		find(
				createAnonResource(new AnonId("map:[email protected]@7")),
				VCARD.Pcode, null);
//		dump();
		assertStatement(
				createAnonResource(new AnonId("map:[email protected]@7")),
				VCARD.Pcode, createPlainLiteral("BS34 8QZ"));
		assertStatementCount(1);
	}
 
开发者ID:d2rq,项目名称:r2rml-kit,代码行数:12,代码来源:FindTest.java

示例5: testMatchAnonymousObject

import com.hp.hpl.jena.vocabulary.VCARD; //导入依赖的package包/类
@Test
	public void testMatchAnonymousObject() {
		find(
				null, VCARD.ADR,
				createAnonResource(new AnonId("map:[email protected]@7")));
//		dump();
		assertStatement(
				resource("organizations/7"), VCARD.ADR, 
				createAnonResource(new AnonId("map:[email protected]@7")));
		assertStatementCount(1);
	}
 
开发者ID:d2rq,项目名称:r2rml-kit,代码行数:12,代码来源:FindTest.java

示例6: testFindAnonymousNode

import com.hp.hpl.jena.vocabulary.VCARD; //导入依赖的package包/类
public void testFindAnonymousNode() {
		find(null, VCARD.Pcode, m.createLiteral("BS34 8QZ"));
//		dump();
		assertStatement(
				m.createResource(new AnonId("map:[email protected]@7")),
				VCARD.Pcode, m.createLiteral("BS34 8QZ"));
		assertStatementCount(1);
	}
 
开发者ID:aitoralmeida,项目名称:c4a_data_repository,代码行数:9,代码来源:FindTest.java

示例7: testMatchAnonymousSubject

import com.hp.hpl.jena.vocabulary.VCARD; //导入依赖的package包/类
public void testMatchAnonymousSubject() {
		find(
				m.createResource(new AnonId("map:[email protected]@7")),
				VCARD.Pcode, null);
//		dump();
		assertStatement(
				m.createResource(new AnonId("map:[email protected]@7")),
				VCARD.Pcode, m.createLiteral("BS34 8QZ"));
		assertStatementCount(1);
	}
 
开发者ID:aitoralmeida,项目名称:c4a_data_repository,代码行数:11,代码来源:FindTest.java

示例8: testMatchAnonymousObject

import com.hp.hpl.jena.vocabulary.VCARD; //导入依赖的package包/类
public void testMatchAnonymousObject() {
		find(
				null, VCARD.ADR,
				m.createResource(new AnonId("map:[email protected]@7")));
//		dump();
		assertStatement(
				resource("organizations/7"), VCARD.ADR, 
				m.createResource(new AnonId("map:[email protected]@7")));
		assertStatementCount(1);
	}
 
开发者ID:aitoralmeida,项目名称:c4a_data_repository,代码行数:11,代码来源:FindTest.java

示例9: mostrarTodo

import com.hp.hpl.jena.vocabulary.VCARD; //导入依赖的package包/类
public static List<String> mostrarTodo(){
	
	
	String queryString = 
			"PREFIX vcard: <" + VCARD.getURI() + "> " +
			"SELECT ?Subject ?title "+
			"WHERE { ?Subject vcard:TITLE ?title. } ";
	Query query = QueryFactory.create(queryString);
	QueryExecution qexec = QueryExecutionFactory.create(query, model) ;
	ResultSet results = qexec.execSelect() ;
	
	
	ArrayList<String> resultadoConsulta = new ArrayList<String>();
	
	while (results.hasNext())
	{
		QuerySolution binding = results.nextSolution();
		Resource subj = (Resource) binding.get("Subject");
		String categoria=subj.getProperty(VCARD.CATEGORIES).getLiteral().toString(); 
		if(categoria.length()>22)
			categoria=categoria.substring(23);
		else 
			categoria="actividad";
		resultadoConsulta.add("Evento: "+subj.getProperty(VCARD.TITLE).getLiteral()+"\n Fecha: "+subj.getProperty(VCARD.Other).getLiteral()+"  Categoría: "+categoria+"\n Biblioteca: "+subj.getProperty(VCARD.Locality).getLiteral());
	}
	
	return resultadoConsulta;
	
}
 
开发者ID:FacultadInformatica-LinkedData,项目名称:Curso2014-2015,代码行数:30,代码来源:Consultas.java

示例10: main

import com.hp.hpl.jena.vocabulary.VCARD; //导入依赖的package包/类
public static void main(String args[])
{
	String filename = "example5.rdf";
	
	// Create an empty model
	OntModel model = ModelFactory.createOntologyModel(OntModelSpec.RDFS_MEM);
	
	// Use the FileManager to find the input file
	InputStream in = FileManager.get().open(filename);

	if (in == null)
		throw new IllegalArgumentException("File: "+filename+" not found");

	// Read the RDF/XML file
	model.read(in, null);
	
	// ** TASK 6.1: Create a new class named "University" **
	model.createClass(ns+"University");
	
	// ** TASK 6.2: Add "Researcher" as a subclass of "Person" **
	model.getOntClass(ns+"Person").addSubClass(model.createClass(ns+"Researcher"));
	
	// ** TASK 6.3: Create a new property named "worksIn" **
	model.createProperty(ns+"worksIn");
	
	// ** TASK 6.4: Create a new individual of Researcher named "Jane Smith" **
	model.getOntClass(ns+"Researcher").createIndividual(ns+"JaneSmith");
	
	// ** TASK 6.5: Add to the individual JaneSmith the fullName, given and family names **
	model.getIndividual(ns+"JaneSmith").addProperty(VCARD.FN, "Jane Smith");
	model.getIndividual(ns+"JaneSmith").addProperty(VCARD.Given, "Jane");
	model.getIndividual(ns+"JaneSmith").addProperty(VCARD.Family, "Smith");
	
	// ** TASK 6.6: Add UPM as the university where John works **
	model.getIndividual(ns+"JohnSmith").addProperty(model.getProperty(ns+"worksIn"), model.getOntClass(ns+"University").createIndividual(ns+"UPM"));
	
	model.write(System.out, "RDF/XML-ABBREV");
}
 
开发者ID:FacultadInformatica-LinkedData,项目名称:Curso2014-2015,代码行数:39,代码来源:Task06_Tubilok.java

示例11: setupMaps

import com.hp.hpl.jena.vocabulary.VCARD; //导入依赖的package包/类
void setupMaps() {
    nameSpaces.set11(RDF.getURI(), "rdf");
    nameSpaces.set11(RDFS.getURI(), "rdfs");
    nameSpaces.set11(DC.getURI(), "dc");
    nameSpaces.set11(RSS.getURI(), "rss");
    nameSpaces.set11("http://www.daml.org/2001/03/daml+oil.daml#", "daml");
    nameSpaces.set11(VCARD.getURI(), "vcard");
    nameSpaces.set11("http://www.w3.org/2002/07/owl#", "owl");
}
 
开发者ID:jacekkopecky,项目名称:parkjam,代码行数:10,代码来源:BaseXMLWriter.java

示例12: link

import com.hp.hpl.jena.vocabulary.VCARD; //导入依赖的package包/类
@Override
public void link(Model m, User t, AccessRights rights,
                 Resource r, Provider<UriBuilder> uriBuilder) {
    m.setNsPrefix(VCARD_PREFIX, VCARD.getURI());
    r.addProperty(VCARD.EMAIL, t.getMail())
            .addProperty(VCARD.NICKNAME, t.getName());

}
 
开发者ID:enviroCar,项目名称:enviroCar-server,代码行数:9,代码来源:UserVCardLinker.java

示例13: DatasetRestSrv

import com.hp.hpl.jena.vocabulary.VCARD; //导入依赖的package包/类
/**
 * Class constructor used to instantiate the Jena Model and define the various properties for
 * the model itself.
 */
public DatasetRestSrv() {
    // Jena model instantiation - empty model
    model = ModelFactory.createDefaultModel();

    // Prefixes definition
    model.setNsPrefix("adms", ADMS);
    model.setNsPrefix("dcat", DCAT);
    model.setNsPrefix("dct", DCT);
    model.setNsPrefix("foaf", FOAF.NS);
    model.setNsPrefix("vcard", VCARD);

    // Properties instantiation
    admsContactPoint = model.createProperty(ADMS, "contactPoint");
    dcatAccessURL = model.createProperty(DCAT, "accessURL");
    dcatDataset = model.createProperty(DCAT, "dataset");
    dcatDistribution = model.createProperty(DCAT, "distribution");
    dcatKeyword = model.createProperty(DCAT, "keyword");
    //        dcatTheme = model.createProperty(DCAT, "theme");
    //        dcatThemeTaxonomy = model.createProperty(DCAT, "themeTaxonomy");
    dctDescription = model.createProperty(DCT, "description");
    dctFormat = model.createProperty(DCT, "format");
    dctIdentifier = model.createProperty(DCT, "identifier");
    dctIssued = model.createProperty(DCT, "issued");
    dctLanguage = model.createProperty(DCT, "language");
    dctLicense = model.createProperty(DCT, "license");
    dctModified = model.createProperty(DCT, "modified");
    dctPublisher = model.createProperty(DCT, "publisher");
    dctTitle = model.createProperty(DCT, "title");
    dctType = model.createProperty(DCT, "type");
    vcardHasValue = model.createProperty(VCARD, "hasValue");
    vardHasAddress = model.createProperty(VCARD, "hasAddress");
    vcardHasTelephone = model.createProperty(VCARD, "hasTelephone");
    vcardHasEmail = model.createProperty(VCARD, "hasEmail");
    vcardStreetAddress = model.createProperty(VCARD, "street-address");
    vcardPostalCode = model.createProperty(VCARD, "postal-code");
    vcardLocality = model.createProperty(VCARD, "locality");
    vcardCountryName = model.createProperty(VCARD, "country-name");
    vcardFn = model.createProperty(VCARD, "fn");

    // Date Format specification
    format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
}
 
开发者ID:FiwareTIConsoft,项目名称:fiware-metaware,代码行数:47,代码来源:DatasetRestSrv.java

示例14: onCreate

import com.hp.hpl.jena.vocabulary.VCARD; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_rdfread_write);

    TextView textView = (TextView) findViewById(R.id.rdfTextView);
    textView.setMovementMethod(new ScrollingMovementMethod());

    // create tdb dataset
    File directory = new File(getFilesDir(), "tdb_dataset");
    directory.delete();
    directory.mkdir();
    Dataset dataset = TDBFactory.createDataset(directory.getAbsolutePath()) ;
    dataset.begin(ReadWrite.WRITE);
    Model model = dataset.getDefaultModel();

    // read a turtle file from assets and write them into a tdb backed model
    try {
        InputStream skos_ttl = getAssets().open("skos.ttl");
        RDFDataMgr.read(model, skos_ttl, Lang.TURTLE);
        skos_ttl.close();
        InputStream geosparql_rdf_xml = getAssets().open("geosparql_vocab_all.rdf");
        RDFDataMgr.read(model, geosparql_rdf_xml, Lang.RDFXML);
        geosparql_rdf_xml.close();
    } catch (IOException e) {
        Log.e(TAG, e.toString());
        e.printStackTrace();
    }

    // add some example data
    String personURI    = "http://somewhere/JohnSmith";
    String fullName     = "John Smith";
    Resource johnSmith = model.createResource(personURI);
    johnSmith.addProperty(VCARD.FN, fullName);

    dataset.commit();
    dataset.end();

    // read from tdb and print triples
    dataset.begin(ReadWrite.READ);
    Query query = QueryFactory.create("SELECT * WHERE { ?s ?p ?o } LIMIT 2");
    QueryExecution qexec = QueryExecutionFactory.create(query, model);
    ResultSet results = qexec.execSelect();
    String resultString = ResultSetFormatter.asText(results);
    Log.d(TAG, resultString);

    StringWriter dump = new StringWriter();
    RDFDataMgr.write(dump, dataset, RDFFormat.JSONLD_PRETTY);

    dataset.end();
    dataset.close();

    textView.setText(dump.toString());

}
 
开发者ID:sbrunk,项目名称:jena-android,代码行数:56,代码来源:RDFReadWriteActivity.java

示例15: consulta

import com.hp.hpl.jena.vocabulary.VCARD; //导入依赖的package包/类
public static List<String> consulta(String campo, int tipo){
	
	ArrayList<String> resultadoConsulta = new ArrayList<String>();
	String queryString="";
	switch(tipo){
		case CONSULTA_FECHA: 
			queryString="PREFIX vcard: <" + VCARD.getURI() + "> " +
			"SELECT ?Subject  "+
			"WHERE { ?Subject vcard:Other '"+campo +"'. } ";
			break;
		case CONSULTA_BIBLIOTECA:
			queryString="PREFIX vcard: <" + VCARD.getURI() + "> " +
					"SELECT ?Subject ?title "+
					"WHERE { ?Subject vcard:Locality '" +campo+ "'. } ";
			break;
		case CONSULTA_TIPO:
			queryString="PREFIX vcard: <" + VCARD.getURI() + "> " +
					"SELECT ?Subject ?title "+
					"WHERE { ?Subject vcard:CATEGORIES '"+campo+"'. } ";
			break;
	}
		
			
		Query query = QueryFactory.create(queryString);
		QueryExecution qexec = QueryExecutionFactory.create(query, model) ;
		ResultSet results = qexec.execSelect() ;

	while (results.hasNext())
	{
		QuerySolution binding = results.nextSolution();
		Resource subj = (Resource) binding.get("Subject");
		String categoria=subj.getProperty(VCARD.CATEGORIES).getLiteral().toString(); 
		if(categoria.length()>22)
			categoria=categoria.substring(23);
		else 
			categoria="actividad";
		resultadoConsulta.add("Evento: "+subj.getProperty(VCARD.TITLE).getLiteral()+"\n Fecha: "+subj.getProperty(VCARD.Other).getLiteral()+"  Categoría: "+categoria+"\n Biblioteca: "+subj.getProperty(VCARD.Locality).getLiteral());
	}
	
	return resultadoConsulta; 
}
 
开发者ID:FacultadInformatica-LinkedData,项目名称:Curso2014-2015,代码行数:42,代码来源:Consultas.java


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