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

Java MGraph类代码示例

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

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



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

示例1: triplesTest

import org.apache.clerezza.rdf.core.MGraph; //导入依赖的package包/类
@Test
public void triplesTest() throws IOException, JsonLdError {
    final InputStream in = getClass().getClassLoader().getResourceAsStream(
            "testfiles/product.jsonld");
    final Object input = JsonUtils.fromInputStream(in);

    final ClerezzaTripleCallback callback = new ClerezzaTripleCallback();

    final MGraph graph = (MGraph) JsonLdProcessor.toRDF(input, callback);

    for (final Triple t : graph) {
        System.out.println(t);
    }
    assertEquals("Graph size", 13, graph.size());

}
 
开发者ID:jsonld-java,项目名称:jsonld-java-clerezza,代码行数:17,代码来源:ClerezzaTripleCallbackTest.java


示例2: curiesInContextTest

import org.apache.clerezza.rdf.core.MGraph; //导入依赖的package包/类
@Test
public void curiesInContextTest() throws IOException, JsonLdError {
    final InputStream in = getClass().getClassLoader().getResourceAsStream(
            "testfiles/curies-in-context.jsonld");
    final Object input = JsonUtils.fromInputStream(in);

    final ClerezzaTripleCallback callback = new ClerezzaTripleCallback();

    final MGraph graph = (MGraph) JsonLdProcessor.toRDF(input, callback);

    for (final Triple t : graph) {
        System.out.println(t);
        assertTrue("Predicate got fully expanded", t.getPredicate().getUnicodeString()
                .startsWith("http"));
    }
    assertEquals("Graph size", 3, graph.size());

}
 
开发者ID:jsonld-java,项目名称:jsonld-java-clerezza,代码行数:19,代码来源:ClerezzaTripleCallbackTest.java


示例3: init

import org.apache.clerezza.rdf.core.MGraph; //导入依赖的package包/类
@BeforeClass
public static void init(){
    LiteralFactory lf = LiteralFactory.getInstance();
    UriRef pers1 = new UriRef("http://www.example.org/test#pers1");
    UriRef pers2 = new UriRef("http://www.example.org/test#pers2");
    MGraph data = new SimpleMGraph();
    //NOTE: This test a language literal with and without language as
    //      well as a xsd:string typed literal. To test correct handling of
    //      RDF1.1
    data.add(new TripleImpl(pers1, RDF.type, FOAF.Person));
    data.add(new TripleImpl(pers1, FOAF.name, new PlainLiteralImpl("Rupert Westenthaler",
            new Language("de"))));
    data.add(new TripleImpl(pers1, FOAF.nick, new PlainLiteralImpl("westei")));
    data.add(new TripleImpl(pers1, FOAF.mbox, lf.createTypedLiteral("[email protected]")));
    data.add(new TripleImpl(pers1, FOAF.age, lf.createTypedLiteral(38)));
    data.add(new TripleImpl(pers1, FOAF.knows, pers2));
    data.add(new TripleImpl(pers2, FOAF.name, new PlainLiteralImpl("Reto Bachmann-Gmür")));
    rdfData = data.getGraph();
}
 
开发者ID:jsonld-java,项目名称:jsonld-java-clerezza,代码行数:20,代码来源:ClerezzaJsonLdParserSerializerTest.java


示例4: cleanFiseEnhancement

import org.apache.clerezza.rdf.core.MGraph; //导入依赖的package包/类
/**
    * Cleans triples in the metadata of the {@link ContentItem} of 
    * the transformed <code>fise:Enhancement</code>
    * @param anno the annotation to clean.
    */
private void cleanFiseEnhancement(Annotation anno) {
	MGraph metadata = anno.ctx.ci.getMetadata();
   	//delete outgoing (incl. bNodes)
	List<NonLiteral> nodes = new ArrayList<NonLiteral>();
	nodes.add(anno.enh);
	while(!nodes.isEmpty()){
    	Iterator<Triple> outgoing = metadata.filter(
    			nodes.remove(nodes.size()-1), null, null);
		while(outgoing.hasNext()){
			Triple t = outgoing.next();
			if(t.getObject() instanceof BNode){
				nodes.add((BNode)t.getObject());
			}
			outgoing.remove();
		}
	}
}
 
