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

Java FOAF类代码示例

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

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



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

示例1: addPropertyValue

import org.eclipse.rdf4j.model.vocabulary.FOAF; //导入依赖的package包/类
/**
 * Adds a property value (a triple describing the Resource).
 *
 * @param tripleDF the triple display format
 * @throws RMapWebException the RMap web exception
 */
public void addPropertyValue(TripleDisplayFormat tripleDF) throws RMapWebException {
	if (tripleDF!=null) {
		
		//these predicates should be first in the list. Property Values list is ordered alphabetically.
		String[] bubbleToTop = {DC.TITLE.toString(),DCTERMS.TITLE.toString(),FOAF.NAME.toString(),
								RDFS.LABEL.toString(), RDFS.SEEALSO.toString(), DC.IDENTIFIER.toString(),
								DCTERMS.IDENTIFIER.toString(), SKOS.PREF_LABEL.toString()};
		
		String listKey;
		String predicate= tripleDF.getPredicate().toString();
		//if it's a title, name or label, bubble to top of list.
		if (Arrays.asList(bubbleToTop).contains(predicate)){
			listKey = tripleDF.getSubjectDisplay()+"______a" + tripleDF.getPredicateDisplay()+tripleDF.getObjectDisplay();	
		} else {
			listKey = tripleDF.getSubjectDisplay()+tripleDF.getPredicateDisplay()+tripleDF.getObjectDisplay();	
		}
		
		this.propertyValues.put(listKey, tripleDF);
	} else {
		throw new RMapWebException(ErrorCode.ER_RESOURCE_PROPERTY_VALUE_NULL);
	}
}
 
开发者ID:rmap-project,项目名称:rmap,代码行数:29,代码来源:ResourceDescription.java


示例2: writeCatalog

import org.eclipse.rdf4j.model.vocabulary.FOAF; //导入依赖的package包/类
/**
 * Write DCAT catalog to XML.
 * 
 * @param w XML writer
 * @param con RDF triple store connection
 */
private static void writeCatalog(XMLStreamWriter w, RepositoryConnection con) 
		throws XMLStreamException {
	String cat = "http://data.gov.be/catalog";
	
	w.writeStartElement("rdf:RDF");
	writePrefixes(w);
	
	w.writeStartElement("dcat:Catalog");
	w.writeAttribute("dct:identifier", cat);
	w.writeAttribute("rdf:about", cat);

	IRI uri = con.getValueFactory().createIRI(cat);
	writeGeneric(w, con, uri);		
	writeReferences(w, con, uri, FOAF.HOMEPAGE, "foaf:homepage");
	writeLicenses(w, con, uri, DCTERMS.LICENSE);
	writeDatasets(w, con);
	
	w.writeEndElement();
	
	writeOrgs(w, con);
	
	w.writeEndElement();
}
 
开发者ID:Fedict,项目名称:dcattools,代码行数:30,代码来源:EDP.java


示例3: ckanOrganization

import org.eclipse.rdf4j.model.vocabulary.FOAF; //导入依赖的package包/类
/**
 * Parse CKAN organization
 *
 * @param store
 * @param uri
 * @param json
 * @param lang language code
 * @throws RepositoryException
 * @throws MalformedURLException
 */
protected void ckanOrganization(Storage store, IRI uri, JsonObject json, String lang)
		throws RepositoryException, MalformedURLException {
	if (!json.isNull(CkanJson.ORGANIZATION)) {
		JsonObject obj = json.getJsonObject(CkanJson.ORGANIZATION);

		if (obj.getBoolean(CkanJson.IS_ORG)) {
			String s = obj.getString(CkanJson.ID, "");
			IRI org = store.getURI(makeOrgURL(s).toString());
			store.add(uri, DCTERMS.PUBLISHER, org);
			store.add(org, RDF.TYPE, FOAF.ORGANIZATION);

			parseString(store, org, obj, CkanJson.NAME, FOAF.NAME, lang);
		}
	}
}
 
