Example #1
0
        private static Uri getValue(string sparql, bool canCreateNewId, Logger logger)
        {
            IGraph graph = GraphRetrieval.GetGraph(sparql, logger, "true");

            if (graph.IsEmpty)
            {
                if (canCreateNewId == true)
                {
                    string id = new IdGenerator.IdMaker().MakeId(logger);
                    logger.Verbose($"Created new id ({id})");
                    return(new Uri(id));
                }
                else
                {
                    logger.Verbose("Not found");
                    return(null);
                }
            }
            else
            {
                Uri result = ((IUriNode)graph.Triples.SubjectNodes.SingleOrDefault()).Uri;
                logger.Verbose($"Found existing ({result})");
                return(result);
            }
        }
        public static async Task <string> Run([HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequestMessage req, TraceWriter log, ExecutionContext executionContext)
        {
            Logger logger = new Logger(executionContext);

            logger.Triggered();
            IdMaker generator = new IdMaker();
            string  id        = generator.MakeId(logger);

            return(id);
        }
Example #3
0
        protected Uri GenerateNewId()
        {
            string id = new IdGenerator.IdMaker().MakeId(logger);

            return(new Uri(id));
        }