开发者ID:fusepoolP3,项目名称:p3-stanbol-engine-fam,代码行数:23,代码来源:Fise2FamEngine.java


示例5: graphToJson

import org.apache.clerezza.rdf.core.MGraph; //导入依赖的package包/类
private JSONArray graphToJson(MGraph graph) throws JSONException{
	//JSONObject json = new JSONObject();
	JSONArray json = new JSONArray();
	
	//create the first 0 element "non assigné"
	json.put(getBudgetLineObject("0", "Non assigné", 0));
	
	//TODO : use ldpath for building this ones
	
	//1) get all budget lines
	Iterator<Triple> budgetLinesId = graph.filter(null, RDF.type,Onthology.budgetLineType.getUri());
	while(budgetLinesId.hasNext()){
		Triple budgetId = budgetLinesId.next();
		
		//getthe label
		Resource label = graph.filter(budgetId.getSubject(), SKOS.prefLabel, null).next().getObject();
		
		//get the value
		Triple valueId = graph.filter(null, Onthology.forBudgetLine.getUri(), budgetId.getSubject()).next();
		Resource percentage = graph.filter(valueId.getSubject(), Onthology.percentage.getUri(), null).next().getObject();
		
		json.put(getBudgetLineObject(budgetId.getSubject().toString(), ((Literal)label).getLexicalForm(), Double.parseDouble(((Literal)percentage).getLexicalForm())));
		
	}
	return json;
}
 
开发者ID:florent-andre,项目名称:CleverTaxes,代码行数:27,代码来源:SkosifierRootResource.java


示例6: createBudgetLine

import org.apache.clerezza.rdf.core.MGraph; //导入依赖的package包/类
/**
 * Return the budget line Object id and populate trpList with created triples
 * @param trpList
 * @param name
 * @param childrens
 * @return
 */
private UriRef createBudgetLine(MGraph trpList,String name, List<String> childrens){
	UriRef budgetLineRoot = Entities.generateNewEntity();
	
	//creation du nom
	//TODO : real language aware object creation
	trpList.add(new TripleImpl(budgetLineRoot, SKOS.prefLabel, lf.createTypedLiteral(name)));
	//add type of object
	trpList.add(new TripleImpl(budgetLineRoot, RDF.type, Onthology.budgetLineType.getUri()));
	
	//create childrens for each parent
	for(String child : childrens){
		UriRef childBudgetLine = createBudgetLine(trpList, child, Collections.<String> emptyList());
		trpList.add(new TripleImpl(budgetLineRoot, Onthology.hasBudgetLine.getUri(), childBudgetLine));
	}
	return budgetLineRoot;
}
 
开发者ID:florent-andre,项目名称:CleverTaxes,代码行数:24,代码来源:SkosifierRootResource.java


示例7: getSkosOnto

import org.apache.clerezza.rdf.core.MGraph; //导入依赖的package包/类
@Deprecated //"use the model endpoint instead
@Path("/skosontology/all")
@GET
@Consumes(WILDCARD)
@Produces(RDF_XML)
//TODO : change query parameter name from skos to \"model"
//TODO : change endpoint from skosontology to ontologiesmodel
//TODO : remove the \"/all" and remove the /skosontology model
//TODO : without model parameter, this endpoint provide the list of available ontologies
//TODO : remove the skos_ prefix in the file name as it not really mean something
public Response getSkosOnto(@QueryParam(value = "skos") String modelName, @Context HttpHeaders headers) throws JSONException {
	log.warn("This endpoint is deprecated, use the model endpoint instead");
	UriRef soURI = new UriRef("urn:x-onto-utils:skosOntology" + modelName);
	MGraph g;
	Set<UriRef> l = tcManager.listMGraphs();
	if(l.contains(soURI)){
		g = tcManager.getMGraph(soURI);
	}
	else{
		//initialisation, loading of the graph
		g = tcManager.createMGraph(soURI);
		g.addAll(parser.parse(this.getClass().getResourceAsStream("/skos_"+modelName+".rdf"), "Application/rdf+xml"));
	}
	return okMGraphResponse(headers, g);
}
 