开发者ID:Fedict,项目名称:dcattools,代码行数:26,代码来源:CkanJson.java


示例4: setNameStmt

import org.eclipse.rdf4j.model.vocabulary.FOAF; //导入依赖的package包/类
/**
 * Sets the statement containing the Agent Name.
 *
 * @param name statement containing the Agent Name
 * @throws RMapDefectiveArgumentException the RMap defective argument exception
 */
protected void setNameStmt (Value name) throws RMapDefectiveArgumentException{
	if (name == null || name.toString().length()==0)
		{throw new RMapDefectiveArgumentException("RMapAgent name is null or empty");}
	Statement stmt = ORAdapter.getValueFactory().createStatement(this.context, 
			FOAF.NAME, name, this.context);
	this.nameStmt = stmt;
}
 
开发者ID:rmap-project,项目名称:rmap,代码行数:14,代码来源:ORMapAgent.java


示例5: getStatements

import org.eclipse.rdf4j.model.vocabulary.FOAF; //导入依赖的package包/类
/**
 *
 * Get RDF statements from catalog metadata object
 *
 * @param model RDF model with common metadata properties
 * @param metadata CatalogMetadata object
 * @return List of RDF statements
 * @throws MetadataException
 */
private static List<Statement> getStatements(Model model,
        CatalogMetadata metadata)
        throws MetadataException {
    try {
        Preconditions.checkNotNull(metadata.getPublisher(),
                "Metadata publisher must not be null.");
        Preconditions.checkNotNull(metadata.getThemeTaxonomys(),
                "Metadata dcat:themeTaxonomy must not be null.");
        Preconditions.checkArgument(!metadata.getThemeTaxonomys().isEmpty(),
                "Metadata dcat:themeTaxonomy must not be empty.");
    } catch (NullPointerException | IllegalArgumentException ex) {
        throw (new MetadataException(ex.getMessage()));
    }
    LOGGER.info("Adding catalogy metadata properties to the rdf model");
    addStatement(model, metadata.getUri(), RDF.TYPE, DCAT.TYPE_CATALOG);
    addStatement(model,metadata.getUri(), FOAF.HOMEPAGE, 
            metadata.getHomepage());
    addStatement(model,metadata.getUri(), DCTERMS.ISSUED,
                metadata.getCatalogIssued());
    addStatement(model,metadata.getUri(), DCTERMS.MODIFIED,
                metadata.getCatalogModified());
    metadata.getThemeTaxonomys().stream().forEach((themeTax) -> {
        addStatement(model, metadata.getUri(), DCAT.THEME_TAXONOMY, 
                themeTax);
    });
    metadata.getDatasets().stream().forEach((dataset) -> {
        addStatement(model, metadata.getUri(), DCAT.DATASET, dataset);
    });
    return getStatements(model);
}
 
开发者ID:DTL-FAIRData,项目名称:fairmetadata4j,代码行数:40,代码来源:MetadataUtils.java


示例6: addAgentStatements

import org.eclipse.rdf4j.model.vocabulary.FOAF; //导入依赖的package包/类
/**
 * Add agent instance's rdf statements
 * @param model
 * @param subj
 * @param pred
 * @param objc 
 */
private static void addAgentStatements(Model model, IRI subj, IRI pred, 
        Agent objc) {
    if (objc != null) {
        addStatement(model, subj, pred, objc.getUri());
        addStatement(model, objc.getUri(), RDF.TYPE, objc.getType());
        if (objc.getName() == null) {
            String errMsg = "No publisher name provided";
            LOGGER.info(errMsg);
        } else {
            addStatement(model, objc.getUri(), FOAF.NAME, objc.getName());
        }
    }        
}
 
开发者ID:DTL-FAIRData,项目名称:fairmetadata4j,代码行数:21,代码来源:MetadataUtils.java


示例7: parse

import org.eclipse.rdf4j.model.vocabulary.FOAF; //导入依赖的package包/类
/**
 * Parse RDF statements to create catalog metadata object
 *
 * @param statements List of RDF statement list
 * @param catalogURI Catalog URI
 * @return CatalogMetadata object
 */
