Package org.apache.stanbol.rules.base.api

Examples of org.apache.stanbol.rules.base.api.Recipe


                                       @FormDataParam("input") InputStream input,
                                       @Context HttpHeaders headers) {

        // Refactorer semionRefactorer = semionManager.getRegisteredRefactorer();
        ResponseBuilder rb;
        Recipe rcp;
        try {
       
         
          URI uri = new URI(recipe);
          if(uri != null && uri.getScheme() == null){
View Full Code Here


                       KRFormat.FUNCTIONAL_OWL, KRFormat.MANCHESTER_OWL, MediaType.TEXT_PLAIN})
    public Response getRule(@PathParam("recipe") String recipeID,
                            @QueryParam("rule") String ruleID,
                            @Context HttpHeaders headers) {

        Recipe recipe;
        Rule rule;

        ResponseBuilder responseBuilder;
        try {
         
          URI uri = new URI(recipeID);
      if(uri.getScheme() == null){
        recipeID = "urn:" + recipeID;
        log.info("The recipe ID is a URI without scheme. The ID is set to " + recipeID);
      }
         
            recipe = ruleStore.getRecipe(new UriRef(recipeID));

            if (ruleID != null && !ruleID.isEmpty()) {
                rule = ruleStore.getRule(recipe, new UriRef(ruleID));
                RuleList ruleList = new RuleList();
                ruleList.add(rule);

                recipe = new RecipeImpl(recipe.getRecipeID(), recipe.getRecipeDescription(), ruleList);
            }

            responseBuilder = Response.ok(recipe);

        } catch (NoSuchRecipeException e) {
View Full Code Here

    @Produces(value = {MediaType.TEXT_HTML})
    public Response showRecipe(@PathParam("recipe") String recipeID,
                               @QueryParam("rule") String ruleID,
                               @Context HttpHeaders headers) {

        Recipe recipe;
        Rule rule;

        ResponseBuilder responseBuilder;
        try {
         
          URI uri = new URI(recipeID);
      if(uri.getScheme() == null){
        recipeID = "urn:" + recipeID;
        log.info("The recipe ID is a URI without scheme. The ID is set to " + recipeID);
      }
     
            recipe = ruleStore.getRecipe(new UriRef(recipeID));

            if (ruleID != null && !ruleID.isEmpty()) {
                rule = ruleStore.getRule(recipe, new UriRef(ruleID));
                RuleList ruleList = new RuleList();
                ruleList.add(rule);

                recipe = new RecipeImpl(recipe.getRecipeID(), recipe.getRecipeDescription(), ruleList);
            }

            responseBuilder = Response.ok(new Viewable("rules", new RulesPrettyPrintResource(servletContext,
                    uriInfo, recipe)));
View Full Code Here

       
      log.info("The recipe ID is : " + recipe);
         
          if (rule != null && !rule.isEmpty()) {
 
              Recipe rcp;
              try {
                rcp = ruleStore.getRecipe(new UriRef(recipe));
                  Rule rl = ruleStore.getRule(rcp, new UriRef(rule));
                  ruleStore.removeRule(rcp, rl);
              } catch (NoSuchRecipeException e) {
View Full Code Here

                                     @FormDataParam(value = "description") String description,
                                     @Context HttpHeaders headers) {

        ResponseBuilder responseBuilder;

        Recipe rcp;
        try {
         
          URI uri = new URI(recipe);
      if(uri.getScheme() == null){
        recipe = "urn:" + recipe;
View Full Code Here

      if(uri.getScheme() == null){
        recipe = "urn:" + recipe;
        log.info("The recipe ID is a URI without scheme. The ID is set to " + recipe);
      }
           
            Recipe rcp = ruleStore.getRecipe(new UriRef(recipe));
            RuleAdapter adapter = adapterManager.getAdapter(rcp, classToLoad);

            Object adaptedRecipe = adapter.adaptTo(rcp, classToLoad);

            JSONObject jsonObject = new JSONObject();
            try {
                jsonObject.put("recipe", rcp.getRecipeID().toString());
                jsonObject.put("adaptedTo", format);
                jsonObject.put("result", adaptedRecipe.toString());
            } catch (JSONException e) {
                log.error(e.getMessage(), e);
            }
View Full Code Here

             * We pass the ontology and the recipe IRI to the Refactor that returns the refactored graph
             * expressed by using the given vocabulary.
             *
             * To perform the refactoring of the ontology to a given vocabulary we use the Stanbol Refactor.
             */
            Recipe recipe = ruleStore.getRecipe(IRI.create(engineConfiguration.getRecipeId()));

            log.debug("Recipe {} contains {} rules.", recipe, recipe.getkReSRuleList().size());
            log.debug("The ontology to be refactor is {}", ontology);

            ontology = refactorer
                    .ontologyRefactoring(ontology, IRI.create(engineConfiguration.getRecipeId()));

View Full Code Here

                return null;
            }

            @Override
            public Recipe getRecipe(IRI recipeIRI) throws NoSuchRecipeException {
                Recipe recipe = null;

                if (recipeIRI != null) {
                    OWLDataFactory factory = OWLManager.getOWLDataFactory();
                    OWLIndividual recipeIndividual = factory.getOWLNamedIndividual(recipeIRI);
                    if (recipeIndividual != null) {
View Full Code Here

        String recipe = "rule[is(<http://kres.iks-project.eu/ontology.owl#Person>, ?x) -> is(<http://xmlns.com/foaf/0.1/Person>, ?x)]";

        KB kb = RuleParserImpl.parse(recipe);
        RuleList ruleList = kb.getkReSRuleList();
        Recipe actualRecipe = new RecipeImpl(null, null, ruleList);

        Refactorer refactorer = new RefactorerImpl(null, new Serializer(), tcm, ruleStore,
                emptyConfig);
        try {
            refactorer.ontologyRefactoring(ontology, actualRecipe);
View Full Code Here

        try {

          System.out.println(rules);
         
          Recipe recipe = ruleStore.addRuleToRecipe(recipeID, rules);
         
          if(recipe != null){
            ResponseBuilder rb = Response.ok();
                MediaType mediaType = MediaTypeUtil.getAcceptableMediaType(headers, null);
                if (mediaType != null) rb.header(HttpHeaders.CONTENT_TYPE, mediaType);
View Full Code Here

TOP

Related Classes of org.apache.stanbol.rules.base.api.Recipe

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.