开发者ID:florent-andre,项目名称:CleverTaxes,代码行数:26,代码来源:SkosifierRootResource.java


示例8: writeEntityInformation

import org.apache.clerezza.rdf.core.MGraph; //导入依赖的package包/类
private void writeEntityInformation(MGraph writer, Keyword keyword, UriRef entity, Language lang) {
        //The rdfs:label
        writer.add(new TripleImpl(entity, RDFS_LABEL, 
                new PlainLiteralImpl(keyword.getForm(), lang)));
        //the rdf:type
        for(Clazz type : keyword.getClasses()){
            writer.add(new TripleImpl(entity, RDF_TYPE, new UriRef(type.getUrl().toString())));
            UriRef dbpediaType = createDbpediaTypeUri(type);
            if(dbpediaType != null){
                writer.add(new TripleImpl(entity, RDF_TYPE, dbpediaType));
            }
        }
        if(keyword.getAbstract() != null){
            writer.add(new TripleImpl(entity, RDFS_COMMENT, 
                new PlainLiteralImpl(keyword.getAbstract(),lang)));
        }
        if(keyword.getImages() != null && keyword.getImages().length > 0){
            Image image = keyword.getImages()[0];
//            for(Image image : keyword.getImages()){
            writer.add(new TripleImpl(entity, FOAF_DEPICTION, new UriRef(image.getImage().toString())));
            writer.add(new TripleImpl(entity, FOAF_THUMBNAIL, new UriRef(image.getThumb().toString())));
//            }
        }
    }
 
开发者ID:michelemostarda,项目名称:machinelinking-stanbol-enhancement-engine,代码行数:25,代码来源:MLAnnotateEnhancementEngine.java


示例9: uploadRdf

import org.apache.clerezza.rdf.core.MGraph; //导入依赖的package包/类
/**
 * Load RDF data sent by HTTP POST. Use the Dataset custom header
 * to address the dataset in which to store the rdf data.
 * Use this service with the following curl command:
 *  curl -X POST -u admin: -H "Content-Type: application/rdf+xml" 
 *  	-H "Dataset: mydataset" -T <rdf_file> http://localhost:8080/dlcupload/rdf 
 */
@POST
@Path("rdf")
@Produces("text/plain")
public String uploadRdf(@Context final UriInfo uriInfo,  
		@HeaderParam("Content-Type") String mediaType,
		@HeaderParam("Dataset") String dataset,
        final InputStream stream) throws Exception {
	
    AccessController.checkPermission(new AllPermission());
    final MGraph graph = new SimpleMGraph();
    
    String message = "";
   
    if(mediaType.equals(SupportedFormat.RDF_XML)) {
    	parser.parse(graph, stream, SupportedFormat.RDF_XML);
    }
    else {
    	message = "Add header Content-Type: application/rdf+xml ";
    }
    
    return message + "Added " + graph.size() + " triples  to dataset " + dataset + "\n";
}
 
开发者ID:fusepool,项目名称:datalifecycle,代码行数:30,代码来源:DlcUploader.java


示例10: addTriples

import org.apache.clerezza.rdf.core.MGraph; //导入依赖的package包/类
/**
 * Load RDF data into an existing graph from a URL (schemes: "file://" or
 * "http://"). The arguments to be passed are: 1) graph in which the RDF
 * data must be stored 2) url of the dataset After the upload the input
 * graph is sent to a digester to extract text for indexing and adding
 * entities found by NLP components (in the default chain) as subject
 *
 * @return the added triples
 */