@Override
public CatalogMetadata parse(@Nonnull List<Statement> statements,
        @Nonnull IRI catalogURI) {
    Preconditions.checkNotNull(catalogURI,
            "Catalog URI must not be null.");
    Preconditions.checkNotNull(statements,
            "Catalog statements must not be null.");
    LOGGER.info("Parsing catalog metadata");

    CatalogMetadata metadata = super.parse(statements, catalogURI);
    List<IRI> datasets = new ArrayList();
    ValueFactory f = SimpleValueFactory.getInstance();
    for (Statement st : statements) {
        Resource subject = st.getSubject();
        IRI predicate = st.getPredicate();
        Value object = st.getObject();

        if (subject.equals(catalogURI)) {
            if (predicate.equals(FOAF.HOMEPAGE)) {
                metadata.setHomepage((IRI) object);
            } else if (predicate.equals(DCAT.THEME_TAXONOMY)) {
                metadata.getThemeTaxonomys().add((IRI) object);
            } else if (predicate.equals(DCAT.DATASET)) {
                datasets.add((IRI) object);
            } else if (predicate.equals(DCTERMS.ISSUED)) {
                metadata.setCatalogIssued(f.createLiteral(object.
                        stringValue(), XMLSchema.DATETIME));
            } else if (predicate.equals(DCTERMS.MODIFIED)) {
                metadata.setCatalogModified(f.createLiteral(object.
                        stringValue(), XMLSchema.DATETIME));
            }
        }
    }
    if(!datasets.isEmpty()) {
        metadata.setDatasets(datasets);
    }
    return metadata;
}
 
开发者ID:DTL-FAIRData,项目名称:fairmetadata4j,代码行数:46,代码来源:CatalogMetadataParser.java


示例8: parse

import org.eclipse.rdf4j.model.vocabulary.FOAF; //导入依赖的package包/类
/**
 * Create agent object
 * 
 * @param statements    List of rdf statements
 * @param agentURI      Agent uri
 * @return 
 */
public static Agent parse(@Nonnull List<Statement> statements,
        @Nonnull IRI agentURI) {
    Preconditions.checkNotNull(agentURI,
            "Agent URI must not be null.");
    Preconditions.checkNotNull(statements,
            "Agent statements must not be null.");
    Preconditions.checkArgument(!statements.isEmpty(),
            "Agent statements must not be empty.");
    LOGGER.info("Parsing agent");
    Agent agent = new Agent();
    agent.setUri(agentURI);
    for (Statement st : statements) {
        Resource subject = st.getSubject();
        IRI predicate = st.getPredicate();
        Value object = st.getObject();

        if (subject.equals(agentURI)) {
            if (predicate.equals(RDF.TYPE)) {
                agent.setType((IRI) object);
            } else if (predicate.equals(FOAF.NAME)) {
                ValueFactory f = SimpleValueFactory.getInstance();
                agent.setName(f.createLiteral(object.stringValue(),
                        XMLSchema.STRING));
            }
        }
    }
    return agent;
}
 
开发者ID:DTL-FAIRData,项目名称:fairmetadata4j,代码行数:36,代码来源:AgentParser.java


示例9: writePrefixes

import org.eclipse.rdf4j.model.vocabulary.FOAF; //导入依赖的package包/类
/**
 * Write XML namespace prefixes
 * 
 * @param w writer
 * @throws XMLStreamException
 */			
private static void writePrefixes(XMLStreamWriter w) throws XMLStreamException {
	w.writeNamespace(DCAT.PREFIX, DCAT.NAMESPACE);
	w.writeNamespace("dct", DCTERMS.NAMESPACE);
	w.writeNamespace(FOAF.PREFIX, FOAF.NAMESPACE);
	w.writeNamespace(RDF.PREFIX, RDF.NAMESPACE);
	w.writeNamespace(RDFS.PREFIX, RDFS.NAMESPACE);
	w.writeNamespace("schema", "http://schema.org/");
	w.writeNamespace(VCARD4.PREFIX, VCARD4.NAMESPACE);
}
 