private MGraph addTriples(DataSet dataSet, URL dataUrl, PrintWriter messageWriter) throws IOException {
    AccessController.checkPermission(new AllPermission());

    // add the triples of the temporary graph into the graph selected by the user
    if (isValidUrl(dataUrl)) {

        MGraph updatedGraph = addTriplesCommand(dataSet.getSourceGraph(), dataUrl);

        messageWriter.println("Added " + updatedGraph.size() + " triples from " + dataUrl + " to " + dataSet.getSourceGraphRef().getUnicodeString());
        return updatedGraph;

    } else {
        messageWriter.println("The URL of the data is not a valid one.");
        throw new RuntimeException("Invalid URL; " + dataUrl);
    }

}
 
开发者ID:fusepool,项目名称:datalifecycle,代码行数:27,代码来源:SourcingAdmin.java


示例11: addTriplesCommand

import org.apache.clerezza.rdf.core.MGraph; //导入依赖的package包/类
/**
 *
 * Add triples to graph
 */
private MGraph addTriplesCommand(LockableMGraph targetGraph, URL dataUrl) throws IOException {
    AccessController.checkPermission(new AllPermission());

    URLConnection connection = dataUrl.openConnection();
    connection.addRequestProperty("Accept", "application/rdf+xml; q=.9, text/turte;q=1");

    // create a temporary graph to store the data        
    SimpleMGraph tempGraph = new SimpleMGraph();
    String mediaType = connection.getHeaderField("Content-type");
    if ((mediaType == null) || mediaType.equals("application/octet-stream")) {
        mediaType = guessContentTypeFromUri(dataUrl);
    }
    InputStream data = connection.getInputStream();
    if (data != null) {
        parser.parse(tempGraph, data, mediaType);
        targetGraph.addAll(tempGraph);
    }
    return tempGraph;
}
 
开发者ID:fusepool,项目名称:datalifecycle,代码行数:24,代码来源:SourcingAdmin.java


示例12: extractTextFromRdf

import org.apache.clerezza.rdf.core.MGraph; //导入依赖的package包/类
/**
 * Extract text from dcterms:title and dcterms:abstract fields in the source
 * graph and adds a sioc:content property with that text in the enhance
 * graph. The text is used by the ECS for indexing. The keywords will be
 * related to the resource so that it could be retrieved.
 *
 * @return
 */
private void extractTextFromRdf(DataSet dataSet, String selectedDigester, PrintWriter messageWriter) {
    RdfDigester digester = digesters.get(selectedDigester);
    MGraph tempGraph = new IndexedMGraph();
    LockableMGraph sourceGraph = dataSet.getSourceGraph();
    Lock rl = sourceGraph.getLock().readLock();
    rl.lock();
    try {
        tempGraph.addAll(sourceGraph);
    } finally {
        rl.unlock();
    }

    digester.extractText(tempGraph);
    tempGraph.removeAll(sourceGraph);
    dataSet.getDigestGraph().addAll(tempGraph);
    messageWriter.println("Extracted text from " + dataSet.getDigestGraphRef().getUnicodeString() + " by " + selectedDigester + " digester");

}
 
开发者ID:fusepool,项目名称:datalifecycle,代码行数:27,代码来源:SourcingAdmin.java


示例13: TransformationContext

import org.apache.clerezza.rdf.core.MGraph; //导入依赖的package包/类
TransformationContext(ContentItem ci, MGraph target){
	if(ci == null){
		throw new IllegalArgumentException("The parsed ContentItem MUST NOT be NULL!");
	}
	this.ci = ci;
	this.src = ci.getMetadata();
	this.tar = target == null ? new SimpleMGraph() : target;
}
 
开发者ID:fusepoolP3,项目名称:p3-stanbol-engine-fam,代码行数:9,代码来源:TransformationContext.java


示例14: read

import org.apache.clerezza.rdf.core.MGraph; //导入依赖的package包/类
public Map<String,Collection<Object>> read(Exchange exchange) throws IOException, LDPathParseException, InvalidPayloadException {
    final String contentType = exchange.getIn().getHeader(Exchange.CONTENT_TYPE, String.class);
    final String subject = exchange.getIn().getHeader(LDPATH_CONTEXT, String.class);
    final ParsingProvider parser = new JenaParserProvider();
    final MGraph graph = new SimpleMGraph();

    if (isBlank(contentType)) {
        throw new IOException("Empty or missing Content-Type header identifying the RDF format");
    }

    if (isBlank(subject)) {
        throw new IOException("Empty or missing LDPATH_CONTEXT header, identifying the context for the LDPath program");
    }

    parser.parse(graph, getBodyAsInputStream(exchange),
            "application/n-triples".equals(contentType) ? "text/rdf+nt" : contentType, null);

    final UriRef context = new UriRef(subject);
    final ClerezzaBackend backend = new ClerezzaBackend(graph);
    final LDPath<Resource> ldpath = new LDPath<Resource>(backend);
    final Map<String, Collection<?>> results = ldpath.programQuery(context, query);
    final Map<String, Collection<Object>> transformed = transformLdpathOutput(results);

    Map<String, Collection<Object>> ldTransform = new HashMap<>();
    for (Map.Entry<String, Collection<Object>> entry : transformed.entrySet()) {
        if (entry.getValue().size() > 0) {
            ldTransform.put(entry.getKey(), entry.getValue());
        }
    }

    if (ldTransform.size() > 0) {
        return ldTransform;
    } else {
        return null;
    }
}
 
开发者ID:acoburn,项目名称:camel-ldpath,代码行数:37,代码来源:LDPathEngine.java


示例15: getGraph

import org.apache.clerezza.rdf.core.MGraph; //导入依赖的package包/类
@GET
@Consumes(WILDCARD)
public Response getGraph(@QueryParam(value = "name") String name,
                                @Context HttpHeaders headers) throws JSONException{
	MGraph graph;
	try{
		graph = tcManager.getMGraph(uriBuilder(name));
	}catch(NoSuchEntityException e){
		log.warn("implementation new graph création");
		graph = tcManager.createMGraph(uriBuilder(name));
	}
	
	JSONObject jo = new JSONObject();
	if(name.equals("demo")){
		graph.clear();
		generateDemoData(graph,Entities.generateNewEntity(name.concat("-")));
	}
	
	
	log.warn("TODO :: create the object from data if any contained");
	
	//ResponseBuilder rb = Response.ok(jo.toString());
	//ResponseBuilder rb = Response.ok(graph);
	ResponseBuilder rb = Response.ok(graphToJson(graph).toString());
    enableCORS(servletContext,rb, headers);
    return rb.build();
}
 
开发者ID:florent-andre,项目名称:CleverTaxes,代码行数:28,代码来源:SkosifierRootResource.java


示例16: generateDemoData

import org.apache.clerezza.rdf.core.MGraph; //导入依赖的package包/类
private void generateDemoData(MGraph graph, UriRef rootUri) {
   	
	generateTemplate(graph,rootUri);
	
   	String cityName = "demoCity";
   	
   	//TODO : create a real literal with a lang (cf importer in xplor)
   	graph.add(new TripleImpl(rootUri, SKOS.prefLabel, lf.createTypedLiteral(cityName) ));
   	
   	//create a fake budget plan
   	String userName = "fakeUser";
   	
   	UriRef rootFakeBudget = Entities.generateNewEntity();
   	graph.add(new TripleImpl(rootFakeBudget, RDF.type, Onthology.budgetPlanType.getUri()));
   	//TODO : create a real language object
   	graph.add(new TripleImpl(rootFakeBudget, Onthology.fromUser.getUri(), lf.createTypedLiteral(userName)));
   	
   	Random r = new Random();
   	
   	//get all "lines" of the budget
   	// TODO : get to 100% with random generation int maxPercentage = 100;
   	Iterator<Triple> lines = graph.filter(null, RDF.type, Onthology.budgetLineType.getUri());
   	List<Triple> trps = new ArrayList<Triple>();
   	while(lines.hasNext()){
   		Triple line = lines.next();
   		UriRef valueId = Entities.generateNewEntity();
   		
   		trps.add(new TripleImpl(valueId, RDF.type, Onthology.budgetPlanValueType.getUri()));
   		trps.add(new TripleImpl(valueId, Onthology.forBudgetLine.getUri(), line.getSubject()));
   		double amount = r.nextDouble() * (10 + r.nextDouble());
   		trps.add(new TripleImpl(valueId, Onthology.percentage.getUri(), lf.createTypedLiteral(r.nextDouble())));
   		
   		trps.add(new TripleImpl(rootFakeBudget, Onthology.hasBudgetPlanValue.getUri(), valueId));
   	}
   	
   	graph.addAll(trps);
}
 