开发者ID:Fedict,项目名称:dcattools,代码行数:16,代码来源:EDP.java


示例10: writeOrg

import org.eclipse.rdf4j.model.vocabulary.FOAF; //导入依赖的package包/类
/**
 * Write FOAF organization
 * 
 * @param w XML writer
 * @param con RDF triple store connection
 * @param uri URI of the organization
 * @throws XMLStreamException 
 */
private static void writeOrg(XMLStreamWriter w, RepositoryConnection con,
		IRI uri) throws XMLStreamException {
	if (uri.stringValue().startsWith(BELGIF_PREFIX)) {
		w.writeStartElement("foaf:Organization");	
		w.writeAttribute("rdf:about", uri.stringValue());
	
		writeLiterals(w, con, uri, FOAF.NAME, "foaf:name");
		writeReferences(w, con, uri, FOAF.HOMEPAGE, "foaf:homepage");
		writeReferences(w, con, uri, FOAF.MBOX, "foaf:mbox");
	
		w.writeEndElement();
	}
}
 
开发者ID:Fedict,项目名称:dcattools,代码行数:22,代码来源:EDP.java


示例11: writeOrgs

import org.eclipse.rdf4j.model.vocabulary.FOAF; //导入依赖的package包/类
/**
 * Write FOAF organizations
 * 
 * @param w XML writer
 * @param con RDF triple store connection
 * @throws XMLStreamException 
 */
private static void writeOrgs(XMLStreamWriter w, RepositoryConnection con) 
		throws XMLStreamException {
	int nr = 0;
	
	try (RepositoryResult<Statement> res = con.getStatements(null, RDF.TYPE, FOAF.ORGANIZATION)) {
		while (res.hasNext()) {
			nr++;
			writeOrg(w, con, (IRI) res.next().getSubject());
		}
	}
	logger.info("Wrote {} organizations", nr);
}
 
开发者ID:Fedict,项目名称:dcattools,代码行数:20,代码来源:EDP.java


示例12: generateCatalogInfo

import org.eclipse.rdf4j.model.vocabulary.FOAF; //导入依赖的package包/类
/**
 * Extra DCAT catalog info
 *
 * @param store RDF store
 * @param catalog catalog URI
 * @throws org.eclipse.rdf4j.repository.RepositoryException
 */
public void generateCatalogInfo(Storage store, IRI catalog)
		throws RepositoryException {
	store.add(catalog, DCTERMS.TITLE, "DCAT Catalog for " + getName(), "en");
	store.add(catalog, DCTERMS.DESCRIPTION, "Converted by Fedict's converter", "en");
	store.add(catalog, DCTERMS.MODIFIED, DATEFMT.format(new Date()));
	store.add(catalog, DCTERMS.LICENSE, DATAGOVBE.LICENSE_CC0);
	store.add(catalog, FOAF.HOMEPAGE, getBase());

	String[] langs = getAllLangs();
	for (String lang : langs) {
		store.add(catalog, DCTERMS.LANGUAGE, MDR_LANG.MAP.get(lang));
	}
}
 
开发者ID:Fedict,项目名称:dcattools,代码行数:21,代码来源:Scraper.java


示例13: main