开发者ID:florent-andre,项目名称:CleverTaxes,代码行数:38,代码来源:SkosifierRootResource.java


示例17: getNode

import org.apache.clerezza.rdf.core.MGraph; //导入依赖的package包/类
GraphNode getNode() {
    MGraph base = new IndexedMGraph();
    GraphNode result = new GraphNode(uriRef, base);
    result.addPropertyValue(DCTERMS.dateSubmitted, dateSubmitted);
    if (startDate != null) {
        result.addPropertyValue(DCTERMS.dateAccepted, startDate);
    }
    if (endDate != null) {
        result.addPropertyValue(DLC.endDate, endDate);
    }
    result.addPropertyValue(RDFS.comment, messageStringWriter.toString());
    return result;
}
 
开发者ID:fusepool,项目名称:datalifecycle,代码行数:14,代码来源:Task.java


示例18: serviceEntry

import org.apache.clerezza.rdf.core.MGraph; //导入依赖的package包/类
/**
 * This method return an RdfViewable, this is an RDF serviceUri with
 * associated presentational information.
 */
@GET
public RdfViewable serviceEntry(@Context final UriInfo uriInfo,
        @QueryParam("url") final UriRef url,
        @HeaderParam("user-agent") String userAgent) throws Exception {
    //this maks sure we are nt invoked with a trailing slash which would affect
    //relative resolution of links (e.g. css)
    TrailingSlash.enforcePresent(uriInfo);

    final String resourcePath = uriInfo.getAbsolutePath().toString();
    if (url != null) {
        String query = url.toString();
        log.info(query);
    }

    //The URI at which this service was accessed, this will be the 
    //central serviceUri in the response
    final UriRef serviceUri = new UriRef(resourcePath);
    
    //the in memory graph to which the triples for the response are added
    final MGraph responseGraph = new IndexedMGraph();
    Lock rl = getDlcGraph().getLock().readLock();
    rl.lock();
    try {
        responseGraph.addAll(getDlcGraph());
        //Add the size info of the graphs of all the datasets
        addGraphsSize(responseGraph);
    } finally {
        rl.unlock();
    }
    
    //This GraphNode represents the service within our result graph
    final GraphNode node = new GraphNode(serviceUri, responseGraph);
    node.addProperty(DLC.graph, DlcGraphProvider.DATA_LIFECYCLE_GRAPH_REFERENCE);
    
    //What we return is the GraphNode to the template with the same path and name 
    return new RdfViewable("PipesAdmin", node, PipesAdmin.class);
}
 
开发者ID:fusepool,项目名称:datalifecycle,代码行数:42,代码来源:PipesAdmin.java


示例19: addGraphsSize

import org.apache.clerezza.rdf.core.MGraph; //导入依赖的package包/类
/**
 * Add the size of the graphs within each dataset/pipe to the rdf data for visualization
 */