import org.eclipse.rdf4j.model.vocabulary.FOAF; //导入依赖的package包/类
public static void main(String... args) throws RepositoryException, IOException, RDFParseException, MalformedQueryException, QueryEvaluationException {

        // instantiate repository
        MarkLogicRepository repo = new MarkLogicRepository("localhost",8200, new DatabaseClientFactory.DigestAuthContext("admin", "admin"));
        repo.initialize();

        // get repository connection
        MarkLogicRepositoryConnection conn = repo.getConnection();

        // return number of triples contained in repository
        logger.info("number of triples: {}", conn.size());

        // add triples from a file
        File inputFile = new File("src/main/resources/testdata/test-small.owl");
        conn.add(inputFile, null, RDFFormat.RDFXML, (Resource) null);

        logger.info("number of triples: {}", conn.size());

        // add a few constructed triples
        Resource context1 = conn.getValueFactory().createIRI("http://marklogic.com/examples/context1");
        Resource context2 = conn.getValueFactory().createIRI("http://marklogic.com/examples/context2");
        ValueFactory f= conn.getValueFactory();
        String namespace = "http://example.org/";
        IRI john = f.createIRI(namespace, "john");
        conn.add(john, RDF.TYPE, FOAF.PERSON,context1);
        conn.add(john, RDFS.LABEL, f.createLiteral("John", XMLSchema.STRING),context2);

        // check if triples with subject john exist in repository
        String checkJohnQuery = "ASK { <http://example.org/john> ?p ?o .}";
        BooleanQuery booleanJohnQuery = conn.prepareBooleanQuery(QueryLanguage.SPARQL, checkJohnQuery);
        logger.info("result of query: {}",booleanJohnQuery.evaluate());

        // perform SPARQL query with pagination
        String queryString = "select * { ?s ?p ?o }";
        MarkLogicTupleQuery tupleQuery = conn.prepareTupleQuery(QueryLanguage.SPARQL, queryString);
        tupleQuery.setIncludeInferred(true);
        TupleQueryResult results = tupleQuery.evaluate(1,10);

        //iterate through query results
        while(results.hasNext()){
            BindingSet bindings = results.next();
            logger.info("subject:{}",bindings.getValue("s"));
            logger.info("predicate:{}", bindings.getValue("p"));
            logger.info("object:{}", bindings.getValue("o"));
        }

        // clear all triples
        conn.clear();
        logger.info("number of triples: {}", conn.size());

        // close connection and shutdown repository
        conn.close();
        repo.shutDown();

        System.exit(0);
    }
 
开发者ID:marklogic,项目名称:marklogic-rdf4j,代码行数:57,代码来源:Example1_Simple.java


示例14: testWriteAndFind

import org.eclipse.rdf4j.model.vocabulary.FOAF; //导入依赖的package包/类
@Test
public void testWriteAndFind() throws Exception {
    Repository repo = new SailRepository(new MemoryStore());
    repo.initialize();

    try (RepositoryConnection connection = repo.getConnection()) {

        ValueFactory vf = SimpleValueFactory.getInstance();

        String ex = "http://example.org/";

        IRI lilie = vf.createIRI(ex, "Lilie");

        connection.add(lilie, FOAF.NAME, vf.createLiteral("Lilie"));
        connection.add(lilie, FOAF.MBOX, vf.createIRI("mailto:[email protected]"));
        connection.add(lilie, FOAF.KNOWS, vf.createIRI(ex, "Bob"));

        boolean hasStatement = connection.hasStatement(vf.createIRI(ex, "Lilie"), null, null, false);
        assertTrue(hasStatement);

        RepositoryResult<Statement> statements = connection.getStatements(vf.createIRI(ex, "Lilie"), FOAF.NAME, null);

        assertEquals("Lilie", statements.next().getObject().stringValue());
    }

}
 
开发者ID:bpark,项目名称:chlorophytum-semantics,代码行数:27,代码来源:RdfStoreTest.java


示例15: asAgent

import org.eclipse.rdf4j.model.vocabulary.FOAF; //导入依赖的package包/类
/**
 * Creates an RMapAgent object from a list of statements - must include statements for 1 name, 1 id provider, 1 user auth id.
 *
 * @param stmts the set of statements that describe the RMapAgent
 * @throws RMapException the RMap exception
 * @throws RMapDefectiveArgumentException the RMap defective argument exception
 */
public static ORMapAgent asAgent(Set<Statement> stmts, Supplier<URI> idSupplier) throws RMapException,
        RMapDefectiveArgumentException {

    if (stmts == null) {
        throw new RMapDefectiveArgumentException(NULL_STATEMENTS);
    }

    Identifiers identifiers = identifiers(stmts, RMAP.AGENT).orElseThrow(() ->
            new RMapDefectiveArgumentException(MISSING_RDF_TYPE));

    if (identifiers.assertedId == null || identifiers.assertedId.stringValue().trim().length() == 0) {
        throw new RMapException(MISSING_AGENT_IRI);
    }

    if (identifiers.officalId == null || identifiers.officalId.stringValue().trim().length() == 0) {
        //if disco has come in without a context, generate ID. This will happen if it's a new disco
        identifiers.officalId = ORAdapter.uri2Rdf4jIri(idSupplier.get());
    }

    ORMapAgent agent = new ORMapAgent((IRI)identifiers.officalId);

    //loop through and check we have all vital components for Agent.
    boolean typeRecorded = false;
    boolean nameRecorded = false;
    boolean idProviderRecorded = false;
    boolean authIdRecorded = false;

    for (Statement stmt : stmts) {
        Resource subject = stmt.getSubject();
        IRI predicate = stmt.getPredicate();
        Value object = stmt.getObject();

        LOG.debug("Processing Agent statement: {} - {} - {}", subject, predicate, object);
        
        boolean agentIsSubject = subject.stringValue().equals(identifiers.assertedId.stringValue());
        if (agentIsSubject && predicate.equals(RDF.TYPE) && object.equals(RMAP.AGENT) && !typeRecorded) {
            agent.setTypeStatement(RMapObjectType.AGENT);
            typeRecorded = true;
        } else if (agentIsSubject && predicate.equals(FOAF.NAME) && !nameRecorded) {
            agent.setNameStmt(object);
            nameRecorded = true;
        } else if (agentIsSubject && predicate.equals(RMAP.IDENTITYPROVIDER) && !idProviderRecorded) {
            agent.setIdProviderStmt((IRI) object);
            idProviderRecorded = true;
        } else if (agentIsSubject && predicate.equals(RMAP.USERAUTHID) && !authIdRecorded) {
            agent.setAuthIdStmt((IRI) object);
            authIdRecorded = true;
        } else { //there is an invalid statement in there
            throw new RMapException("Invalid statement found in RMap:Agent object: (" + subject + ", " + predicate + ", " + object + "). "
                    + "Agents should contain 1 rdf:type definition, 1 foaf:name, 1 rmap:idProvider, and 1 rmap:userAuthId.");
        }
    }
    if (!typeRecorded) { //should have already been caught but JIC.
        throw new RMapException("The foaf:name statement is missing from the Agent");
    }
    if (!nameRecorded) {
        throw new RMapException("The foaf:name statement is missing from the Agent");
    }
    if (!idProviderRecorded) {
        throw new RMapException("The rmap:idProvider statement is missing from the Agent");
    }
    if (!authIdRecorded) {
        throw new RMapException("The rmap:userAuthId statement is missing from the Agent");
    }

    return agent;
}
 
开发者ID:rmap-project,项目名称:rmap,代码行数:75,代码来源:OStatementsAdapter.java


示例16: export