private void addGraphsSize(MGraph responseGraph){
    
    Iterator<Triple> datasets = getDlcGraph().filter(DlcGraphProvider.DATA_LIFECYCLE_GRAPH_REFERENCE, DLC.pipe, null);        
    while(datasets.hasNext()){
        final UriRef datasetRef = (UriRef) datasets.next().getObject();
        final DataSet dataSet = dataSetFactory.getDataSet(datasetRef);
        // add source graph size
        int sourceGraphSize = dataSet.getSourceGraph().size();
        responseGraph.add(new TripleImpl(dataSet.getSourceGraphRef(), DLC.size, new PlainLiteralImpl(Integer.toString(sourceGraphSize))));
        // add digest graph size
        int digestGraphSize = dataSet.getDigestGraph().size();
        responseGraph.add(new TripleImpl(dataSet.getDigestGraphRef(), DLC.size, new PlainLiteralImpl(Integer.toString(digestGraphSize))));
        // add enhance graph size
        int enhanceGraphSize = dataSet.getEnhancementsGraph().size();
        responseGraph.add(new TripleImpl(dataSet.getEnhancementsGraphRef(), DLC.size, new PlainLiteralImpl(Integer.toString(enhanceGraphSize))));
        // add interlink graph size
        int interlinkGraphSize = dataSet.getInterlinksGraph().size();
        responseGraph.add(new TripleImpl(dataSet.getInterlinksGraphRef(), DLC.size, new PlainLiteralImpl(Integer.toString(interlinkGraphSize))));
        // add smush graph size
        int smushGraphSize = dataSet.getSmushGraph().size();
        responseGraph.add(new TripleImpl(dataSet.getSmushGraphRef(), DLC.size, new PlainLiteralImpl(Integer.toString(smushGraphSize))));
        // add publish graph size
        int publishGraphSize = dataSet.getPublishGraph().size();
        responseGraph.add(new TripleImpl(dataSet.getPublishGraphRef(), DLC.size, new PlainLiteralImpl(Integer.toString(publishGraphSize))));
        
    }
    
    
}
 
开发者ID:fusepool,项目名称:datalifecycle,代码行数:33,代码来源:PipesAdmin.java


示例20: deletePipe

import org.apache.clerezza.rdf.core.MGraph; //导入依赖的package包/类
/**
 * Deletes all the graphs created with the pipe: rdf.graph, enhance.graph, interlink.graph, smush.graph, publish.graph.
 * Removes from the DLC meta graph all the pipe metadata.
 * @param uriInfo
 * @param dataSetUri
 * @return
 * @throws Exception
 */
@POST
@Path("delete_pipe")
@Produces("text/plain")
public Response deletePipe(@Context final UriInfo uriInfo,  
		@FormParam("pipe") final UriRef dataSetUri) throws Exception {
    AccessController.checkPermission(new AllPermission());
    String message = "";
    
    final DataSet dataSet = dataSetFactory.getDataSet(dataSetUri);
    // remove graphs
    tcManager.deleteTripleCollection(dataSet.getSourceGraphRef());
    tcManager.deleteTripleCollection(dataSet.getDigestGraphRef());
    tcManager.deleteTripleCollection(dataSet.getEnhancementsGraphRef());
    tcManager.deleteTripleCollection(dataSet.getInterlinksGraphRef());
    tcManager.deleteTripleCollection(dataSet.getSmushGraphRef());
    tcManager.deleteTripleCollection(dataSet.getLogGraphRef());
    
    LockableMGraph publishGraph = dataSet.getPublishGraph();
    MGraph publishedTriples = new IndexedMGraph();
    Lock pl = publishGraph.getLock().readLock();
    pl.lock();
    try {
        publishedTriples.addAll(publishGraph);
      
    }
    finally {
        pl.unlock();
    }
    
    tcManager.deleteTripleCollection(dataSet.getPublishGraphRef());
    
    // remove pipe metadata
    removePipeMetaData(dataSetUri);
    
    message += "The dataset: " + dataSetUri + " has been deleted";
    return RedirectUtil.createSeeOtherResponse("./", uriInfo);
    //return message;
}
 
开发者ID:fusepool,项目名称:datalifecycle,代码行数:47,代码来源:PipesAdmin.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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