import org.eclipse.rdf4j.model.vocabulary.FOAF; //导入依赖的package包/类
public static void export(final Connection connection, final Path path)
        throws SQLException, IOException, RDFHandlerException {

    final Map<Long, String> screenNames = loadScreenNames(connection, path);

    connection.setAutoCommit(false);

    final ValueFactory vf = SimpleValueFactory.getInstance();

    try (Writer writer = new OutputStreamWriter(
            new GZIPOutputStream(new FileOutputStream(path.toFile())), Charsets.UTF_8)) {

        final RDFWriter out = Rio.createWriter(RDFFormat.NTRIPLES, writer);
        out.startRDF();

        int counter = 0;
        try (PreparedStatement stmt = connection.prepareStatement("" //
                + "SELECT resource_id, uid, score, is_alignment\n" //
                + "FROM alignments\n" //
                + "WHERE version=2\n" //
                + "ORDER BY resource_id ASC, score DESC")) {
            stmt.setFetchSize(1000);
            try (ResultSet rs = stmt.executeQuery()) {
                IRI lastEntity = null;
                int rank = 1;
                while (rs.next()) {
                    final long uid = rs.getLong("uid");
                    final String screenName = screenNames.get(uid);
                    Preconditions.checkState(screenName != null);
                    final IRI entity = vf.createIRI(rs.getString("resource_id"));
                    final IRI account = vf.createIRI(
                            "http://twitter.com/" + screenName.replaceAll("\\s", "+"));
                    final BNode candidate = vf.createBNode();
                    final float score = rs.getFloat("score");
                    final boolean align = rs.getBoolean("is_alignment");
                    rank = entity.equals(lastEntity) ? rank + 1 : 1;
                    lastEntity = entity;
                    LOGGER.debug("Processing candidate {} {} {} {}", entity, candidate, score,
                            align);
                    if (align) {
                        emit(out, entity, FOAF.ACCOUNT, account);
                    }
                    emit(out, entity, OWL.SAMEAS, entity);
                    emit(out, entity, SL.CANDIDATE_PROPERTY, candidate);
                    emit(out, candidate, SL.RANK, vf.createLiteral(rank));
                    emit(out, candidate, SL.CONFIDENCE, vf.createLiteral(score));
                    emit(out, candidate, SL.ACCOUNT, account);
                    emit(out, account, DCTERMS.IDENTIFIER, vf.createLiteral(uid));
                    emit(out, account, FOAF.ACCOUNT_NAME, vf.createLiteral(screenName));
                    if (++counter % 10000 == 0) {
                        LOGGER.info("{} candidates processed", counter);
                    }
                }
            }
        }

        out.endRDF();
    }
}
 
开发者ID:Remper,项目名称:sociallink,代码行数:60,代码来源:RDFExporter.java


示例17: storeDefaultFDPMetadata

import org.eclipse.rdf4j.model.vocabulary.FOAF; //导入依赖的package包/类
/**
 * Create and store generic FDP metadata
 *
 * @param request HttpServletRequest
 * @throws MetadataParserException
 */
private void storeDefaultFDPMetadata(HttpServletRequest request)
        throws MetadataParserException {
    LOGGER.info("Creating generic FDP metadata");
    try {
        String fdpUrl = getRequesedURL(request);
        String host = new URL(fdpUrl).getAuthority();
        FDPMetadata metadata = new FDPMetadata();
        metadata.setUri(valueFactory.createIRI(fdpUrl));
        metadata.setTitle(valueFactory.createLiteral(("FDP of " + host),
                XMLSchema.STRING));
        metadata.setDescription(valueFactory.createLiteral(
                ("FDP of " + host), XMLSchema.STRING));
        metadata.setLanguage(valueFactory.createIRI(
                "http://id.loc.gov/vocabulary/iso639-1/en"));
        metadata.setLicense(valueFactory.createIRI(
                "http://rdflicense.appspot.com/rdflicense/cc-by-nc-nd3.0"));
        metadata.setVersion(valueFactory.createLiteral(
                "1.0", XMLSchema.FLOAT));
        metadata.setSwaggerDoc(valueFactory.createIRI(
                fdpUrl + "/swagger-ui.html"));
        metadata.setInstitutionCountry(valueFactory.createIRI(
                "http://lexvo.org/id/iso3166/NL"));
        Identifier id = new Identifier();
        id.setUri(valueFactory.createIRI(fdpUrl + "/metadataID"));
        id.setIdentifier(valueFactory.createLiteral("fdp-metadataID",
                XMLSchema.STRING));
        id.setType(DataCite.RESOURCE_IDENTIFIER);
        metadata.setIdentifier(id);
        Agent publisher = new Agent();
        publisher.setUri(valueFactory.createIRI("http://dtls.nl"));
        publisher.setType(FOAF.ORGANIZATION);
        publisher.setName(valueFactory.createLiteral("DTLS",
                XMLSchema.STRING));
        metadata.setPublisher(publisher);
        metadata.setInstitution(publisher);
        Identifier repoId = new Identifier();
        repoId.setUri(valueFactory.createIRI(fdpUrl + "/repoID"));
        repoId.setIdentifier(valueFactory.createLiteral("fdp-repoID",
                XMLSchema.STRING));
        repoId.setType(DataCite.RESOURCE_IDENTIFIER);
        metadata.setRepostoryIdentifier(repoId);
        fairMetaDataService.storeFDPMetaData(metadata);
        isFDPMetaDataAvailable = true;
    } catch (MalformedURLException | MetadataException |
            FairMetadataServiceException ex) {
        throw new MetadataParserException(
                "Error creating generic FDP meatdata " + ex.getMessage());
    }

}
 
开发者ID:DTL-FAIRData,项目名称:FAIRDataPoint,代码行数:57,代码来源:MetadataController.java


示例18: main

import org.eclipse.rdf4j.model.vocabulary.FOAF; //导入依赖的package包/类
/**
   * Main program
   * 
   * @param args 
   */
  public static void main(String[] args) {
      logger.info("-- START --");
      if (args.length < 2) {
          logger.error("No input or output file");
          System.exit(-1);
      }
      
      Optional<RDFFormat> fmtin = Rio.getParserFormatForFileName(args[0]);
      if(!fmtin.isPresent()) {
          logger.error("No parser for input {}", args[0]);
          System.exit(-2);
      }
      
      Optional<RDFFormat> fmtout = Rio.getWriterFormatForFileName(args[1]);
      if(!fmtout.isPresent()) {
          logger.error("No parser for output {}", args[1]);
          System.exit(-3);            
      }
      
      int code = 0;
      Repository repo = new SailRepository(new MemoryStore());
repo.initialize();
      
      try (RepositoryConnection con = repo.getConnection()) {
          con.add(new File(args[0]), "http://data.gov.be", fmtin.get());
	// Various namespace prefixes
          con.setNamespace(DCAT.PREFIX, DCAT.NAMESPACE);
	con.setNamespace(DCTERMS.PREFIX, DCTERMS.NAMESPACE);
	con.setNamespace(FOAF.PREFIX, FOAF.NAMESPACE);
	con.setNamespace("vcard", "http://www.w3.org/2006/vcard/ns#");
	con.setNamespace("locn", "http://www.w3.org/ns/locn#");

	FileOutputStream fout = new FileOutputStream(new File(args[1]));
	
	RDFWriter writer;
	if (fmtout.get().equals(RDFFormat.RDFXML)) {
		writer = new RDFXMLPrettyWriterFactory().getWriter(fout);
	} else {
		writer = Rio.createWriter(fmtout.get(), fout);
	}

	logger.info("Using writer {}", writer.getClass().getCanonicalName());
	
          con.export(writer);
      } catch (IOException ex) {
          logger.error("Error converting", ex);
          code = -1;
      }
      
      repo.shutDown();
      
      System.exit(code);
  }
 
开发者ID:Fedict,项目名称:dcattools,代码行数:59,代码来源:Converter.java


示例19: generateOrg

import org.eclipse.rdf4j.model.vocabulary.FOAF; //导入依赖的package包/类
/**
 * Add organization / publisher
 *
 * @param store
 * @param dataset
 * @param s
 * @throws MalformedURLException
 * @throws RepositoryException
 */
private void generateOrg(Storage store, IRI dataset, Map<String, String> map)
		throws MalformedURLException, RepositoryException {
	String s = map.getOrDefault(XlsPsiBelgium.ORGID, "");
	IRI org = store.getURI(makeOrgURL(stringInt(s)).toString());
	store.add(dataset, DCTERMS.PUBLISHER, org);
	store.add(org, RDF.TYPE, FOAF.ORGANIZATION);
}
 
开发者ID:Fedict,项目名称:dcattools,代码行数:17,代码来源:XlsPsiBelgium.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java DefaultImpersonationProvider类代码示例发布时间:2022-05-23
下一篇:
Java JSONObject类代码示例发布时间: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